From 77139c57bdfef9919fa32df6e328369e2d33f909 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Mon, 13 Jul 2026 22:02:57 +0200 Subject: [PATCH] Improve project downloading functionality and integrate download button into ProjectManager --- src/hooks/useProject.ts | 11 ----------- src/routes/home/ProjectManager.tsx | 26 +++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/hooks/useProject.ts b/src/hooks/useProject.ts index d999f7b..f02a217 100644 --- a/src/hooks/useProject.ts +++ b/src/hooks/useProject.ts @@ -86,17 +86,6 @@ function useProject(id?: number | string) { }, ); - if (String(id) === '5') { - const url = URL.createObjectURL(projectFile); - const link = document.createElement('a'); - link.href = url; - link.download = projectFile.name; - document.body.appendChild(link); - link.click(); - link.remove(); - URL.revokeObjectURL(url); - } - return { pads, scenes, diff --git a/src/routes/home/ProjectManager.tsx b/src/routes/home/ProjectManager.tsx index 08b823d..60ef140 100644 --- a/src/routes/home/ProjectManager.tsx +++ b/src/routes/home/ProjectManager.tsx @@ -14,12 +14,27 @@ import ExportProject from './Export/ExportProject'; function ProjectManager() { const [projectId, setProjectId] = useAtom(projectIdAtom); - const { refetch } = useProject(projectId); + const { data, refetch } = useProject(projectId); const { resetSceneNames } = useSceneName(projectId); const { hasCustomNames } = useCustomSceneNames(projectId); const appState = useAppState(); const projects = useProjectsList(); + const downloadProjectFile = () => { + if (!data?.projectFile) { + return; + } + + const url = URL.createObjectURL(data.projectFile); + const link = document.createElement('a'); + link.href = url; + link.download = data.projectFile.name; + document.body.appendChild(link); + link.click(); + link.remove(); + URL.revokeObjectURL(url); + }; + return (