Skip to content

Add /display Finish footer with co-equal Save Deck/Print + save-before-PDF draft backup (#275) - #306

Merged
WilfordGrimley merged 1 commit into
masterfrom
display-finish-footer-draft-backup-275
Jul 22, 2026
Merged

Add /display Finish footer with co-equal Save Deck/Print + save-before-PDF draft backup (#275)#306
WilfordGrimley merged 1 commit into
masterfrom
display-finish-footer-draft-backup-275

Conversation

@WilfordGrimley

Copy link
Copy Markdown

Summary

Implements issue #275 (proposal-h-display-layout-spec.md ADDENDUM D9/D10): the /display right-rail Finish footer and the save-before-PDF hard constraint ("save deck should come before PDF completes because we have to rely on clients available mem for the PDF").

  • FinishFooter.tsx — replaces the old three-button "Prepare Print" stack (Export ▾ / Save PDF to Google Drive / Generate PDF) with two co-equal btn-primary buttons (Save Deck, Print / Export →) plus the unchanged Export ▾, and a compact "✓ Draft backed up locally" note. Anonymous sessions get a "Sign in to Save" link in place of Save Deck (server save is authenticated-only by construction).
  • useProjectDraftBackup.ts (F1) — silent, debounced localStorage mirror of the working project (indexes/settings only, never image pixels — the governing "we index, we do not store images" premise applied to this browser's own disk). Offers a restore nudge on the empty-project landing when a prior session's draft outlives an emptied project, and fires the D9(2) promotion nudge post-import (reusing the existing Toasts system, no new UI surface).
  • PrePrintSaveGate.tsx (F3) — runs the D9(3) sequence when "Print / Export →" is pressed: flush the draft synchronously → if authenticated AND dirty, show a lightweight "Save before printing?" prompt (Save/Skip) → only then client-side-navigate to the new Print page. Saving gates PDF; PDF never gates saving.
  • useSaveDeckFlow.tsx — extracted from SavedDeckPanel.tsx's own passphrase-setup/unlock/save modal chain so the footer's Save Deck button and the pre-print gate's Save choice reuse it without forking; SavedDeckPanel.tsx itself now rides the same hook, unchanged behavior.
  • pages/print.tsx (D10/F5) — new thin route wrapper mounting the unchanged FinishedMyProject, mirroring pages/myDecks.tsx. /display's own inline PDF export pipeline (Item 2's useDownloadPDF/useSaveToDrivePDF/ImageFailureConfirmModal/fetch-progress bar) is removed outright — PDF generation now lives solely on this Print page.

Deviations from spec (documented, not silently accepted)

  1. D10's tab reorder + PDF-tab preview removal deferred. The owner addendum on D10 (reorder to PDF · MakePlayingCards · NotMPC · PringlePrints with PDF default, and dropping the PDF tab's own preview) is explicitly out of this issue's scope per the task — pages/print.tsx mounts FinishedMyProject unchanged. Tracked as its own follow-up in the spec doc.
  2. Settings-parity gap, left open. /display's own Page Setup controls (paper size/bleed edge/guides — plain component state) don't carry over to the Print page's classic PDFGenerator, which has always had separate settings and doesn't read this page's margin-profile/card-spacing redux slices either. Out of scope for D9/D10 (save-vs-print ordering + route linkage, not settings portability) — documented in the spec doc and in DisplayPage.tsx's own module comment.
  3. DisplayPageExport.spec.ts deleted (not selector-updated) since its subject — the page's own inline PDF pipeline — no longer exists; PDFGenerator.spec.ts already covers the underlying pipeline mechanics unchanged. PostExportContributionPrompt.spec.ts's "- /display" describe block removed for the same reason; its "classic Print! tab" block is untouched.
  4. docs_lint allowlist entries removed for useProjectDraftBackup.ts/pages/print.tsx now that both files exist — lint passes naturally.

Test plan

  • tsc --noEmit clean
  • npx eslint clean on all touched files
  • npx prettier@2.7.1 --check clean on all touched files
  • Jest: new useProjectDraftBackup.test.tsx (8 tests: empty-project no-op, flush writes indexes/settings only, debounced auto-write, restore-nudge surfacing, restore rehydration, dismiss-without-delete, post-import + pre-print promotion nudges) + full existing suite (59 suites / 504 tests, all green, including SavedDeckPanel.test.tsx unchanged after the useSaveDeckFlow extraction)
  • Playwright: new DisplayFinishFooter.spec.ts (5 tests covering the full journey — anonymous sign-in-link + direct navigation, authenticated Save Deck button + draft-backed-up note, the full save-gate→unlock→SaveDeckModal→Print-page journey, Skip→Print-page, and the restore-nudge round trip) + PostExportContributionPrompt.spec.ts + DisplayPage.spec.ts + SavedDecks.spec.ts all green (four intermittent failures seen once under 4-worker parallel load — DisplayPage.spec.ts's own pre-existing phone-viewport scroll test plus three others — all confirmed to pass in isolation/on rerun; unrelated to this change, not touched by this PR)
  • Manual UI walkthrough in a running dev server (deferred — this was verified via the Playwright journey above, which drives a real browser against the real components; no separate manual pass performed)

Open items

  1. Wiki: /display usage documentation (if any exists) needs a note that the finish footer changed — flagging for the merge-time checklist since this is user-visible.
  2. The settings-parity gap (deviation Promote PringlePrints to a full ordering tab #2 above) is a good candidate for a follow-up issue once D10's own tab-reorder work lands.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant