// ------------------------------------------------------------------------ // 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: 'Watch SunSoak', body: html`It's how the sun actually feels, not just air temperature. Pick the Solar model that matches where you are.`, }, { icon: '🎯', title: 'Pick a profile', body: html`Places, Activities or Work — Beach, Cycling, Farming and more — loads the right columns instantly.`, }, { icon: '⚙️', title: 'Make it yours', body: html`Every profile brings its own columns — UV, sunburn time, vehicle interior, soil, air quality. Edit columns (Extra) lets you pick your own.`, }, ]; 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`
`; }