"use client"; import { Alert } from "@/components/ui/alert"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Checkbox } from "@/components/ui/checkbox"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { toast } from "@/components/ui/toaster"; import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; // import { trpc } from "@/lib/trpc/client"; // import { ColumnDef } from "@tanstack/react-table"; import { ArrowUpDown, Minus, MoreHorizontal, MoreVertical, Trash } from "lucide-react"; // import ms from "ms"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { Loading } from "../loading"; import { DataTable } from "./table"; type Column = { id: string; start: string; createdAt: Date; expires: Date | null; ownerId: string | null; name: string | null; ratelimitType: string | null; ratelimitLimit: number | null; ratelimitRefillRate: number | null; ratelimitRefillInterval: number | null; remaining: number | null; }; type Props = { data: Column[]; }; export const RootKeyTable: React.FC = ({ data }) => { const router = useRouter(); // const deleteKey = trpc.key.deleteRootKey.useMutation({ // onSuccess: () => { // toast.success("Root Key was deleted"); // router.refresh(); // }, // onError: (err, variables) => { // toast(`Could not delete key ${JSON.stringify(variables)}`, { // description: err.message, // }); // router.refresh(); // }, // }); // const columns: ColumnDef[] = [ // { // id: "select", // header: ({ table }) => ( //
// table.toggleAllPageRowsSelected(!!value)} // aria-label="Select all" // /> //
// ), // cell: ({ row }) => ( //
// row.toggleSelected(!!value)} // aria-label="Select row" // /> //
// ), // enableSorting: false, // enableHiding: false, // }, // { // accessorKey: "start", // header: "Key", // cell: ({ row }) => ( // // // {row.getValue("start")}... // // // This is the first part of the key to visually match it. We don't store the full key for // security reasons. // // // ), // }, // { // accessorKey: "createdAt", // header: ({ column }) => ( // // ), // cell: ({ row }) => row.original.createdAt.toUTCString(), // }, // { // accessorKey: "expires", // header: "Expires", // cell: ({ row }) => // row.original.expires ? ( // row.original.expires.getTime() < Date.now() ? ( // Expired // ) : ( // in {ms(row.original.expires.getTime() - Date.now(), { long: true })} // ) // ) : ( // // ), // }, // { // accessorKey: "ownerId", // header: "Owner", // cell: ({ row }) => // row.original.ownerId ? ( // {row.original.ownerId} // ) : ( // // ), // }, // { // accessorKey: "name", // header: "Name", // cell: ({ row }) => // row.original.name ? ( // {row.original.name} // ) : ( // // ), // }, // { // id: "actions", // cell: ({ row }) => ( //
// // // // // // // { // e.preventDefault(); // }} // > // // Details // // // { // e.preventDefault(); // }} // > // // Revoke Key // // // // // Revoke Root Key // // Delete the key {row.original.start}...{" "} // permanenty // // // This action can not be undone. Your root key will no longer be able to create // resources // // // // // // // // // //
// ), // }, // ]; return ; };