import { Badge, type BadgeProps } from '@mantine/core' import { APPROVAL_STATUS, DECISION_STATUS, REVOCATION_STATUS, STEP_STATUS, TASK_STATUS, USER_STATUS } from './statuses' const MAPS = { approval: APPROVAL_STATUS, task: TASK_STATUS, user: USER_STATUS, step: STEP_STATUS, decision: DECISION_STATUS, revocation: REVOCATION_STATUS, } interface Props { kind: keyof typeof MAPS status: string size?: BadgeProps['size'] } export function StatusBadge({ kind, status, size = 'md' }: Props) { const meta = MAPS[kind][status] return ( {meta?.label ?? status} ) } export function userStatusOf(u: { is_blocked?: boolean; is_fired?: boolean }) { if (u.is_fired) return 'fired' if (u.is_blocked) return 'blocked' return 'active' }