import React, { useState, createContext, useContext } from 'react'; import { View, Text, Pressable, TextInput } from 'react-native'; import { ThemeProvider, useT, T, Screen, Scroll, Header, NavBar, Card, Group, Row, Button, Segmented, Chip, Pill, Checkbox, Stat, Ring, Bars, Progress, TabBar, Tabs, Stack, Sheet, Icon, Spacer, SectionTitle, alpha } from './ui/kit'; const ACCENT = '#6366F1'; const THEME = { dark: { bg: '#09090F', card: '#13131C', card2: '#1C1C28', line: '#21212E', text2: '#9A9AB3', text3: '#5E5E78' }, light: { bg: '#F2F2F9', card: '#FFFFFF', card2: '#E4E4F1' } }; const PRI = { high: '#FF5C5C', med: '#FFB020', low: '#5CCB6A' }; const LISTS = [{ id: 'work', name: 'Work', icon: 'Briefcase', c: '#6366F1' }, { id: 'home', name: 'Home', icon: 'House', c: '#F59E42' }, { id: 'health', name: 'Health', icon: 'HeartPulse', c: '#22C55E' }, { id: 'ideas', name: 'Ideas', icon: 'Lightbulb', c: '#FBBF24' }]; const INIT = [ { id: 1, title: 'Ship the landing page', list: 'work', pri: 'high', due: 'Today', done: false, sub: 3, subDone: 2, notes: 'Final copy from Lena, then deploy to staging and run the Lighthouse check.' }, { id: 2, title: 'Review pull requests', list: 'work', pri: 'med', due: 'Today', done: false, sub: 4, subDone: 1, notes: 'Four open: auth refactor, i18n, the sidebar fix, the flaky test.' }, { id: 3, title: 'Reply to Dana', list: 'work', pri: 'low', due: 'Today', done: true, sub: 0, subDone: 0, notes: '' }, { id: 4, title: 'Book dentist', list: 'health', pri: 'med', due: 'Tomorrow', done: false, sub: 0, subDone: 0, notes: 'Dr Alves, ask for a morning slot.' }, { id: 5, title: 'Plan Q3 roadmap', list: 'work', pri: 'high', due: 'Thu', due2: 1, done: false, sub: 5, subDone: 0, notes: 'Themes first, then the three bets, then what we stop doing.' }, { id: 6, title: 'Fix the kitchen tap', list: 'home', pri: 'low', due: 'Weekend', done: false, sub: 0, subDone: 0, notes: '' }, { id: 7, title: 'Run 10k', list: 'health', pri: 'med', due: 'Sun', done: false, sub: 0, subDone: 0, notes: '' }, ]; const Store = createContext(null); function TaskRow({ x, onToggle, onOpen }) { const t = useT(); const l = LISTS.find((z) => z.id === x.list); return ( } title={x.title} titleStyle={x.done ? { color: t.text3, textDecorationLine: 'line-through' } : null} subtitle={l.name + (x.sub ? ' · ' + x.subDone + '/' + x.sub + ' subtasks' : '') + ' · ' + x.due} right={} onPress={onOpen} /> ); } function TodayScreen({ nav }) { const t = useT(); const { tasks, toggle, setAdd } = useContext(Store); const today = tasks.filter((x) => x.due === 'Today'); const later = tasks.filter((x) => x.due !== 'Today'); const n = today.filter((x) => x.done).length; return (
{n}/{today.length}} /> {today.map((x) => toggle(x.id)} onOpen={() => nav.push('task', { id: x.id })} />)} {later.map((x) => toggle(x.id)} onOpen={() => nav.push('task', { id: x.id })} />)}