From 6f8d894f69fac8a89a41140c9d06c97308ce6f71 Mon Sep 17 00:00:00 2001 From: nuno <59452877+komen205@users.noreply.github.com> Date: Fri, 13 Mar 2026 06:31:21 +0000 Subject: [PATCH] feat: support importing multiple files at once Allow selecting multiple files in the import dialog instead of one at a time. The file picker now uses `multiple: true`, files are imported sequentially, and results are aggregated into a single combined summary. Co-Authored-By: Claude Sonnet 4.6 --- src-web/components/ImportDataDialog.tsx | 30 ++++++++----- src-web/lib/importData.tsx | 60 ++++++++++++++++--------- 2 files changed, 58 insertions(+), 32 deletions(-) diff --git a/src-web/components/ImportDataDialog.tsx b/src-web/components/ImportDataDialog.tsx index 359318436..e0b6adc59 100644 --- a/src-web/components/ImportDataDialog.tsx +++ b/src-web/components/ImportDataDialog.tsx @@ -1,16 +1,23 @@ +import { open } from '@tauri-apps/plugin-dialog'; import { useState } from 'react'; -import { useLocalStorage } from 'react-use'; import { Button } from './core/Button'; import { VStack } from './core/Stacks'; -import { SelectFile } from './SelectFile'; interface Props { - importData: (filePath: string) => Promise; + importData: (filePaths: string[]) => Promise; } export function ImportDataDialog({ importData }: Props) { const [isLoading, setIsLoading] = useState(false); - const [filePath, setFilePath] = useLocalStorage('importFilePath', null); + const [filePaths, setFilePaths] = useState([]); + + const handleSelectFiles = async () => { + const result = await open({ title: 'Select File(s)', multiple: true }); + if (result == null) return; + setFilePaths(Array.isArray(result) ? result : [result]); + }; + + const fileCount = filePaths.length; return ( @@ -26,20 +33,21 @@ export function ImportDataDialog({ importData }: Props) { - setFilePath(filePath)} - /> - {filePath && ( + + {fileCount > 0 && (