import React, { useState, createContext, useContext } from 'react'; import { View, Text } from 'react-native'; import { ThemeProvider, useT, T, Screen, Scroll, Header, NavBar, Card, Group, Row, Button, Chip, Pill, Checkbox, Toggle, Ring, Bars, Spark, Stat, Avatar, TabBar, Tabs, Stack, Icon, Spacer, SectionTitle } from './ui/kit'; const ACCENT = '#7C5CFF'; const THEME = { dark: { bg: '#0B0B10', card: '#15151C', card2: '#1F1F28', line: '#24242E' }, light: { bg: '#F4F3FA' } }; const HABITS = [ { id: 1, name: 'Morning stretch', icon: 'Sunrise', color: '#FF9F43', streak: 14, time: '7:00', days: [1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1] }, { id: 2, name: 'Read 20 pages', icon: 'BookOpen', color: '#4DA3FF', streak: 9, time: '21:30', days: [1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1] }, { id: 3, name: 'Deep work block', icon: 'Target', color: '#7C5CFF', streak: 21, time: '9:00', days: [1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] }, { id: 4, name: 'Walk outside', icon: 'Footprints', color: '#30D158', streak: 5, time: '12:30', days: [0,1,1,0,1,0,1,1,0,1,1,1,0,1,0,1,1,1,0,1,1,0,1,1,1,1,1,1] }, { id: 5, name: 'No screens after 10', icon: 'MoonStar', color: '#F2C94C', streak: 3, time: '22:00', days: [1,0,0,1,0,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1,0,1,1,1] }, ]; const WEEK = [3, 5, 4, 5, 2, 5, 3]; const DAYS = ['M', 'T', 'W', 'T', 'F', 'S', 'S']; const Done = createContext([{}, () => {}]); function TodayScreen({ nav }) { const t = useT(); const [done, setDone] = useContext(Done); const completed = HABITS.filter((h) => done[h.id]).length; const pct = completed / HABITS.length; return (
} /> nav.push('week')}> {Math.round(pct * 100)}% {completed} of {HABITS.length} {completed === HABITS.length ? 'All done. Rest well.' : (HABITS.length - completed) + ' to go'} You are on a 12 day streak. Finish today to keep it alive. {}} /> {HABITS.map((h) => ( nav.push('habit', { id: h.id })} right={ setDone((d) => Object.assign({}, d, { [h.id]: !d[h.id] }))} />} /> ))}