mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-01 20:55:16 +09:00
statusKind()/statusVariant()/statusDotClass()/statusLabel() drive both Pill kinds and Badge variants from ONE table; ~40 per-page maps across 35+ files migrate to it. Scoped overrides stay in the same file: serviceStatusKind (running IS the healthy steady state for services/ units/previews -> green), processStateVariant, alertStatusKind, envActionKind, impactTone. Unifications: run-shaped 'running' is cyan everywhere (Git.jsx's amber gone), QueueDetail/QueueOperations' invalid blue/yellow kinds fixed, severity tones (critical/high/medium/low) agree across security surfaces. Ratchet: npm run check:status fails on new local maps outside ds/status.js (frozen allowlist for domain maps and D4-territory hex/css-class renderers). Lint + build green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
54 lines
1.5 KiB
React
54 lines
1.5 KiB
React
import { Badge } from '@/components/ui/badge';
|
|
import { serviceStatusVariant } from '@/components/ds/status';
|
|
|
|
export function ServicesGrid({ children, className = '' }) {
|
|
return <div className={`services-grid ${className}`.trim()}>{children}</div>;
|
|
}
|
|
|
|
export function ServiceCard({
|
|
name,
|
|
description,
|
|
status,
|
|
statusVariant,
|
|
meta = [],
|
|
actions,
|
|
children,
|
|
}) {
|
|
const variant = statusVariant ?? defaultStatusVariant(status);
|
|
return (
|
|
<div className="service-card">
|
|
<div className="service-header">
|
|
<div className="service-info">
|
|
<span className={`status-dot ${variant}`} />
|
|
<h4>{name}</h4>
|
|
</div>
|
|
<Badge variant={variant}>{status}</Badge>
|
|
</div>
|
|
|
|
{description && <p className="service-description">{description}</p>}
|
|
|
|
{meta.length > 0 && (
|
|
<div className="service-meta">
|
|
{meta.map((m, i) => (
|
|
<span key={i} className="meta-item">
|
|
<span className="meta-label">{m.label}:</span> {m.value}
|
|
</span>
|
|
))}
|
|
</div>
|
|
)}
|
|
|
|
{(actions || children) && (
|
|
<div className="service-actions">
|
|
{actions ?? children}
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
function defaultStatusVariant(status) {
|
|
return serviceStatusVariant(status);
|
|
}
|
|
|
|
export default ServiceCard;
|