fix: extract service icon into component — react-hooks lint

This commit is contained in:
Tomas Dvorak committed 2026-09-21 19:35:48 +02:00
1 parent ff356230fe
commit dbdf6733d1
1 file changed
+6 -2
@@ -56,9 +56,13 @@ function statusLabel(status: string): string {
} }
} }
function ServiceTypeIcon({ type, size = 18 }: { type: string; size?: number }) {
const Icon = serviceTypeIcon(type);
return <Icon size={size} />;
}
export function ServiceNode({ data }: NodeProps<ServiceNodeType>) { export function ServiceNode({ data }: NodeProps<ServiceNodeType>) {
const { service, selected } = data; const { service, selected } = data;
const Icon = serviceTypeIcon(service.type);
const typeColor = serviceTypeColor(service.type); const typeColor = serviceTypeColor(service.type);
const isRunning = service.status === 'running'; const isRunning = service.status === 'running';
const replicas = service.replicas ?? 0; const replicas = service.replicas ?? 0;
@@ -99,7 +103,7 @@ export function ServiceNode({ data }: NodeProps<ServiceNodeType>) {
color: selected ? 'white' : typeColor, color: selected ? 'white' : typeColor,
}} }}
> >
<Icon size={18} /> <ServiceTypeIcon type={service.type} size={18} />
</div> </div>
<div className="min-w-0 flex-1 pt-0.5"> <div className="min-w-0 flex-1 pt-0.5">
<h4 className="font-semibold text-sm text-[var(--text-primary)] truncate tracking-tight">{service.name}</h4> <h4 className="font-semibold text-sm text-[var(--text-primary)] truncate tracking-tight">{service.name}</h4>