import { clsx, type ClassValue } from 'clsx'; import { twMerge } from 'tailwind-merge'; export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } /** Format bytes into a human-readable string (B / KB / MB / GB / TB). */ export function formatBytes(bytes: number): string { if (bytes === 0) return '0 B'; const k = 1024; const sizes = ['B', 'KB', 'MB', 'GB', 'TB']; const i = Math.floor(Math.log(bytes) / Math.log(k)); return `${(bytes / Math.pow(k, i)).toFixed(2)} ${sizes[i]}`; } /** Tailwind classes for a service/deployment status badge. */ export function getStatusColor(status: string): string { switch (status) { case 'up': case 'success': return 'text-green-600 bg-green-50 border-green-200'; case 'down': case 'failed': return 'text-red-600 bg-red-50 border-red-200'; case 'degraded': case 'running': return 'text-yellow-600 bg-yellow-50 border-yellow-200'; default: return 'text-gray-600 bg-gray-50 border-gray-200'; } }