"use client"; import { ColumnDef } from "@tanstack/react-table"; import { ResourcesDataTable } from "./ResourcesDataTable"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@app/components/ui/dropdown-menu"; import { Button } from "@app/components/ui/button"; import { ArrowUpDown, MoreHorizontal } from "lucide-react"; import Link from "next/link"; import { useRouter } from "next/navigation"; import api from "@app/api"; export type ResourceRow = { id: number; name: string; orgId: string; domain: string; site: string; }; export const columns: ColumnDef[] = [ { accessorKey: "name", header: ({ column }) => { return ( ); }, }, { accessorKey: "site", header: ({ column }) => { return ( ); }, }, { accessorKey: "domain", header: "Domain", }, { id: "actions", cell: ({ row }) => { const router = useRouter(); const resourceRow = row.original; const deleteResource = (resourceId: number) => { api.delete(`/resource/${resourceId}`) .catch((e) => { console.error("Error deleting resource", e); }) .then(() => { router.refresh(); }); } return ( View settings ); }, }, ]; type ResourcesTableProps = { resources: ResourceRow[]; orgId: string; }; export default function SitesTable({ resources, orgId }: ResourcesTableProps) { const router = useRouter(); return ( { router.push(`/${orgId}/resources/create`); }} /> ); }