import { TableCell, TableRow } from "@/components/ui/table";
import { cn } from "@/lib/utils";
import {
getRowHeightTailwindClass,
type RowHeight,
} from "@/components/table-row-height-switch";
import { Checkbox } from "@/components/ui/checkbox";
import FileProgress from "@/components/file-progress";
import React, { memo, type ReactNode, useState } from "react";
import { type TelegramFile } from "@/lib/types";
import SpoiledWrapper from "@/components/spoiled-wrapper";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
import PhotoPreview from "@/components/photo-preview";
import prettyBytes from "pretty-bytes";
import FileStatus from "@/components/file-status";
import FileExtra from "@/components/file-extra";
import FileControl from "@/components/file-control";
import { FileAudioIcon, FileIcon, ImageIcon, VideoIcon } from "lucide-react";
import Image from "next/image";
import { type Column } from "./table-column-filter";
import { useFileSpeed } from "@/hooks/use-file-speed";
interface FileRowProps {
file: TelegramFile;
checked: boolean;
properties: {
rowHeight: RowHeight;
dynamicClass: {
content: string;
contentCell: string;
};
columns: Column[];
};
onCheckedChange: (checked: boolean) => void;
}
export default function FileRow({
file,
checked,
properties,
onCheckedChange,
}: FileRowProps) {
const { rowHeight, dynamicClass, columns } = properties;
const { downloadProgress, downloadSpeed } = useFileSpeed(file.id);
const [hovered, setHovered] = useState(false);
const getFileIcon = (type: TelegramFile["type"]) => {
let icon;
switch (type) {
case "photo":
icon =