diff --git a/src/App.jsx b/src/App.jsx index 446db797..3e114cd4 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -30,14 +30,11 @@ function App() { // Add to history const newHistoryItem = { + ...result, // Store full result (sections, etc) id: Date.now(), - title: result.title, - subtitle: result.subtitle, age: data.age, downloads: 0, - bgColor: 'bg-primary-50', // Default color - // We'll need to figure out how to preview it in the gallery. - // For now, Gallery expects 'bgColor'. + bgColor: 'bg-primary-50', }; setHistory(prev => [newHistoryItem, ...prev]); @@ -49,6 +46,11 @@ function App() { } }; + const handleRestore = (item) => { + setGeneratedSheet(item); + window.scrollTo({ top: 0, behavior: 'smooth' }); + }; + const galleryItems = history.length > 0 ? history.slice(0, 3) : popularSheets.slice(0, 3); const galleryTitle = history.length > 0 ? "Your Recent Creations" : "Most Popular Printables"; @@ -74,7 +76,7 @@ function App() { {/* Main Content */}
- +
diff --git a/src/components/Gallery.jsx b/src/components/Gallery.jsx index 560a7fa9..4f89fcef 100644 --- a/src/components/Gallery.jsx +++ b/src/components/Gallery.jsx @@ -3,7 +3,7 @@ import { motion } from 'framer-motion'; import { Wand2, Download, Star } from 'lucide-react'; import { Button } from './ui/Button'; -export const Gallery = ({ items, title = "Most Popular Printables" }) => { +export const Gallery = ({ items, title = "Most Popular Printables", onRestore }) => { return (
@@ -21,17 +21,36 @@ export const Gallery = ({ items, title = "Most Popular Printables" }) => { className="group bg-white rounded-3xl border-2 border-slate-100 overflow-hidden hover:border-primary-200 hover:shadow-xl hover:shadow-primary-100/50 transition-all duration-300" >
- {/* This would ideally be the actual sheet preview */} -
-

{item.title}

-

{item.subtitle}

-
123
-
+ {item.sections && item.sections.length > 0 && item.sections[0].content_svg ? ( +
+
+ {/* Overlay to prevent interaction with SVG parts */} +
+
+ ) : ( +
+ {item.image ? ( + {item.title} + ) : ( + <> +

{item.title}

+

{item.subtitle}

+
123
+ + )} +
+ )} -
-