A lightweight, macOS-style dock for Windows 11, with glass visuals, smooth magnification, and Genie effect.
---
/**
* The menu bar's AI usage island, as the app draws it: a black pill hanging
* from the top edge with one ring per provider, which opens into a panel.
* `mode="hover"` opens it on pointer or keyboard focus; `"open"` keeps it
* open, for the section that explains it.
*/
import { Image } from "astro:assets";
import { usageProviders } from "@/data/usage";
import "@/styles/usage.css";
interface Props {
mode?: "hover" | "open";
/** Reachable with the keyboard; off inside decorative (aria-hidden) mocks. */
focusable?: boolean;
class?: string;
}
const { mode = "hover", focusable = false, class: className } = Astro.props;
const showcaseProviders = usageProviders.slice(0, 2);
---
<div class:list={["island", `island-${mode}`, className]} tabindex={focusable ? 0 : undefined}>
<div class="island-compact">
{
showcaseProviders.map((provider, index) => (
<>
{index > 0 && <i class="island-divider" />}
<span class="island-provider">
<Image src={provider.logo} alt="" width={16} height={16} />
<b class="tabular-nums">{provider.primary.used}%</b>
<svg class="island-ring" viewBox="0 0 16 16" aria-hidden="true" style={`--ring: ${provider.color}`}>
<circle cx="8" cy="8" r="6" pathLength="100" />
<circle
cx="8"
cy="8"
r="6"
pathLength="100"
stroke-dasharray={`${provider.primary.used} 100`}
/>
</svg>
</span>
</>
))
}
</div>
<div class="island-panel">
<div class="island-head">
<b>AI usage</b>
<span>Updated 2 min ago</span>
</div>
{
showcaseProviders.map((provider) => (
<div class="island-row">
<Image src={provider.logo} alt="" width={20} height={20} />
<div class="island-detail">
<p>
<b>{provider.name}</b>
<span class="tabular-nums">{provider.primary.label} · {provider.primary.used}%</span>
</p>
<span class="island-bar">
<i style={`width: ${provider.primary.used}%; background: ${provider.color}`} />
</span>
{
provider.secondary ? (
<p class="island-meta">
<span class="tabular-nums">{provider.secondary.label} · {provider.secondary.used}% used</span>
<span>{provider.secondary.resets}</span>
</p>
) : (
<p class="island-meta">
<span>{provider.primary.resets}</span>
</p>
)
}
</div>
</div>
))
}
</div>
</div>