chore: remove outdated todo comment

This commit is contained in:
2025-12-27 20:26:09 +00:00
parent eca3b95c3e
commit 67320f8090

View File

@@ -1,5 +1,3 @@
// TODO: make table sorting work (right now not working probably because different params share same query key)
import { useInfiniteQuery, useMutation } from "@tanstack/react-query" import { useInfiniteQuery, useMutation } from "@tanstack/react-query"
import { Link, useNavigate } from "@tanstack/react-router" import { Link, useNavigate } from "@tanstack/react-router"
import { import {
@@ -101,96 +99,89 @@ function useTableColumns(
directoryUrlFn: (directory: DirectoryInfo) => string, directoryUrlFn: (directory: DirectoryInfo) => string,
readOnly: boolean, readOnly: boolean,
): ColumnDef<DirectoryItem>[] { ): ColumnDef<DirectoryItem>[] {
return useMemo( return useMemo(() => {
() => { const columns: ColumnDef<DirectoryItem>[] = []
const columns: ColumnDef<DirectoryItem>[] = [] if (!readOnly) {
if (!readOnly) { columns.push({
columns.push({ id: "select",
id: "select", header: ({ table }) => (
header: ({ table }) => ( <Checkbox
<Checkbox checked={table.getIsAllPageRowsSelected()}
checked={table.getIsAllPageRowsSelected()} onCheckedChange={(value) => {
onCheckedChange={(value) => { table.toggleAllPageRowsSelected(!!value)
table.toggleAllPageRowsSelected(!!value) }}
}} aria-label="Select all"
aria-label="Select all" />
/> ),
), cell: ({ row }) => (
cell: ({ row }) => ( <Checkbox
<Checkbox checked={row.getIsSelected()}
checked={row.getIsSelected()} onClick={(e) => {
onClick={(e) => { e.stopPropagation()
e.stopPropagation() }}
}} onCheckedChange={row.getToggleSelectedHandler()}
onCheckedChange={row.getToggleSelectedHandler()} aria-label="Select row"
aria-label="Select row" />
/> ),
), enableSorting: false,
enableSorting: false, enableHiding: false,
enableHiding: false, size: 24,
size: 24, })
}) }
}
columns.push( columns.push(
{ {
header: () => <NameHeaderCell />, header: () => <NameHeaderCell />,
accessorKey: "doc.name", accessorKey: "doc.name",
cell: ({ row }) => { cell: ({ row }) => {
switch (row.original.kind) { switch (row.original.kind) {
case "file": case "file":
return ( return (
<FileNameCell <FileNameCell
file={row.original} file={row.original}
onOpenFile={onOpenFile} onOpenFile={onOpenFile}
/> />
) )
case "directory": case "directory":
return ( return (
<DirectoryNameCell <DirectoryNameCell
directory={row.original} directory={row.original}
directoryUrlFn={directoryUrlFn} directoryUrlFn={directoryUrlFn}
/> />
) )
} }
},
size: 1000,
}, },
{ size: 1000,
header: "Size", },
accessorKey: "size", {
cell: ({ row }) => { header: "Size",
switch (row.original.kind) { accessorKey: "size",
case "file": cell: ({ row }) => {
return ( switch (row.original.kind) {
<div> case "file":
{formatFileSize(row.original.size)} return (
</div> <div>{formatFileSize(row.original.size)}</div>
) )
case "directory": case "directory":
return <div className="font-mono">-</div> return <div className="font-mono">-</div>
} }
},
}, },
{ },
header: "Created At", {
accessorKey: "createdAt", header: "Created At",
cell: ({ row }) => { accessorKey: "createdAt",
return ( cell: ({ row }) => {
<div> return (
{new Date( <div>
row.original.createdAt, {new Date(row.original.createdAt).toLocaleString()}
).toLocaleString()} </div>
</div> )
)
},
}, },
) },
)
return columns return columns
}, }, [onOpenFile, directoryUrlFn, readOnly])
[onOpenFile, directoryUrlFn, readOnly],
)
} }
export function DirectoryContentTable({ export function DirectoryContentTable({