UI/UX-Prototyp der Analytics-Dashboards in HiveGrid, fachlich auf einen SHK-/Handwerksbetrieb zugeschnitten. Ziel ist die Übergabe an die Entwicklung, nicht der Produktivbetrieb. Inhalt: sechs Seiten (Übersicht, Finanzen, Aufträge, Kunden, Team, Komponenten), 26 KPIs, neun Chart-Bausteine, Filtersystem mit seitenabhängiger Relevanz und ein deterministischer Demo-Datensatz (420 Kunden, 1.900 Aufträge, Stichtag 30.07.2026). Drei Quellen sind zusammengeführt: die fachliche Planung mit dem Branchenpartner (Januar 2026), die Subframe-Komponentenbibliothek aus dem HiveGrid-Pitch und IBM Carbon Data Visualization für die Diagrammregeln. Herkunft und bewusste Abweichungen stehen in docs/HERKUNFT.md. Dokumentation: README, HANDOVER (was echte Logik braucht), docs/DESIGN-SYSTEM, KPI-KATALOG, DATENMODELL, NAVIGATION, HERKUNFT, ZIELSYSTEM (Einbauort in HiveGrid Cloud) und LEITPLANKEN (welche Cloud-Screens als Vorbild taugen). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QPeZNwSeU7qG3RRCwaxEZX
78 lines
2.1 KiB
TypeScript
78 lines
2.1 KiB
TypeScript
"use client";
|
|
|
|
import React from "react";
|
|
import { CHART } from "../../utils/chartTheme";
|
|
|
|
/**
|
|
* Einheitlicher Tooltip für alle Charts.
|
|
*
|
|
* Carbon-Vorgabe: dunkle Fläche (#393939), heller Text, 12 px Label,
|
|
* kein Rahmen, kein Doppelpunkt zwischen Name und Wert.
|
|
* Ein gemeinsamer Tooltip verhindert, dass jedes Chart eigene Regeln erfindet.
|
|
*
|
|
* Die Props sind bewusst weit typisiert: Recharts reicht sein internes
|
|
* Payload-Format durch, das je nach Chart-Typ leicht abweicht.
|
|
*/
|
|
interface TooltipPayload {
|
|
name?: unknown;
|
|
value?: unknown;
|
|
color?: string;
|
|
dataKey?: unknown;
|
|
}
|
|
|
|
export function ChartTooltip({
|
|
active,
|
|
label,
|
|
payload,
|
|
formatWert,
|
|
labelPrefix,
|
|
}: {
|
|
active?: boolean;
|
|
label?: unknown;
|
|
payload?: readonly TooltipPayload[];
|
|
formatWert: (wert: number) => string;
|
|
labelPrefix?: string;
|
|
}) {
|
|
if (!active || !payload?.length) return null;
|
|
|
|
const reihen = payload
|
|
.filter((eintrag) => typeof eintrag.value === "number")
|
|
.map((eintrag) => ({
|
|
name: String(eintrag.name ?? eintrag.dataKey ?? ""),
|
|
value: eintrag.value as number,
|
|
color: eintrag.color,
|
|
}));
|
|
|
|
if (!reihen.length) return null;
|
|
|
|
const labelText = label === undefined || label === null ? "" : String(label);
|
|
|
|
return (
|
|
<div
|
|
className="pointer-events-none rounded-md px-3 py-2 shadow-lg"
|
|
style={{ background: CHART.tooltipBg, color: CHART.tooltipFg }}
|
|
>
|
|
{labelText ? (
|
|
<div className="mb-1 text-[12px] opacity-80">
|
|
{labelPrefix ? `${labelPrefix} ` : ""}
|
|
{labelText}
|
|
</div>
|
|
) : null}
|
|
<div className="flex flex-col gap-0.5">
|
|
{reihen.map((reihe) => (
|
|
<div key={reihe.name} className="flex items-center gap-2 text-[13px]">
|
|
{reihe.color ? (
|
|
<span
|
|
className="h-2.5 w-2.5 flex-none rounded-sm"
|
|
style={{ background: reihe.color }}
|
|
/>
|
|
) : null}
|
|
<span className="opacity-80">{reihe.name}</span>
|
|
<span className="ml-auto font-semibold tabular-nums">{formatWert(reihe.value)}</span>
|
|
</div>
|
|
))}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|