import React, { useEffect, useRef, useState } from 'react'; import { View, Text, Pressable, StyleSheet, SafeAreaView } from 'react-native'; export default function App() { const [secs, setSecs] = useState(25 * 60); const [running, setRunning] = useState(false); const [done, setDone] = useState(2); const timer = useRef(null); useEffect(() => { if (running) { timer.current = setInterval(() => setSecs((x) => (x > 0 ? x - 1 : 0)), 1000); } return () => clearInterval(timer.current); }, [running]); const mm = String(Math.floor(secs / 60)).padStart(2, '0'); const ss = String(secs % 60).padStart(2, '0'); return ( FOCUS SESSION Design review {mm}:{ss} {running ? 'in progress' : 'paused'} {[0, 1, 2, 3].map((i) => ( ))} {done} of 4 sessions today setRunning((r) => !r)} style={({ pressed }) => [s.btn, pressed && { opacity: 0.85 }]}> {running ? 'Pause focus' : 'Start focus'} { setSecs(25 * 60); setRunning(false); }} style={s.reset}> Reset ); } const s = StyleSheet.create({ safe: { flex: 1, backgroundColor: '#0C0A0A' }, top: { paddingTop: 64, alignItems: 'center' }, kicker: { color: '#FF6B5C', fontSize: 12, fontWeight: '700', letterSpacing: 2 }, task: { color: '#fff', fontSize: 24, fontWeight: '800', marginTop: 6 }, center: { flex: 1, alignItems: 'center', justifyContent: 'center' }, dial: { width: 250, height: 250, borderRadius: 125, borderWidth: 3, borderColor: '#2A1C1A', backgroundColor: '#161010', alignItems: 'center', justifyContent: 'center' }, time: { color: '#fff', fontSize: 60, fontWeight: '200', letterSpacing: 1, fontVariant: ['tabular-nums'] }, timeSub: { color: '#8A6A66', fontSize: 14, marginTop: 6 }, dots: { flexDirection: 'row', gap: 12, marginTop: 40 }, dot: { width: 12, height: 12, borderRadius: 6, backgroundColor: '#2A1C1A' }, dotOn: { backgroundColor: '#FF6B5C' }, dotsLabel: { color: '#8A6A66', fontSize: 13, marginTop: 14 }, footer: { paddingHorizontal: 26, paddingBottom: 40 }, btn: { backgroundColor: '#FF6B5C', borderRadius: 30, paddingVertical: 18, alignItems: 'center' }, btnText: { color: '#2A0E0A', fontSize: 17, fontWeight: '800' }, reset: { paddingVertical: 16, alignItems: 'center' }, resetText: { color: '#8A6A66', fontSize: 15, fontWeight: '600' }, });