fix: filesize lib was buggy. removed selection options as we dont use thos

This commit is contained in:
Juan Di Toro 2024-03-27 07:34:52 +01:00
parent ffef784f50
commit 4cadd0072d
3 changed files with 27 additions and 26 deletions

View File

@ -37,5 +37,5 @@ export default function filesize(bytes: number, fixed = 1, spec: keyof typeof SP
_bytes /= radix; _bytes /= radix;
++loop; ++loop;
} }
return `${bytes.toFixed(fixed)} ${unit[loop]}`; return `${_bytes.toFixed(fixed)} ${unit[loop]}`;
} }

View File

@ -27,29 +27,29 @@ export type File = {
}; };
export const columns: ColumnDef<FileItem>[] = [ export const columns: ColumnDef<FileItem>[] = [
{ // {
id: "select", // id: "select",
size: 20, // size: 20,
header: ({ table }) => ( // header: ({ table }) => (
<Checkbox // <Checkbox
checked={ // checked={
table.getIsAllPageRowsSelected() || // table.getIsAllPageRowsSelected() ||
(table.getIsSomePageRowsSelected() && "indeterminate") // (table.getIsSomePageRowsSelected() && "indeterminate")
} // }
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)} // onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
aria-label="Select all" // aria-label="Select all"
/> // />
), // ),
cell: ({ row }) => ( // cell: ({ row }) => (
<Checkbox // <Checkbox
checked={row.getIsSelected()} // checked={row.getIsSelected()}
onCheckedChange={(value) => row.toggleSelected(!!value)} // onCheckedChange={(value) => row.toggleSelected(!!value)}
aria-label="Select row" // aria-label="Select row"
/> // />
), // ),
enableSorting: false, // enableSorting: false,
enableHiding: false, // enableHiding: false,
}, // },
{ {
accessorKey: "cid", accessorKey: "cid",
header: "CID", header: "CID",

View File

@ -64,10 +64,11 @@ export default function FileManager() {
placeholder="Search files by name or CID" placeholder="Search files by name or CID"
className="border-ring font-medium w-full grow h-12 flex-1 bg-primary-2/10" className="border-ring font-medium w-full grow h-12 flex-1 bg-primary-2/10"
/> />
<Button className="h-12 gap-x-2"> {/* We dont yet have any functionality for selecting so im commenting this out */}
{/* <Button className="h-12 gap-x-2">
<AddIcon /> <AddIcon />
Select All Select All
</Button> </Button> */}
<DialogTrigger asChild> <DialogTrigger asChild>
<Button className="h-12 gap-x-2"> <Button className="h-12 gap-x-2">
<AddIcon /> <AddIcon />