mirror of
https://github.com/Dvorinka/Containr.git
synced 2026-10-28 15:51:26 +00:00
fix: render service icons via function call, not dynamic component
This commit is contained in:
1 parent
dbdf6733d1
commit
04c3b99531
1 file changed
+6
-11
@@ -17,16 +17,16 @@ export type GroupNodeData = {
|
|||||||
export type ServiceNodeType = Node<ServiceNodeData, 'serviceNode'>;
|
export type ServiceNodeType = Node<ServiceNodeData, 'serviceNode'>;
|
||||||
export type GroupNodeType = Node<GroupNodeData, 'groupNode'>;
|
export type GroupNodeType = Node<GroupNodeData, 'groupNode'>;
|
||||||
|
|
||||||
function serviceTypeIcon(type: string): typeof Box {
|
function renderServiceTypeIcon(type: string, size = 18) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'web':
|
case 'web':
|
||||||
return Globe;
|
return <Globe size={size} />;
|
||||||
case 'database':
|
case 'database':
|
||||||
return Database;
|
return <Database size={size} />;
|
||||||
case 'worker':
|
case 'worker':
|
||||||
return Terminal;
|
return <Terminal size={size} />;
|
||||||
default:
|
default:
|
||||||
return Box;
|
return <Box size={size} />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,11 +56,6 @@ 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 typeColor = serviceTypeColor(service.type);
|
const typeColor = serviceTypeColor(service.type);
|
||||||
@@ -103,7 +98,7 @@ export function ServiceNode({ data }: NodeProps<ServiceNodeType>) {
|
|||||||
color: selected ? 'white' : typeColor,
|
color: selected ? 'white' : typeColor,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ServiceTypeIcon type={service.type} size={18} />
|
{renderServiceTypeIcon(service.type, 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>
|
||||||
|
|||||||
Reference in new issue
Block a user