feat(web): Modul-Identitaet mit App-Kacheln und deutschen Kategorienamen
Jedes Modul bekommt Farbe und Symbol (tender-radar Ocker, dkv-fleet Petrol, cert-manager Violett, domaincheck Blau, proxmox Rotorange, unbekannte stabil per Hash). Kategorien in Alltagssprache; dazu die Texte fuer die neue Anmeldeseite. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { getModuleIdentity, type ModuleIconId } from '@/lib/module-identity';
|
||||
|
||||
const GLYPHS: Record<ModuleIconId, ReactNode> = {
|
||||
radar: (
|
||||
<>
|
||||
<path d="M19.07 4.93A10 10 0 0 0 6.99 3.34" />
|
||||
<path d="M4 6h.01" />
|
||||
<path d="M2.29 9.62A10 10 0 1 0 21.31 8.35" />
|
||||
<path d="M16.24 7.76A6 6 0 1 0 8.23 16.67" />
|
||||
<path d="M12 18h.01" />
|
||||
<path d="M17.99 11.66A6 6 0 0 1 15.77 16.67" />
|
||||
<circle cx="12" cy="12" r="2" />
|
||||
<path d="m13.41 10.59 5.66-5.66" />
|
||||
</>
|
||||
),
|
||||
fuel: (
|
||||
<>
|
||||
<line x1="3" x2="15" y1="22" y2="22" />
|
||||
<line x1="4" x2="14" y1="9" y2="9" />
|
||||
<path d="M14 22V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v18" />
|
||||
<path d="M14 13h2a2 2 0 0 1 2 2v2a2 2 0 0 0 2 2a2 2 0 0 0 2-2V9.83a2 2 0 0 0-.59-1.42L18 5" />
|
||||
</>
|
||||
),
|
||||
certificate: (
|
||||
<>
|
||||
<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" />
|
||||
<path d="m9 12 2 2 4-4" />
|
||||
</>
|
||||
),
|
||||
globe: (
|
||||
<>
|
||||
<circle cx="12" cy="12" r="10" />
|
||||
<path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" />
|
||||
<path d="M2 12h20" />
|
||||
</>
|
||||
),
|
||||
server: (
|
||||
<>
|
||||
<rect x="2" y="2" width="20" height="8" rx="2" />
|
||||
<rect x="2" y="14" width="20" height="8" rx="2" />
|
||||
<line x1="6" x2="6.01" y1="6" y2="6" />
|
||||
<line x1="6" x2="6.01" y1="18" y2="18" />
|
||||
</>
|
||||
),
|
||||
tile: (
|
||||
<>
|
||||
<path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z" />
|
||||
<path d="m3.3 7 8.7 5 8.7-5" />
|
||||
<path d="M12 22V12" />
|
||||
</>
|
||||
),
|
||||
};
|
||||
|
||||
interface ModuleTileProps {
|
||||
slug: string;
|
||||
/** Kantenlaenge in Pixeln (Seitenleiste 20, Karten 40, Seitenkopf 36). */
|
||||
size?: number;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* App-Kachel eines Moduls: abgerundetes Quadrat in der Modulfarbe mit weissem
|
||||
* Symbol (siehe lib/module-identity.ts). Rein dekorativ — der Modulname steht
|
||||
* immer als Text daneben.
|
||||
*/
|
||||
export function ModuleTile({ slug, size = 20, className = '' }: ModuleTileProps) {
|
||||
const { color, icon } = getModuleIdentity(slug);
|
||||
const glyph = Math.round(size * 0.6);
|
||||
return (
|
||||
<span
|
||||
aria-hidden="true"
|
||||
data-module-tile={slug}
|
||||
className={`inline-flex shrink-0 items-center justify-center text-white ${className}`}
|
||||
style={{
|
||||
width: size,
|
||||
height: size,
|
||||
borderRadius: Math.max(4, Math.round(size * 0.24)),
|
||||
backgroundColor: color,
|
||||
}}
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width={glyph}
|
||||
height={glyph}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth={size <= 24 ? 2.4 : 2}
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
>
|
||||
{GLYPHS[icon]}
|
||||
</svg>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user