mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-04 14:11:22 +09:00
Per docs/plans/FRONTEND_UX_TAILWIND_CLEANUP_PLAN.md §8.5. React 18's automatic JSX runtime makes 'import React' unnecessary; removed it from the 142 files eslint flagged as 'React defined but never used' (named imports like useState preserved). Driven by an eslint --format json pass so only flagged files were touched. Lint warnings: 1603 -> 1461 (0 errors). Verified: npm run build passes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
64 lines
1.7 KiB
React
64 lines
1.7 KiB
React
import { Badge } from '@/components/ui/badge';
|
|
|
|
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) {
|
|
switch (status?.toLowerCase()) {
|
|
case 'running':
|
|
case 'active':
|
|
return 'success';
|
|
case 'stopped':
|
|
case 'failed':
|
|
return 'destructive';
|
|
case 'inactive':
|
|
return 'secondary';
|
|
default:
|
|
return 'warning';
|
|
}
|
|
}
|
|
|
|
export default ServiceCard;
|