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, Stat, Bars, Spark, Progress, TabBar, Tabs, Stack, Icon, Spacer, SectionTitle, Gradient, alpha } from './ui/kit'; const ACCENT = '#86B6F6'; const THEME = { dark: { bg: '#090C12', card: '#12171F', card2: '#1B222D', line: '#1F2733', text2: '#9DAABB', text3: '#5E6A7A' }, light: { bg: '#EFF4FB', card: '#FFFFFF', card2: '#DEE7F3' } }; const KINDS = [ { k: 'feed', label: 'Feed', icon: 'Milk', c: '#86B6F6' }, { k: 'sleep', label: 'Sleep', icon: 'Moon', c: '#A78BFA' }, { k: 'nappy', label: 'Nappy', icon: 'Baby', c: '#F59E42' }, { k: 'play', label: 'Tummy time', icon: 'Smile', c: '#5EC9A8' }, ]; const LOG_INIT = [ { id: 1, k: 'feed', time: '06:10', note: 'Left, 14 min' }, { id: 2, k: 'nappy', time: '06:40', note: 'Wet' }, { id: 3, k: 'sleep', time: '07:05', note: '1h 25m' }, { id: 4, k: 'feed', time: '08:45', note: 'Right, 12 min' }, { id: 5, k: 'play', time: '09:30', note: '6 min' }, { id: 6, k: 'nappy', time: '10:10', note: 'Dirty' }, { id: 7, k: 'sleep', time: '10:30', note: '45 min' }, { id: 8, k: 'feed', time: '11:50', note: 'Bottle, 120 ml' }, ]; const Store = createContext(null); const kindOf = (k) => KINDS.find((x) => x.k === k); function TodayScreen({ nav }) { const t = useT(); const { log, add } = useContext(Store); const count = (k) => log.filter((x) => x.k === k).length; const last = (k) => { const l = log.filter((x) => x.k === k); return l.length ? l[l.length - 1].time : '—'; }; return (
} /> nav.push('growth')}> 👶 A good rhythm today Last feed at {last('feed')}, next around 14:30. Two naps so far, 2h 10m total. {KINDS.map((k) => ( add(k.k)} style={({ pressed }) => [{ flex: 1, backgroundColor: t.card, borderRadius: 18, paddingVertical: 14, alignItems: 'center', gap: 6 }, pressed && { transform: [{ scale: 0.95 }], backgroundColor: alpha(k.c, 0.25) }]}> {k.label} {count(k.k)} · {last(k.k)} ))} {log.slice().reverse().map((x) => { const k = kindOf(x.k); return ; })} ); } function PatternsScreen() { const t = useT(); const [range, setRange] = useState('week'); return (
Longest night stretch, 14 days 5h 10m trending up ); } function MilestonesScreen() { const t = useT(); const ms = [['Social smile', '6 weeks', true], ['Holds head up', '9 weeks', true], ['Laughs', '12 weeks', true], ['Rolls over', '14 to 18 weeks', false], ['Grabs toys', '16 weeks', false], ['Sits with support', '20 weeks', false]]; return (
First year3 of 12 {ms.map((m) => {m[2] ? : }} title={m[0]} subtitle={m[2] ? 'Reached · ' + m[1] : 'Usually ' + m[1]} right={m[2] ? : null} chevron={!m[2]} onPress={() => {}} />)} ); } function Growth({ nav }) { const t = useT(); return ( } /> Birth14 weeks ); } function Root({ nav }) { const [tab, setTab] = useState('today'); return ( , patterns: , milestones: }} /> ); } const SCREENS = { root: Root, growth: Growth }; export default function App() { const [log, setLog] = useState(LOG_INIT); const add = (k) => setLog((l) => [...l, { id: Date.now(), k, time: 'now', note: k === 'feed' ? 'Bottle, 120 ml' : k === 'sleep' ? 'Started' : k === 'nappy' ? 'Wet' : '5 min' }]); return ( ); }