import React, { useState, useEffect, createContext, useContext } from 'react'; import { View, Text } from 'react-native'; import { ThemeProvider, useT, T, Screen, Scroll, Header, Card, Group, Row, Button, IconButton, Segmented, Checkbox, Pill, Stat, Ring, Bars, Spark, TabBar, Tabs, Icon, Spacer, SectionTitle, alpha } from './ui/kit'; const ACCENT = '#FF6B5C'; const THEME = { dark: { bg: '#100C0C', card: '#1B1515', card2: '#271E1E', line: '#2C2222' }, light: { bg: '#FBF3F1', card: '#FFFFFF', card2: '#F3E4E1' } }; const MODES = [{ label: 'Focus', value: 25 }, { label: 'Short', value: 5 }, { label: 'Long', value: 15 }]; const TASKS_INIT = [ { id: 1, title: 'Write the launch post', est: 3, done: 1, tag: 'Writing' }, { id: 2, title: 'Review pull requests', est: 2, done: 2, tag: 'Code' }, { id: 3, title: 'Plan Q3 roadmap', est: 4, done: 0, tag: 'Strategy' }, { id: 4, title: 'Inbox to zero', est: 1, done: 0, tag: 'Admin' }, ]; const WEEK = [95, 140, 60, 180, 125, 40, 0]; const DAYS = ['M', 'T', 'W', 'T', 'F', 'S', 'S']; const Store = createContext(null); function TimerScreen() { const t = useT(); const { tasks, toggle } = useContext(Store); const [mode, setMode] = useState(25); const [left, setLeft] = useState(25 * 60); const [running, setRunning] = useState(false); useEffect(() => { setLeft(mode * 60); setRunning(false); }, [mode]); useEffect(() => { if (!running) return; const id = setInterval(() => setLeft((s) => (s > 0 ? s - 1 : 0)), 1000); return () => clearInterval(id); }, [running]); const total = mode * 60; const mm = Math.floor(left / 60), ss = left % 60; const current = tasks.find((x) => !x.checked) || tasks[0]; return (
} /> {mm}:{ss < 10 ? '0' + ss : ss} {running ? 'stay with it' : mode === 25 ? 'ready to focus' : 'take a break'} {[0, 1, 2, 3].map((i) => )} { setLeft(total); setRunning(false); }} size={54} />