From ffef784f5040873c7ce035902c73447297252a17 Mon Sep 17 00:00:00 2001 From: Juan Di Toro Date: Wed, 27 Mar 2024 07:22:58 +0100 Subject: [PATCH] feat: closes #21 --- app/components/icons.tsx | 19 +++++++++++++++++++ app/routes/file-manager/columns.tsx | 25 +++++++++++++++---------- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/app/components/icons.tsx b/app/components/icons.tsx index d2288ef..9d38ff3 100644 --- a/app/components/icons.tsx +++ b/app/components/icons.tsx @@ -589,3 +589,22 @@ export const ExclamationCircleIcon = ({ ); }; + +export const DownloadIcon = ({ className }: { className?: string }) => { + return ( + + ); +}; diff --git a/app/routes/file-manager/columns.tsx b/app/routes/file-manager/columns.tsx index a0a381f..5cd81ea 100644 --- a/app/routes/file-manager/columns.tsx +++ b/app/routes/file-manager/columns.tsx @@ -1,6 +1,6 @@ import { TrashIcon } from "@radix-ui/react-icons"; import type { ColumnDef } from "@tanstack/react-table"; -import { FileIcon, MoreIcon } from "~/components/icons"; +import { DownloadIcon, FileIcon, MoreIcon } from "~/components/icons"; import { Checkbox } from "~/components/ui/checkbox"; import { DropdownMenu, @@ -14,6 +14,7 @@ import { cn } from "~/utils"; import type { FileItem } from "~/data/file-provider"; import { usePinning } from "~/hooks/usePinning"; import filesize from "~/components/lib/filesize"; +import { Button } from "~/components/ui/button"; // This type is used to define the shape of our data. @@ -50,19 +51,15 @@ export const columns: ColumnDef[] = [ enableHiding: false, }, { - accessorKey: "name", - header: "Name", + accessorKey: "cid", + header: "CID", cell: ({ row }) => (
- {row.getValue("name")} + {row.getValue("name") ?? row.getValue("cid")}
), }, - { - accessorKey: "cid", - header: "CID", - }, { accessorKey: "size", header: "Size", @@ -82,12 +79,20 @@ export const columns: ColumnDef[] = [ size: 20, cell: ({ row }) => { const { unpin } = usePinning(); + const downloadFile = () => { + // TODO: @pcfreak30 download file + const cid = row.getValue("cid"); + console.log(cid); + }; return ( -
+
+