// Reusable components — map 1:1 to the spec's component list.
// , , , ,
const { useState, useEffect, useRef } = React;
// PlayButton — size="lg|sm", state controlled by parent (isPlaying)
function PlayButton({ size = "lg", isPlaying, onToggle }) {
const dim = size === "lg" ? 80 : 48;
return (
);
}
// StatCard — label, value, optional trend
function StatCard({ label, value, unit, trend }) {
return (
{value}{unit && {unit}}
{label}
{trend && (
{trend === "up" ? "↑" : trend === "down" ? "↓" : "→"} {trend === "up" ? "trending" : trend === "down" ? "cooling" : "steady"}
)}
);
}
// ThemeBadge — pill with gold border
function ThemeBadge({ theme }) {
return (
{theme}
);
}
// StarRating — value 1-5, click to set
function StarRating({ value, onChange }) {
return (
{[1,2,3,4,5].map(n => (
))}
);
}
// TogglePill — binary choice between two options
function TogglePill({ options, value, onChange }) {
return (
{options.map(opt => (
))}
);
}
// TabBar — bottom navigation
function TabBar({ active, onChange }) {
const tabs = [
{ id: "today", label: "Today", icon: IconHome },
{ id: "reflect", label: "Reflect", icon: IconReflect },
{ id: "journey", label: "Journey", icon: IconJourney },
];
return (
);
}
Object.assign(window, { PlayButton, StatCard, ThemeBadge, StarRating, TogglePill, TabBar });