/* eslint-disable react-hooks/rules-of-hooks */ import { FileSources, FileContext } from 'librechat-data-provider'; import type { ColumnDef } from '@tanstack/react-table'; import type { TFile } from 'librechat-data-provider'; import { CrossIcon, DotsIcon } from '~/components/svg'; import { Button, Checkbox } from '~/components/ui'; import { formatDate, getFileType } from '~/utils'; import useLocalize from '~/hooks/useLocalize'; import FileIcon from '~/components/svg/Files/FileIcon'; import { PlusIcon } from 'lucide-react'; export const fileTableColumns: ColumnDef[] = [ { id: 'select', header: ({ table }) => { return ( table.toggleAllPageRowsSelected(!!value)} aria-label="Select all" className="flex" /> ); }, cell: ({ row }) => { return ( row.toggleSelected(!!value)} aria-label="Select row" className="flex" /> ); }, enableSorting: false, enableHiding: false, }, { meta: { size: '50px', }, accessorKey: 'icon', header: () => { return 'Icon'; }, cell: ({ row }) => { const file = row.original; return ; }, }, { meta: { size: '150px', }, accessorKey: 'filename', header: ({ column }) => { const localize = useLocalize(); return <>{localize('com_ui_name')}; }, cell: ({ row }) => { const file = row.original; return {file.filename}; }, }, { accessorKey: 'vectorStores', header: () => { return 'Vector Stores'; }, cell: ({ row }) => { const { vectorsAttached: attachedVectorStores } = row.original; return ( <> {attachedVectorStores.map((vectorStore, index) => { if (index === 4) {return (   {attachedVectorStores.length - index} more );} if (index > 4) {return null;} return ( {vectorStore.name} ); })} ); }, }, { accessorKey: 'updatedAt', header: () => { const localize = useLocalize(); return 'Modified'; }, cell: ({ row }) => formatDate(row.original.updatedAt), }, { accessorKey: 'actions', header: () => { return 'Actions'; }, cell: ({ row }) => { return ( <> ); }, }, ];