From b8a6b2018ed1736ab4f9f234b435bce666c10d90 Mon Sep 17 00:00:00 2001 From: SnapOtter Date: Sun, 14 Jun 2026 21:43:58 +0800 Subject: [PATCH] feat: Import from Files works, remove pipeline button from files page - Import from Files now navigates back to the tool page with the selected file loaded (uses selectForTool router state) - Tool page skips file store reset when arriving from the library - Removed "Open in Pipeline" button from file details and file list - Button text changes to "Select File" when in file-selection mode --- .../web/src/components/files/file-details.tsx | 28 ++++++++----------- apps/web/src/components/files/file-list.tsx | 14 +--------- apps/web/src/pages/tool-page.tsx | 8 ++++-- packages/shared/src/i18n/ar.ts | 1 + packages/shared/src/i18n/de.ts | 1 + packages/shared/src/i18n/en.ts | 1 + packages/shared/src/i18n/es.ts | 1 + packages/shared/src/i18n/fr.ts | 1 + packages/shared/src/i18n/hi.ts | 1 + packages/shared/src/i18n/id.ts | 1 + packages/shared/src/i18n/it.ts | 1 + packages/shared/src/i18n/ja.ts | 1 + packages/shared/src/i18n/ko.ts | 1 + packages/shared/src/i18n/nl.ts | 1 + packages/shared/src/i18n/pl.ts | 1 + packages/shared/src/i18n/pt-BR.ts | 1 + packages/shared/src/i18n/ru.ts | 1 + packages/shared/src/i18n/sv.ts | 1 + packages/shared/src/i18n/th.ts | 1 + packages/shared/src/i18n/tr.ts | 1 + packages/shared/src/i18n/uk.ts | 1 + packages/shared/src/i18n/vi.ts | 1 + packages/shared/src/i18n/zh-CN.ts | 1 + packages/shared/src/i18n/zh-TW.ts | 1 + 24 files changed, 40 insertions(+), 31 deletions(-) diff --git a/apps/web/src/components/files/file-details.tsx b/apps/web/src/components/files/file-details.tsx index 2e0a992c..d76f3c41 100644 --- a/apps/web/src/components/files/file-details.tsx +++ b/apps/web/src/components/files/file-details.tsx @@ -1,7 +1,7 @@ import { TOOLS } from "@snapotter/shared"; -import { FileImage, ImageIcon, Workflow } from "lucide-react"; +import { FileImage, ImageIcon } from "lucide-react"; import { useEffect, useState } from "react"; -import { useNavigate } from "react-router-dom"; +import { useLocation, useNavigate } from "react-router-dom"; import { useTranslation } from "@/contexts/i18n-context"; import { apiGetFileDetails, @@ -79,6 +79,8 @@ export function FileDetails({ mobile = false }: FileDetailsProps) { const { selectedFileId } = useFilesPageStore(); const setFiles = useFileStore((s) => s.setFiles); const navigate = useNavigate(); + const location = useLocation(); + const selectForTool = (location.state as { selectForTool?: string } | null)?.selectForTool; const [details, setDetails] = useState(null); const [loadingDetails, setLoadingDetails] = useState(false); @@ -121,7 +123,13 @@ export function FileDetails({ mobile = false }: FileDetailsProps) { if (valid.length === 0) return; setFiles(valid.map((d) => d.file)); - navigate("/", { state: { fromLibrary: true } }); + + if (selectForTool) { + const tool = TOOLS.find((t) => t.id === selectForTool); + navigate(tool?.route ?? "/", { state: { fromLibrary: true } }); + } else { + navigate("/", { state: { fromLibrary: true } }); + } // Set serverFileId on each entry so tool processing creates new versions setTimeout(() => { @@ -224,19 +232,7 @@ export function FileDetails({ mobile = false }: FileDetailsProps) { onClick={handleOpenFile} className="w-full px-4 py-2 bg-primary text-primary-foreground text-sm font-medium rounded-lg hover:bg-primary/90 transition-colors" > - Open File - - diff --git a/apps/web/src/components/files/file-list.tsx b/apps/web/src/components/files/file-list.tsx index a9e2c6a4..9343bb29 100644 --- a/apps/web/src/components/files/file-list.tsx +++ b/apps/web/src/components/files/file-list.tsx @@ -1,4 +1,4 @@ -import { Download, Search, Trash2, Workflow } from "lucide-react"; +import { Download, Search, Trash2 } from "lucide-react"; import { useEffect, useRef, useState } from "react"; import { useNavigate } from "react-router-dom"; import { useTranslation } from "@/contexts/i18n-context"; @@ -49,10 +49,6 @@ export function FileList() { } } - function handleSendToPipeline() { - navigate("/automate", { state: { libraryFileIds: Array.from(checkedIds) } }); - } - const allChecked = files.length > 0 && checkedIds.size === files.length; const someChecked = checkedIds.size > 0; @@ -95,14 +91,6 @@ export function FileList() { {t.files.delete} -