From 44b9f625cc162226bab6ee454077f99434d28e30 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 27 Mar 2024 06:05:48 -0400 Subject: [PATCH 1/2] feat: implement download file --- app/routes/file-manager/columns.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/routes/file-manager/columns.tsx b/app/routes/file-manager/columns.tsx index a5b23d8..615fd25 100644 --- a/app/routes/file-manager/columns.tsx +++ b/app/routes/file-manager/columns.tsx @@ -15,6 +15,9 @@ import type { FileItem } from "~/data/file-provider"; import { usePinning } from "~/hooks/usePinning"; import filesize from "~/components/lib/filesize"; import { Button } from "~/components/ui/button"; +import {useSdk} from "~/components/lib/sdk-context.js"; +import {S5Client} from "@lumeweb/s5-js"; +import {PROTOCOL_S5} from "@lumeweb/portal-sdk"; // This type is used to define the shape of our data. @@ -79,10 +82,12 @@ export const columns: ColumnDef[] = [ size: 20, cell: ({ row }) => { const { unpin } = usePinning(); + const sdk = useSdk(); const downloadFile = () => { - // TODO: @pcfreak30 download file const cid = row.getValue("cid"); - console.log(cid); + const portalUrl = sdk.protocols!().get(PROTOCOL_S5).getSdk().portalUrl; + + window.open(`${portalUrl}/s5/download/${cid}`,"_blank"); }; return (
From 38593ae03224b5030e6c34236b0e060db2a59e58 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 27 Mar 2024 23:43:44 -0400 Subject: [PATCH 2/2] dep: update portal-sdk --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0604528..4005858 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "@conform-to/react": "^1.0.2", "@conform-to/zod": "^1.0.2", "@fontsource-variable/manrope": "^5.0.19", - "@lumeweb/portal-sdk": "0.0.0-20240327035051", + "@lumeweb/portal-sdk": "0.0.0-20240328040103", "@radix-ui/react-accordion": "^1.1.2", "@radix-ui/react-avatar": "^1.0.4", "@radix-ui/react-checkbox": "^1.0.4",