spb/datacenterindex
Public
HTML 53.9%
TypeScript 44.5%
JavaScript 0.6%
SQL 0.5%
1import type { FacilityStatus } from "@dci/core";2import { STATUS_LABEL, STATUS_TONE, statusVar, type StatusTone } from "@/lib/labels";3import { cn } from "./cn";45export interface StatusDotProps {6 status: FacilityStatus | StatusTone;7 size?: number;8 className?: string;9 /** hollow ring (imprecise location / rumored) */10 hollow?: boolean;11 title?: string;12}1314/** Dot colored by status tone; rumored is dotted, hollow renders as a ring. */15export function StatusDot({ status, size = 8, className, hollow, title }: StatusDotProps) {16 const tone: StatusTone = (status in STATUS_TONE ? STATUS_TONE[status as FacilityStatus] : status) as StatusTone;17 const color = statusVar(tone);18 const dotted = tone === "rumored";19 const ring = hollow || dotted;20 return (21 <span22 role="img"23 aria-label={title ?? (status in STATUS_LABEL ? STATUS_LABEL[status as FacilityStatus] : status)}24 title={title}25 className={cn("inline-block shrink-0 rounded-full", className)}26 style={{27 width: size,28 height: size,29 background: ring ? "transparent" : color,30 border: ring ? `${Math.max(1.5, size / 5)}px ${dotted ? "dotted" : "solid"} ${color}` : undefined,31 boxSizing: "border-box",32 }}33 />34 );35}36