From eb6c0429301c063506076714b34d8dd80ce5ffeb Mon Sep 17 00:00:00 2001 From: Varun Date: Fri, 3 Apr 2026 20:59:07 +0530 Subject: [PATCH] docs: add import destination inline implementation plan --- ...26-04-03-import-destination-inline-plan.md | 252 ++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 docs/plans/2026-04-03-import-destination-inline-plan.md diff --git a/docs/plans/2026-04-03-import-destination-inline-plan.md b/docs/plans/2026-04-03-import-destination-inline-plan.md new file mode 100644 index 0000000..d342acb --- /dev/null +++ b/docs/plans/2026-04-03-import-destination-inline-plan.md @@ -0,0 +1,252 @@ +# Import Destination Inline Implementation Plan + +> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. + +**Goal:** Move album destination selection from a dialog into an inline card on the import-shared screen, between the album details card and the gallery card. + +**Architecture:** All changes are in a single file (`src/pages/assets/import-shared.tsx`). Remove `importAllDialogOpen` state and its Dialog component. Add a Destination card rendered inline when `sharedData && albumDetails`. The import button in the header calls `handleImportAll` directly. No backend changes needed. + +**Tech Stack:** React, Next.js, shadcn/ui (Card, Button, Input, Select, Label) + +--- + +### Task 1: Remove dialog state, update fetch trigger, wire import button directly + +**Files:** +- Modify: `src/pages/assets/import-shared.tsx` + +All changes are in one file. Read it fully before starting. + +**Step 1: Remove `importAllDialogOpen` state** + +Delete this line (~line 162): +```typescript +const [importAllDialogOpen, setImportAllDialogOpen] = useState(false); +``` + +**Step 2: Update the albums fetch effect** + +The current effect fetches albums when the dialog opens. Change it to fetch when `sharedData` loads instead: + +```typescript +// BEFORE +useEffect(() => { + if (importAllDialogOpen) { + listAlbums().then(setExistingAlbums).catch(console.error); + } +}, [importAllDialogOpen]); + +// AFTER +useEffect(() => { + if (sharedData) { + listAlbums().then(setExistingAlbums).catch(console.error); + } +}, [sharedData]); +``` + +**Step 3: Update the Back button handler** + +Remove `setImportAllDialogOpen(false)` from the Back button's onClick (it's one of the reset lines in the Header `leftComponent`). + +**Step 4: Update the import button in the Header rightComponent** + +Replace the current onClick (which opens the dialog) with a direct `handleImportAll` call: + +```tsx + +``` + +Also remove the `setAlbumImportMode("album")` reset that was in the old onClick — the inline card owns the mode state now. + +**Step 5: Commit** + +```bash +git add src/pages/assets/import-shared.tsx +git commit -m "refactor: wire import button directly to handleImportAll, fetch albums on sharedData load" +``` + +--- + +### Task 2: Add inline Destination card + +**Files:** +- Modify: `src/pages/assets/import-shared.tsx` + +**Step 1: Find the insertion point** + +In the JSX return, inside the `
` element, there is: +- An album details `` rendered when `sharedData` is set +- A gallery `` rendered when `sharedData && albumDetails` + +Insert the Destination card between them — after the album details card, before the gallery card. It should only render when `sharedData && albumDetails` (same condition as the gallery). + +**Step 2: Add the Destination card** + +```tsx +{sharedData && albumDetails && ( + + + Destination + + Choose where to save the imported assets in your Immich library. + + + +
+ + + +
+ + {albumImportMode === "album" && ( +
+ + setAlbumNameInput(e.target.value)} + placeholder="Imported shared album" + disabled={importAllLoading} + /> +
+ )} + + {albumImportMode === "existing-album" && ( +
+ + +
+ )} + + {importAllLoading && jobProgress && ( +

+ {jobProgress.uploaded + jobProgress.skipped} / {jobProgress.total} processed + {jobProgress.failed > 0 && ` · ${jobProgress.failed} failed`} +

+ )} +
+
+)} +``` + +**Step 3: Commit** + +```bash +git add src/pages/assets/import-shared.tsx +git commit -m "feat: add inline destination card for album selection on import-shared screen" +``` + +--- + +### Task 3: Remove the import Dialog + +**Files:** +- Modify: `src/pages/assets/import-shared.tsx` + +The import Dialog (open/close controlled by `importAllDialogOpen`) now needs to be removed. The video and image preview Dialogs must be kept — do not touch those. + +**Step 1: Remove the import Dialog JSX** + +Delete the entire Dialog block that starts with: +```tsx + + + ... + + +``` + +It ends just before the video preview Dialog (``). + +**Step 2: Remove unused Dialog imports if any** + +Check the import statement at the top. The `Dialog`, `DialogContent`, `DialogHeader`, `DialogTitle`, `DialogDescription` components are still used by the video and image preview dialogs — keep them. No imports need removing. + +**Step 3: Verify the progress counter is gone from the dialog (it was moved to the Destination card in Task 2)** + +Confirm no duplicate progress `

` exists. + +**Step 4: Commit** + +```bash +git add src/pages/assets/import-shared.tsx +git commit -m "refactor: remove import dialog, destination selection is now inline" +``` + +--- + +## Done + +After Task 3: +- Album destination (create / existing / none) is visible on the screen without clicking anything +- The import button calls `handleImportAll` directly +- Progress shows inline in the Destination card while importing +- The import Dialog is gone +- No backend changes