/** * FilamentSlotCircle renders a small color circle with the 1-based slot * number centered inside, matching the style used on AMS cards in PrintersPage. * * Props: * trayColor - 6-char hex color string WITHOUT leading '#' (e.g. "FF0000"). * Pass undefined / empty string when the slot is empty. * trayType - Filament material string (e.g. "PLA"). Used to decide the * fallback background when there is no color but a type is known. * isEmpty - Whether the slot contains no filament. * slotNumber - 1-based slot number to display inside the circle. */ interface FilamentSlotCircleProps { trayColor?: string | null; trayType?: string | null; isEmpty: boolean; slotNumber: number; } function isLightFilamentColor(hex: string): boolean { if (!hex || hex.length < 6) return false; const r = parseInt(hex.slice(0, 2), 16); const g = parseInt(hex.slice(2, 4), 16); const b = parseInt(hex.slice(4, 6), 16); return (0.299 * r + 0.587 * g + 0.114 * b) / 255 > 0.6; } export function FilamentSlotCircle({ trayColor, trayType, isEmpty, slotNumber }: FilamentSlotCircleProps) { return (
{slotNumber}
); }