function Bottles() { const [bottles, setBottles] = React.useState(); const [isLoading, setLoading] = React.useState(true); React.useEffect(() => { fetch("https://api.tea.xyz/v0/bottles") .then((res) => res.json()) .then((res) => { setBottles(res); setLoading(false); }); }, []); if (isLoading) return (

steeping...

); if (!bottles) return null; const names = [...new Set(bottles.map((b) => b.name))]; return (

Showing {names.length} packages

{names.map((name) => ( ))}
); function Bottle({ name }) { const [expanded, toggleExpanded] = React.useState(false); const versions = [ ...new Set(bottles.filter((b) => b.name === name).map((b) => b.version)), ]; return (
toggleExpanded(!expanded)}>

{name}

{versions.length} version{versions.length === 1 ? "" : "s"} bottled

{expanded && ( {versions.map((v) => { const available = new Set( bottles .filter((b) => b.name === name && b.version == v) .map((b) => `${b.platform}-${b.arch}`) ); return ( ); })}
version darwin-aarch64 darwin-x86-64 linux-aarch64 linux-x86-64
{v} {available.has("darwin-aarch64") ? "✅" : "❌"} {available.has("darwin-x86-64") ? "✅" : "❌"} {available.has("linux-aarch64") ? "✅" : "❌"} {available.has("linux-x86-64") ? "✅" : "❌"}
)}

); } } ReactDOM.render(React.createElement(Bottles), document.getElementById("app"));