From b699b23082e91f6099c38fdea4f60985bbd168ff Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Mon, 29 Dec 2025 19:09:31 +0100 Subject: [PATCH] feat: save zine prompts to localStorage for draft recovery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Auto-save topic, style, and tone as user types - Show "Saved Draft Found" banner on page load with restore option - Clear draft automatically when zine creation completes - Allows users to resume if they back out of the creation process 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- app/zine/create/page.tsx | 14 ++++++ app/zine/page.tsx | 102 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 115 insertions(+), 1 deletion(-) diff --git a/app/zine/create/page.tsx b/app/zine/create/page.tsx index 116f0fe..4be5727 100644 --- a/app/zine/create/page.tsx +++ b/app/zine/create/page.tsx @@ -18,6 +18,8 @@ import { } from "lucide-react"; import TextSelectionCanvas from "@/components/zine/TextSelectionCanvas"; +const DRAFT_STORAGE_KEY = "zineDraft"; + // Helper to get correct path based on subdomain function useZinePath() { const [isSubdomain, setIsSubdomain] = useState(false); @@ -284,6 +286,13 @@ export default function CreatePage() { const data = await response.json(); + // Clear the draft since zine is now complete + try { + localStorage.removeItem(DRAFT_STORAGE_KEY); + } catch { + // Ignore localStorage errors + } + setState((s) => s ? { ...s, printLayoutUrl: data.printLayoutUrl, currentStep: "download" } : s ); @@ -858,6 +867,11 @@ export default function CreatePage() { + + + + + )} + {/* Main Form */}
{/* Topic Input */}