import { use, useMemo } from 'react'; import type { Status } from '@openstatus/react'; import { getStatus } from '@openstatus/react'; import { cn } from '@documenso/ui/lib/utils'; const getStatusLevel = (level: Status) => { return { operational: { label: 'Operational', color: 'bg-green-500', color2: 'bg-green-400', }, degraded_performance: { label: 'Degraded Performance', color: 'bg-yellow-500', color2: 'bg-yellow-400', }, partial_outage: { label: 'Partial Outage', color: 'bg-yellow-500', color2: 'bg-yellow-400', }, major_outage: { label: 'Major Outage', color: 'bg-red-500', color2: 'bg-red-400', }, unknown: { label: 'Unknown', color: 'bg-gray-500', color2: 'bg-gray-400', }, incident: { label: 'Incident', color: 'bg-yellow-500', color2: 'bg-yellow-400', }, under_maintenance: { label: 'Under Maintenance', color: 'bg-gray-500', color2: 'bg-gray-400', }, }[level]; }; export function StatusWidget() { const getStatusMemoized = useMemo(async () => getStatus('documenso-status'), []); const { status } = use(getStatusMemoized); const level = getStatusLevel(status); return (

{level.label}

); }