diff --git a/frontend/src/components/editor/file-tree/file-explorer.tsx b/frontend/src/components/editor/file-tree/file-explorer.tsx index 9a91f514c01..9590b2b12da 100644 --- a/frontend/src/components/editor/file-tree/file-explorer.tsx +++ b/frontend/src/components/editor/file-tree/file-explorer.tsx @@ -30,6 +30,7 @@ import { Trash2Icon, UploadIcon, ViewIcon, + DownloadIcon, } from "lucide-react"; import type { FileInfo } from "@/core/network/types"; import { @@ -64,6 +65,8 @@ import type { RequestingTree } from "./requesting-tree"; import type { FilePath } from "@/utils/paths"; import useEvent from "react-use-event-hook"; import { copyToClipboard } from "@/utils/copy"; +import { sendFileDetails } from "@/core/network/requests"; +import { downloadBlob } from "@/utils/download"; const RequestingTreeContext = React.createContext(null); @@ -492,6 +495,21 @@ const Node = ({ node, style, dragHandle }: NodeRendererProps) => { )} + {!node.data.isDirectory && ( + <> + { + const details = await sendFileDetails({ path: node.data.path }); + const contents = details.contents || ""; + downloadBlob(new Blob([contents]), node.data.name); + }} + > + + Download + + + + )} Delete