"use client"; import { ColumnDef } from "@tanstack/react-table"; import { Button } from "@app/components/ui/button"; import { ArrowUpDown, Trash2, MoreHorizontal, Pencil, ArrowRight } from "lucide-react"; import { PolicyDataTable } from "@app/components/PolicyDataTable"; import { Badge } from "@app/components/ui/badge"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@app/components/ui/dropdown-menu"; import Link from "next/link"; import { InfoPopup } from "@app/components/ui/info-popup"; import { useTranslations } from "next-intl"; export interface PolicyRow { orgId: string; roleMapping?: string; orgMapping?: string; } interface Props { policies: PolicyRow[]; onDelete: (orgId: string) => void; onAdd: () => void; onEdit: (policy: PolicyRow) => void; } export default function PolicyTable({ policies, onDelete, onAdd, onEdit }: Props) { const t = useTranslations(); const columns: ColumnDef[] = [ { id: "dots", cell: ({ row }) => { const r = row.original; return ( { onDelete(r.orgId); }} > {t('delete')} ); } }, { accessorKey: "orgId", header: ({ column }) => { return ( ); } }, { accessorKey: "roleMapping", header: ({ column }) => { return ( ); }, cell: ({ row }) => { const mapping = row.original.roleMapping; return mapping ? ( 50 ? `${mapping.substring(0, 50)}...` : mapping} info={mapping} /> ) : ( "--" ); } }, { accessorKey: "orgMapping", header: ({ column }) => { return ( ); }, cell: ({ row }) => { const mapping = row.original.orgMapping; return mapping ? ( 50 ? `${mapping.substring(0, 50)}...` : mapping} info={mapping} /> ) : ( "--" ); } }, { id: "actions", cell: ({ row }) => { const policy = row.original; return (
); } } ]; return ; }