import React, { useState, createContext, useContext } from 'react'; import { View, Text, Pressable } from 'react-native'; import { ThemeProvider, useT, T, Screen, Scroll, Header, NavBar, Card, Group, Row, Button, Segmented, Chip, Pill, Checkbox, Stat, Ring, Bars, Spark, Progress, TabBar, Tabs, Stack, Icon, Spacer, SectionTitle, Gradient, alpha } from './ui/kit'; const ACCENT = '#14B8A6'; const THEME = { dark: { bg: '#060F0E', card: '#0F1C1A', card2: '#172A27', line: '#1A2E2B', text2: '#8FB0AB', text3: '#557270' }, light: { bg: '#EDF6F5', card: '#FFFFFF', card2: '#DAEBE8' } }; const GOALS_INIT = [ { id: 1, title: 'Run a half marathon', area: 'Health', icon: 'Footprints', c: '#14B8A6', due: 'Oct 2026', progress: 0.62, steps: [['Build to 15 km long run', true], ['Sign up for the Lisbon Half', true], ['Four runs a week for 8 weeks', false], ['Race day', false]], why: 'To prove the knee is back and to spend Sunday mornings outside.' }, { id: 2, title: 'Ship the side project', area: 'Work', icon: 'Rocket', c: '#6366F1', due: 'Jul 2026', progress: 0.4, steps: [['Landing page', true], ['Core feature', false], ['Ten beta users', false], ['Launch post', false]], why: 'A small thing of my own that people use.' }, { id: 3, title: 'Read 30 books', area: 'Mind', icon: 'BookOpen', c: '#E8B04B', due: 'Dec 2026', progress: 0.6, steps: [['10 books', true], ['20 books', false], ['30 books', false]], why: 'Fewer feeds, more pages.' }, { id: 4, title: 'Save $10k', area: 'Money', icon: 'PiggyBank', c: '#FF6B9D', due: 'Dec 2026', progress: 0.54, steps: [['Automate $300 a week', true], ['$5k', true], ['$10k', false]], why: 'Room to say no.' }, { id: 5, title: 'Learn to surf', area: 'Play', icon: 'Waves', c: '#38BDF8', due: 'Sep 2026', progress: 0.2, steps: [['Five lessons', true], ['Stand up on a green wave', false], ['Own board', false]], why: 'Because it looks like joy.' }, ]; const Store = createContext(null); function GoalsScreen({ nav }) { const t = useT(); const { goals } = useContext(Store); const avg = goals.reduce((a, g) => a + g.progress, 0) / goals.length; const [area, setArea] = useState('All'); const list = goals.filter((g) => area === 'All' || g.area === area); return (
{Math.round(avg * 100)}%} /> {['All', 'Health', 'Work', 'Mind', 'Money', 'Play'].map((a) => setArea(a)} />)} {list.map((g) => ( nav.push('goal', { id: g.id })}> {g.title} {g.area} · by {g.due} · {g.steps.filter((s) => s[1]).length}/{g.steps.length} milestones {Math.round(g.progress * 100)}% ))}