--- /** * SlotMeter.astro * --------------------------------------------------------------------------- * Visual "X of Y slots open" capacity meter for a store category. Reads a slot * status (open + total) and renders a progress-style bar plus an open/closed * pill. The fill width reflects open/total; when open === 0 it shows CLOSED. */ import Icon from '@components/Icon.astro'; interface Props { /** Category label, e.g. "Card orders" or "3D-print slots". */ label: string; /** mdi icon for the row. */ icon: string; /** Number of currently open slots. */ open: number; /** Total slots for the category. */ total: number; } const { label, icon, open, total } = Astro.props; const closed = open <= 0; const pct = total > 0 ? Math.max(0, Math.min(100, (open / total) * 100)) : 0; ---
{label} {closed ? 'Closed' : 'Open'}
{open} of {total} slots open {closed ? '0%' : `${Math.round(pct)}%`}