import clsx from "clsx"; import { useTranslation } from "react-i18next"; import { Scissors } from "lucide-react"; import type { LibraryFile } from "../lib/api"; import { navItemAttrs } from "../lib/listNav"; import { JobThumb } from "./downloadRow"; import { jobTitle } from "./downloadTitle"; import { PhoneBadge, RetentionBadge, SourceBadge } from "./fileBadges"; import { MediaCard, MediaPlayGlyph } from "./ui/MediaCard"; import { MEDIA_BADGE, MEDIA_BAR, MEDIA_HOVER_LAYER, MEDIA_PICTURE, mediaPictureBox, mediaTitleClass, } from "./ui/mediaCardStyles"; import { MoreButton } from "./ui/MoreButton"; import { Pressable } from "./ui/Pressable"; // A library file in the Files grid: the one media card (ui/MediaCard) — its picture plays it, the // title under it, then where it came from and what needs saying about it (kept, leaving soon). The // right click, the long press and the "…" open the same menu as its table row (DESIGN.md "Files page": // the grid is the list's other paint, a toggle remembered per folder). export function FileCard({ file, index, onPlay, menuProps, moreProps, menuOpen, arrived, }: { file: LibraryFile; /** Its place on the page, for the keyboard walk. */ index: number; /** Null: nothing to play (a plain file, a shared one its owner keeps from me). */ onPlay: (() => void) | null; menuProps: Record; moreProps: Record; menuOpen: boolean; /** The file a link or a notice opened the page on. */ arrived: boolean; }) { const { t } = useTranslation(); const title = jobTitle(file); const channel = file.display_uploader || file.asset?.uploader || null; const clip = file.job_kind === "edit" || file.job_kind === "clip"; const thumb = ; return ( {onPlay ? ( {thumb}
) : (
{thumb}
)} {clip && ( {t("downloads.clipBadge")} )} {/* `media`: legible on any picture, the Plex cards' hover row's look. */} } title={ {title} } meta={ {channel && {channel}} } more={{ props: moreProps, open: menuOpen }} moreLabel={t("files.rowMenu")} /> ); }