"use client" import { IconDownload, IconEdit, IconFolderSymlink, IconShare, IconStar, IconStarFilled, IconTrash, IconTrashOff, } from "@tabler/icons-react" import type { FileItem } from "@/lib/files-data" import { useFiles } from "@/hooks/use-files" import { ContextMenu, ContextMenuContent, ContextMenuItem, ContextMenuSeparator, ContextMenuTrigger, } from "@/components/ui/context-menu" import { toast } from "sonner" export function FileContextMenu({ file, children, onRename, onMove, }: { file: FileItem children: React.ReactNode onRename: (file: FileItem) => void onMove: (file: FileItem) => void }) { const { dispatch } = useFiles() return ( {children} {file.type === "folder" && ( toast.info("Opening folder...")}> Open )} toast.info("Share dialog coming soon")}> Share {!file.trashed && ( <> toast.success("Download started")}> Download onRename(file)}> Rename onMove(file)}> Move to dispatch({ type: "STAR_FILE", payload: file.id })} > {file.starred ? ( <> Unstar ) : ( <> Star )} { dispatch({ type: "TRASH_FILE", payload: file.id }) toast.success(`"${file.name}" moved to trash`) }} > Delete )} {file.trashed && ( { dispatch({ type: "RESTORE_FILE", payload: file.id }) toast.success(`"${file.name}" restored`) }} > Restore )} ) }