File size: 1,572 Bytes
f27679f
 
 
 
 
1185ec1
f27679f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { PiTrashBold } from "react-icons/pi"

import { TableCell, TableRow } from "@/components/ui/table"
import { cn } from "@/lib/utils"
import { MdLockClock } from "react-icons/md"
import { VideoInfo } from "@/types/general"
import { truncate } from "./truncate"

export function PendingVideoCard({
  video,
  onDelete,
  className = "",
}: {
  video: VideoInfo
  onDelete?: (video: VideoInfo) => void
  className?: string
 }) {

  const isBusy = video.status === "queued" || video.status === "generating"
  const hasError = video.status === "error"
  const isNotGeneratedYet = video.status === "submitted" || video.status === "queued" || video.status === "generating"
  const isGenerated = video.status === "published"

  return (
    <TableRow className={cn(
      className,
    )}>
      <TableCell className="w-[100px] text-xs">{truncate(video.id, 8)}</TableCell>
      <TableCell className="w-[120px]">{video.updatedAt || "N.A."}</TableCell>
      <TableCell className="w-[150px] truncate">{truncate(video.description, 20)}</TableCell>
      <TableCell className="w-[150px] truncate">{truncate(video.description, 45)}</TableCell> 
      <TableCell className="w-[100px]">{video.status}</TableCell>
      <TableCell>
        {
        isBusy
        ? <MdLockClock className="h-5 w-5" />
        : <div
          className="h-8 w-8 rounded-full cursor-pointer hover:bg-neutral-600 flex flex-col items-center justify-center"
          onClick={() => { onDelete?.(video) }}><PiTrashBold className="h-6 w-6" />
        </div>
       }</TableCell>
    </TableRow>
  )
}