import React, { useState, useEffect, useRef } from 'react'; import { Download, Wind, Sun, PenTool, Plus, Share2, Sparkles, Sprout, Image as ImageIcon } from 'lucide-react'; import { motion, AnimatePresence } from 'framer-motion'; // --- Constants & Data --- const FLOWERS = [ { id: 'sunflower', name: 'Sunflower', mood: 'Energetic', meaning: 'Adoration, Loyalty, and Longevity', quote: 'Keep your face to the sunshine and you cannot see the shadow.', color: '#FBBF24', bg: 'bg-yellow-50', icon: '🌻', illustration: 'https://images.unsplash.com/photo-1597848212624-a19eb35e2651?auto=format&fit=crop&q=80&w=400' }, { id: 'blue-salvia', name: 'Blue Salvia', mood: 'Peaceful', meaning: 'I am thinking of you; Wisdom and Purity', quote: 'Peace is the beauty of a soul at rest with itself.', color: '#6366F1', bg: 'bg-indigo-50', icon: '🪻', illustration: 'https://images.unsplash.com/photo-1508610048659-a06b669e3321?auto=format&fit=crop&q=80&w=400' }, { id: 'red-camellia', name: 'Red Camellia', mood: 'Resilient', meaning: 'Unpretentious Excellence; Deep Passion', quote: 'The flower that blooms in adversity is the most rare and beautiful of all.', color: '#EF4444', bg: 'bg-red-50', icon: '🌺', illustration: 'https://images.unsplash.com/photo-1518709268805-4e9042af9f23?auto=format&fit=crop&q=80&w=400' }, { id: 'white-lily', name: 'White Lily', mood: 'Reflective', meaning: 'Purity, Rebirth, and Virtue', quote: 'In the silence of the garden, the heart finds its own song.', color: '#94a3b8', bg: 'bg-slate-50', icon: '🪷', illustration: 'https://images.unsplash.com/photo-1508182314998-3bd49473002f?auto=format&fit=crop&q=80&w=400' }, { id: 'mimosa', name: 'Mimosa', mood: 'Playful', meaning: 'Sensitivity, Secret Love, and Joy', quote: 'Happiness is a butterfly which, when pursued, is always beyond our grasp.', color: '#fbbf24', bg: 'bg-orange-50', icon: '🌼', illustration: 'https://images.unsplash.com/photo-1554631221-f9603e6808be?auto=format&fit=crop&q=80&w=400' } ]; const SEEDS = [ "Find a patch of sunlight and stand in it for 60 seconds.", "Describe the texture of a nearby leaf in your mind.", "Take three deep breaths, smelling the imaginary scent of rain.", "Close your eyes and listen for the furthest sound you can hear.", "Stretch your arms up like branches reaching for the sky." ]; // --- Sub-Components --- const Petal = ({ color, rotation }) => ( ); const FlowerStalk = ({ log }) => { return (
{/* The Stem */}
{/* Leaves on stem */}
{/* The Flower Head */}
{/* Petals only appear if entry exists */} {[0, 60, 120, 180, 240, 300].map((deg) => ( ))} {/* Flower Center */}
{/* Hover Info Tag */}

{log.place}

{log.activity}

); }; const PaperTexture = () => (
); const App = () => { const [selectedMood, setSelectedMood] = useState(null); const [isFlipped, setIsFlipped] = useState(false); const [happinessLog, setHappinessLog] = useState([]); const [newJoy, setNewJoy] = useState({ place: '', activity: '' }); const [isExporting, setIsExporting] = useState(false); const cardRef = useRef(null); const herbariumRef = useRef(null); useEffect(() => { const script = document.createElement('script'); script.src = "https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"; script.async = true; document.body.appendChild(script); return () => { document.body.removeChild(script); }; }, []); const handleDownloadCard = async () => { if (cardRef.current && window.html2canvas) { setIsExporting(true); const canvas = await window.html2canvas(cardRef.current, { scale: 3, useCORS: true, backgroundColor: '#FDFBF7' }); const link = document.createElement('a'); link.href = canvas.toDataURL("image/jpeg", 0.9); link.download = `BloomCard-${selectedMood.name}.jpg`; link.click(); setIsExporting(false); } }; const handleDownloadHerbarium = async () => { if (herbariumRef.current && window.html2canvas) { const canvas = await window.html2canvas(herbariumRef.current, { scale: 2, backgroundColor: '#FDFBF7' }); const link = document.createElement('a'); link.href = canvas.toDataURL("image/jpeg", 0.9); link.download = `MyGardenOfJoy.jpg`; link.click(); } }; const addHappiness = (e) => { e.preventDefault(); if (!newJoy.place || !newJoy.activity) return; setHappinessLog([...happinessLog, { ...newJoy, id: Date.now(), color: FLOWERS[Math.floor(Math.random() * FLOWERS.length)].color, x: Math.random() * 85 + 5, // Random horizontal position y: Math.random() * 30, // Random vertical overlap height: 60 + Math.random() * 100 // Random stalk height }]); setNewJoy({ place: '', activity: '' }); }; return (

The Daily Bloom

Digital Botanical Scrapbook

{/* Mood Selection */}

What is blooming in your heart today?

{FLOWERS.map((flower) => ( { setSelectedMood(flower); setIsFlipped(false); }} className={`flex flex-col items-center p-5 rounded-3xl transition-all group ${selectedMood?.id === flower.id ? 'bg-white shadow-md' : 'bg-transparent'}`} > {flower.icon} {flower.mood} ))}
{/* Flashcard */} {selectedMood && (
setIsFlipped(!isFlipped)} className={`relative w-full max-w-sm aspect-[3/4.2] cursor-pointer transition-transform duration-1000 transform-style-3d ${isFlipped ? 'rotate-y-180' : ''}`} >

{selectedMood.name}

The Language of Flowers

{selectedMood.name}

"{selectedMood.meaning}"

{selectedMood.quote}

)}
{/* Herbarium / Happiness Garden */}

The Happiness Meadow

Every joy plants a new flower

setNewJoy({...newJoy, place: e.target.value})} />
setNewJoy({...newJoy, activity: e.target.value})} />
{/* Planted Garden Canvas */}
{/* Background Art */}
{happinessLog.length === 0 && (

Your meadow is ready for planting

)} {/* The Planted Flowers */}
{happinessLog.map((log) => ( ))}
{/* Ground/Dirt line */}
{/* Label */}
Meadow of Collected Joys
{/* Export Button */} {happinessLog.length > 0 && ( )}
{/* Seeds Section */}

Seeds of Action

Nurturing your daily growth

{SEEDS.slice(0, 3).map((seed, i) => (
"{seed}"
))}

Est. 2024 • The Daily Bloom