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, Checkbox, Stat, Ring, Bars, Progress, TabBar, Tabs, Stack, Icon, Spacer, SectionTitle, Gradient, alpha } from './ui/kit';
const ACCENT = '#F59E42';
const THEME = { dark: { bg: '#110C07', card: '#1C1510', card2: '#2A2017', line: '#2F241B', text2: '#B5A08C', text3: '#766457' }, light: { bg: '#FBF4EC', card: '#FFFFFF', card2: '#F3E4D4' } };
const PETS = [
{ id: 1, name: 'Biscuit', kind: 'Golden retriever', age: '3 yrs', emoji: '🐕', c: '#F59E42', weight: 29.4, next: 'Vaccination · 2 Jun' },
{ id: 2, name: 'Miso', kind: 'British shorthair', age: '5 yrs', emoji: '🐈', c: '#8E8E93', weight: 4.8, next: 'Dental check · 14 Jun' },
];
const TASKS_INIT = [
{ id: 1, pet: 1, title: 'Morning walk', time: '07:30', icon: 'Footprints', done: true },
{ id: 2, pet: 1, title: 'Breakfast · 180 g', time: '08:00', icon: 'Bone', done: true },
{ id: 3, pet: 2, title: 'Breakfast · 55 g', time: '08:00', icon: 'Fish', done: true },
{ id: 4, pet: 1, title: 'Flea treatment', time: '12:00', icon: 'Pill', done: false },
{ id: 5, pet: 1, title: 'Evening walk', time: '18:30', icon: 'Footprints', done: false },
{ id: 6, pet: 2, title: 'Playtime · 15 min', time: '19:00', icon: 'Puzzle', done: false },
{ id: 7, pet: 2, title: 'Dinner · 55 g', time: '19:30', icon: 'Fish', done: false },
];
const Store = createContext(null);
const petOf = (id) => PETS.find((p) => p.id === id);
function TodayScreen({ nav }) {
const t = useT();
const { tasks, toggle } = useContext(Store);
const n = tasks.filter((x) => x.done).length;
return (
{n}/{tasks.length}} />
{PETS.map((p) => (
nav.push('pet', { id: p.id })}>
{p.emoji}
{p.name}{p.kind} · {p.weight} kg
{p.next}
))}
Add pet
{tasks.map((x) => { const p = petOf(x.pet); return toggle(x.id)} />} onPress={() => toggle(x.id)} />; })}
);
}
function HealthScreen({ nav }) {
const t = useT();
const [pet, setPet] = useState(1);
const p = petOf(pet);
return (
({ label: x.emoji + ' ' + x.name, value: x.id }))} value={pet} onChange={setPet} />
} chevron onPress={() => nav.push('visit', { id: pet })} />
{}} />
{}} />
);
}
function ShopScreen() {
const t = useT();
const items = [['Dry food 12 kg', 'Repeats monthly', 'Bone', '€58', ACCENT], ['Flea treatment ×3', 'Repeats quarterly', 'Pill', '€34', '#A78BFA'], ['Cat litter 10 L', 'Repeats monthly', 'Box', '€16', '#8E8E93'], ['Dental chews', 'Order again', 'Smile', '€9', '#38BDF8']];
return (
} />
Next delivery ThursdayDry food and litter · €74
{items.map((x) => {}} />)}
);
}
function PetDetail({ nav, params }) {
const t = useT();
const p = petOf(params.id) || PETS[0];
return (
} />
{p.emoji}
{p.name}
{p.kind} · {p.age}
{}} />
{}} />
);
}
function Visit({ nav, params }) {
const t = useT();
const p = petOf(params.id) || PETS[0];
return (
{p.emoji}
{p.next.split(' · ')[0]}
{p.next.split(' · ')[1]} · 10:30 · Dr Costa
{}} />
{}} />
);
}
function Root({ nav }) {
const [tab, setTab] = useState('today');
return (
, health: , shop: }} />
);
}
const SCREENS = { root: Root, pet: PetDetail, visit: Visit };
export default function App() {
const [tasks, setTasks] = useState(TASKS_INIT);
const toggle = (id) => setTasks((xs) => xs.map((x) => (x.id === id ? Object.assign({}, x, { done: !x.done }) : x)));
return (
);
}