function PackageBottles() { const [bottles, setBottles] = React.useState(); const [isLoading, setIsLoading] = React.useState(true); React.useEffect(() => { const url = window.location.pathname.replace('/+', 'https://api.dev.tea.xyz/v0/bottles/'); fetch(url) .then((res) => res.json()) .then((res) => { setBottles(res); setIsLoading(false); }); }, []); if (isLoading) return (

steeping available versions...

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

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

{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(PackageBottles), document.getElementById("packageApp"));