Files
portabase/src/features/dashboard/restore/columns.tsx
T

54 lines
1.8 KiB
TypeScript
Raw Normal View History

2025-05-16 15:54:17 +02:00
"use client";
2024-11-11 14:56:33 +01:00
2025-05-16 15:54:17 +02:00
import { ColumnDef } from "@tanstack/react-table";
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { Button } from "@/components/ui/button";
import { MoreHorizontal } from "lucide-react";
import { ReloadIcon } from "@radix-ui/react-icons";
import { StatusBadge } from "@/components/wrappers/common/status-badge";
2025-07-16 12:36:11 +02:00
import {Restoration} from "@/db/schema/06_database";
2025-07-16 20:16:18 +02:00
import {formatFrenchDate} from "@/utils/date-formatting";
2024-11-11 14:56:33 +01:00
2024-12-14 17:52:10 +01:00
export const restoreColumns: ColumnDef<Restoration>[] = [
2024-11-11 14:56:33 +01:00
{
accessorKey: "id",
header: "Reference",
},
{
accessorKey: "createdAt",
header: "Created At",
2025-05-16 15:54:17 +02:00
cell: ({ row }) => {
2025-07-16 20:16:18 +02:00
return formatFrenchDate(row.getValue("createdAt"))
2024-11-11 19:12:34 +01:00
},
2024-11-11 14:56:33 +01:00
},
{
accessorKey: "status",
header: "Status",
2025-05-16 15:54:17 +02:00
cell: ({ row }) => {
return <StatusBadge status={row.getValue("status")} />;
2024-11-11 14:56:33 +01:00
},
},
{
id: "actions",
2025-05-16 15:54:17 +02:00
cell: ({ row }) => {
2024-11-11 14:56:33 +01:00
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="ghost" className="h-8 w-8 p-0">
<span className="sr-only">Open menu</span>
2025-05-16 15:54:17 +02:00
<MoreHorizontal className="h-4 w-4" />
2024-11-11 14:56:33 +01:00
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuLabel>Actions</DropdownMenuLabel>
2024-11-11 20:31:35 +01:00
2025-05-16 15:54:17 +02:00
<DropdownMenuItem onClick={() => {}}>
<ReloadIcon /> Rerun
2024-11-11 14:56:33 +01:00
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
2025-05-16 15:54:17 +02:00
);
2024-11-11 14:56:33 +01:00
},
},
2025-05-16 15:54:17 +02:00
];