|
@@ -22,90 +22,6 @@ interface FileData {
|
|
|
updatedAt: string;
|
|
updatedAt: string;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const columns: ColumnDef<FileData>[] = [
|
|
|
|
|
- {
|
|
|
|
|
- id: "select",
|
|
|
|
|
- header: ({ table }) => (
|
|
|
|
|
- <div className="px-6 py-3">
|
|
|
|
|
- <input
|
|
|
|
|
- type="checkbox"
|
|
|
|
|
- checked={table.getIsAllPageRowsSelected()}
|
|
|
|
|
- onChange={(e) => table.toggleAllPageRowsSelected(!!e.target.checked)}
|
|
|
|
|
- className="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500"
|
|
|
|
|
- />
|
|
|
|
|
- </div>
|
|
|
|
|
- ),
|
|
|
|
|
- cell: ({ row }) => (
|
|
|
|
|
- <div className="px-6 py-4">
|
|
|
|
|
- <input
|
|
|
|
|
- type="checkbox"
|
|
|
|
|
- checked={row.getIsSelected()}
|
|
|
|
|
- onChange={(e) => row.toggleSelected(!!e.target.checked)}
|
|
|
|
|
- className="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500"
|
|
|
|
|
- />
|
|
|
|
|
- </div>
|
|
|
|
|
- ),
|
|
|
|
|
- enableSorting: false,
|
|
|
|
|
- enableHiding: false,
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- accessorKey: "filename",
|
|
|
|
|
- header: "File Name",
|
|
|
|
|
- cell: ({ row }) => (
|
|
|
|
|
- <div className="font-medium text-gray-900">{row.getValue("filename")}</div>
|
|
|
|
|
- ),
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- accessorKey: "mimetype",
|
|
|
|
|
- header: "Type",
|
|
|
|
|
- cell: ({ row }) => (
|
|
|
|
|
- <div className="text-sm text-gray-600">{row.getValue("mimetype")}</div>
|
|
|
|
|
- ),
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- accessorKey: "size",
|
|
|
|
|
- header: "Size",
|
|
|
|
|
- cell: ({ row }) => {
|
|
|
|
|
- const bytes = row.getValue("size") as number;
|
|
|
|
|
- if (bytes === 0) return "0 Bytes";
|
|
|
|
|
-
|
|
|
|
|
- const k = 1024;
|
|
|
|
|
- const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
|
|
|
- const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
|
|
|
-
|
|
|
|
|
- return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- accessorKey: "createdAt",
|
|
|
|
|
- header: "Created",
|
|
|
|
|
- cell: ({ row }) => {
|
|
|
|
|
- const date = new Date(row.getValue("createdAt"));
|
|
|
|
|
- return date.toLocaleDateString("en-US", {
|
|
|
|
|
- year: "numeric",
|
|
|
|
|
- month: "short",
|
|
|
|
|
- day: "numeric",
|
|
|
|
|
- hour: "2-digit",
|
|
|
|
|
- minute: "2-digit",
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- accessorKey: "updatedAt",
|
|
|
|
|
- header: "Updated",
|
|
|
|
|
- cell: ({ row }) => {
|
|
|
|
|
- const date = new Date(row.getValue("updatedAt"));
|
|
|
|
|
- return date.toLocaleDateString("en-US", {
|
|
|
|
|
- year: "numeric",
|
|
|
|
|
- month: "short",
|
|
|
|
|
- day: "numeric",
|
|
|
|
|
- hour: "2-digit",
|
|
|
|
|
- minute: "2-digit",
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
-];
|
|
|
|
|
-
|
|
|
|
|
export function FilesTable() {
|
|
export function FilesTable() {
|
|
|
const [sorting, setSorting] = useState<SortingState>([]);
|
|
const [sorting, setSorting] = useState<SortingState>([]);
|
|
|
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
|
|
const [rowSelection, setRowSelection] = useState<RowSelectionState>({});
|