"use client"; import { Button } from "@heroui/button"; import { Dropdown, DropdownItem, DropdownMenu, DropdownSection, DropdownTrigger, } from "@heroui/dropdown"; import { DeleteDocumentBulkIcon, EditDocumentBulkIcon, } from "@heroui/shared-icons"; import { Row } from "@tanstack/react-table"; import clsx from "clsx"; import { VerticalDotsIcon } from "@/components/icons"; import { EnrichedApiKey } from "./types"; interface DataTableRowActionsProps { row: Row; onEdit: (apiKey: EnrichedApiKey) => void; onRevoke: (apiKey: EnrichedApiKey) => void; } const iconClasses = "text-2xl text-default-500 pointer-events-none shrink-0"; export function DataTableRowActions({ row, onEdit, onRevoke, }: DataTableRowActionsProps) { const apiKey = row.original; const isRevoked = apiKey.attributes.revoked; const isExpired = new Date(apiKey.attributes.expires_at) < new Date(); const canRevoke = !isRevoked && !isExpired; return (
} onPress={() => onEdit(apiKey)} > Edit name {canRevoke ? ( } onPress={() => onRevoke(apiKey)} > Revoke ) : null}
); }