"use client"; import { ColumnDef } from "@tanstack/react-table"; import { ExtendedColumnDef } from "@app/components/ui/data-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: ExtendedColumnDef[] = [ { accessorKey: "orgId", enableHiding: false, friendlyName: t('orgId'), header: ({ column }) => { return ( ); } }, { accessorKey: "roleMapping", friendlyName: t('roleMapping'), header: ({ column }) => { return ( ); }, cell: ({ row }) => { const mapping = row.original.roleMapping; return mapping ? ( 50 ? `${mapping.substring(0, 50)}...` : mapping} info={mapping} /> ) : ( "-" ); } }, { accessorKey: "orgMapping", friendlyName: t('orgMapping'), header: ({ column }) => { return ( ); }, cell: ({ row }) => { const mapping = row.original.orgMapping; return mapping ? ( 50 ? `${mapping.substring(0, 50)}...` : mapping} info={mapping} /> ) : ( "-" ); } }, { id: "actions", enableHiding: false, header: () => , cell: ({ row }) => { const policy = row.original; return (
{ onDelete(policy.orgId); }} > {t('delete')}
); } } ]; return ; }