import { Badge, StatusDot, MonoText, Button } from '@cameleer/design-system'; import type { Deployment, AppVersion } from '../../../../api/queries/admin/apps'; import { timeAgo } from '../../../../utils/format-utils'; import styles from '../AppDeploymentPage.module.css'; const STATUS_COLORS = { RUNNING: 'success', STARTING: 'warning', FAILED: 'error', STOPPED: 'auto', DEGRADED: 'warning', STOPPING: 'auto', } as const; const DEPLOY_STATUS_DOT = { RUNNING: 'live', STARTING: 'running', DEGRADED: 'stale', STOPPING: 'stale', STOPPED: 'dead', FAILED: 'error', } as const; function formatBytes(bytes: number): string { if (bytes >= 1_048_576) return `${(bytes / 1_048_576).toFixed(1)} MB`; if (bytes >= 1024) return `${(bytes / 1024).toFixed(1)} KB`; return `${bytes} B`; } interface Props { deployment: Deployment; version: AppVersion | null; externalUrl: string; onStop: () => void; onStart: () => void; } export function StatusCard({ deployment, version, externalUrl, onStop, onStart }: Props) { const running = deployment.replicaStates?.filter((r) => r.status === 'RUNNING').length ?? 0; const total = deployment.replicaStates?.length ?? 0; return (