"use client"; import { ColumnDef } from "@tanstack/react-table"; import { Eye, MoreVertical, MoveDownRight, SquarePen, Trash2, } from "lucide-react"; import { Button } from "@/components/ui/button"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { format } from "date-fns"; import { Link } from "@/components/navigation"; const columns: ColumnDef[] = [ { accessorKey: "no", header: "No", cell: ({ row }) => (

{row.getValue("no")}

), }, { accessorKey: "contentTitle", header: "Judul", cell: ({ row }: { row: { getValue: (key: string) => string } }) => { const title: string = row.getValue("contentTitle"); return ( {title.length > 50 ? `${title.slice(0, 30)}...` : title} ); }, }, { accessorKey: "contentTag", header: "Tag", cell: ({ row }) => ( {row.getValue("contentTag")} ), }, { accessorKey: "contentType", header: "Tipe Konten ", cell: ({ row }) => ( {row.getValue("contentType")} ), }, { accessorKey: "contentCreatedGroupBy", header: "Sumber ", cell: ({ row }) => ( {row.getValue("contentCreatedGroupBy")} ), }, { accessorKey: "isPublish", header: "Status", cell: ({ row }) => { const isPublish = row.getValue("isPublish"); return (
); }, }, { accessorKey: "contentCreatedDate", header: "Tanggal Unggah", cell: ({ row }) => { const createdAt = row.getValue("contentCreatedDate") as | string | number | undefined; const formattedDate = createdAt && !isNaN(new Date(createdAt).getTime()) ? format(new Date(createdAt), "dd-MM-yyyy HH:mm:ss") : "-"; return {formattedDate}; }, }, { id: "actions", accessorKey: "action", header: "Actions", enableHiding: false, cell: ({ row }) => { return ( Pindah Ke Mediahub ); }, }, ]; export default columns;