import type { WidgetData } from "@/widgets"; import type { Item } from "@/types"; import { cn } from "@/lib/utils"; import { t } from "@/i18n"; // Board tile for a tracked domain: favicon, name, expiry countdown. export function DomainWidget({ item, data, error }: { item: Item; data: WidgetData | undefined; error: string | undefined; }) { const days = typeof data?.daysUntilExpiry === "number" ? data.daysUntilExpiry : undefined; const sslDays = typeof data?.sslDaysUntilExpiry === "number" ? data.sslDaysUntilExpiry : undefined; const expiring = data?.expiring === true; const domainId = typeof item.config?.domainId === "string" ? item.config.domainId : ""; return ( e.stopPropagation()} > {typeof data?.faviconUrl === "string" && data.faviconUrl ? ( ) : null} {typeof data?.name === "string" ? data.name : item.name} {error ? t("widget.err") : days === undefined ? "…" : days < 0 ? t("domains.expired") : `${days}d`} {sslDays !== undefined && sslDays <= 30 ? ` · ssl ${sslDays}d` : ""} ); }