mirror of
https://github.com/Dvorinka/Containr.git
synced 2026-10-28 15:51:26 +00:00
Resolve a service's tech (postgres, redis, go, node, nginx, kafka, ~50 slugs) from its image/name and render the Simple Icons logo in the tinted icon tile — canvas nodes, inspector, service detail header, and database rows — with graceful fallback to type icons. Demo services get resolvable images, ports, and domains; a Redis Cache service joins Core Platform so the demo canvas mirrors the landing preview (5 services, web/api/worker → api → postgres/redis). Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
27 lines
623 B
TypeScript
27 lines
623 B
TypeScript
import { useState } from 'react';
|
|
import { serviceIcon, serviceIconUrl, serviceTypeIcon, type ServiceIconInput } from './service-visuals';
|
|
|
|
export function ServiceIcon({
|
|
service,
|
|
size = 16,
|
|
}: {
|
|
service: ServiceIconInput;
|
|
size?: number;
|
|
}) {
|
|
const [failed, setFailed] = useState(false);
|
|
const brand = serviceIcon(service);
|
|
if (brand && !failed) {
|
|
return (
|
|
<img
|
|
src={serviceIconUrl(brand)}
|
|
width={size}
|
|
height={size}
|
|
alt=""
|
|
loading="lazy"
|
|
onError={() => setFailed(true)}
|
|
/>
|
|
);
|
|
}
|
|
return serviceTypeIcon(service.type ?? 'service', size);
|
|
}
|