// ------------------------------------------------------------------------ // components/WelcomeModal.js - First-visit onboarding popup. // // A friendly, dead-simple overlay that walks a new user through the three // key moves in plain language. Auto-shows once on first visit (gated by the // sunscope_welcome_seen flag in useAppState) and is reopenable from the // footer "How it works" link. // // Purely presentational - all open/close state lives in useAppState. // // Props: // onClose - called when the user dismisses (Got it, ×, backdrop, or Esc) // ------------------------------------------------------------------------ import { h } from '../../vendor/preact.js'; import { useEffect } from '../../vendor/preact-hooks.js'; import htm from '../../vendor/htm.js'; const html = htm.bind(h); const STEPS = [ { icon: '☀️', title: 'SunSoak is the number to watch', body: html`Pick a Solar model (open, urban, beach…) in the SunSoak dropdown to match where you are. It shows what your body actually feels in the sun — not just the air temperature.`, }, { icon: '🎯', title: 'Choose a profile', body: html`Tap Places, Activities or Work to instantly load the columns that matter for your situation — like Beach, Cycling or Farming.`, }, { icon: '⚙️', title: 'Make it yours', body: html`Hit Edit columns to add or remove any data you like — UV and sunburn time, vehicle interior, soil, air quality and more.`, }, ]; export function WelcomeModal({ onClose }) { // Dismiss on Esc. useEffect(() => { const onKey = (e) => { if (e.key === 'Escape') onClose(); }; document.addEventListener('keydown', onKey); return () => document.removeEventListener('keydown', onKey); }, [onClose]); return html`
`; }