import { ContextMenuContent, ContextMenuItem, ContextMenuSubTrigger, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent } from "@/components/ui/context-menu" import Link from "next/link" import { ComponentProps, useState } from "react" import { Row, Table, TableState } from "@tanstack/react-table" export default function FormContextMenu({ table, row, openEditDialog, openDeleteDialog }: ComponentProps<"div"> & { table: Table, row: Row, openEditDialog: (row: Row) => void, openDeleteDialog: (row: Row) => void }) { const pathname = table.options.meta.pathname const selectedRows = table.getSelectedRowModel().flatRows return ( {pathname !== "/submission" && selectedRows.length <= 1 ? <> Inspect : "" } openEditDialog(row)}> Edit { selectedRows.length > 0 ? { table.resetRowSelection() }}>Deselect : "" } openDeleteDialog(row)}>Delete ) }