Files
Dashboard/ui/components/ContextMenu/ContextMenu.tsx
T
dejanandClaude Opus 5 b8bf987d0e feat(dashboard): Analytics-Dashboard als Gestaltungsvorlage zur Übergabe
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
2026-08-29 17:25:20 +02:00

118 lines
3.4 KiB
TypeScript

"use client";
/*
* Documentation:
* Context Menu — https://app.subframe.com/f023064a5ca0/library?component=Context+Menu_f8a49f07-fa5b-46c8-9399-cbbf0930cc62
*/
import React from "react";
import { FeatherStar } from "@subframe/core";
import * as SubframeCore from "@subframe/core";
import * as SubframeUtils from "../../utils";
export interface ContextDividerProps
extends React.HTMLAttributes<HTMLDivElement> {
className?: string;
}
const ContextDivider = React.forwardRef<HTMLDivElement, ContextDividerProps>(
function ContextDivider(
{ className, ...otherProps }: ContextDividerProps,
ref
) {
return (
<div
className={SubframeUtils.twClassNames(
"flex w-full items-start gap-2 px-1 py-1",
className
)}
ref={ref}
{...otherProps}
>
<div className="flex h-px grow shrink-0 basis-0 flex-col items-center gap-2 bg-border-default" />
</div>
);
}
);
export interface ContextItemProps
extends React.ComponentProps<typeof SubframeCore.ContextMenu.Item> {
children?: React.ReactNode;
icon?: React.ReactNode;
rightSlot?: React.ReactNode;
className?: string;
}
const ContextItem = React.forwardRef<HTMLDivElement, ContextItemProps>(
function ContextItem(
{
children,
icon = <FeatherStar />,
rightSlot,
className,
...otherProps
}: ContextItemProps,
ref
) {
return (
<SubframeCore.ContextMenu.Item asChild={true} {...otherProps}>
<div
className={SubframeUtils.twClassNames(
"group/9358ee78 flex h-8 w-full cursor-pointer items-center gap-2 rounded-md px-2 hover:bg-surface-neutral-tertiary active:bg-surface-neutral-primary data-[highlighted]:bg-surface-neutral-tertiary",
className
)}
ref={ref}
>
<div className="flex h-4 w-4 flex-none items-center justify-center gap-2">
{icon ? (
<SubframeCore.IconWrapper className="text-body-default-regular-0 font-body-default-regular-0 text-icon-neutral-primary">
{icon}
</SubframeCore.IconWrapper>
) : null}
</div>
{children ? (
<span className="line-clamp-1 grow shrink-0 basis-0 text-body-small-medium-150 font-body-small-medium-150 text-text-neutral-primary">
{children}
</span>
) : null}
{rightSlot ? (
<div className="flex flex-col items-end justify-center gap-2">
{rightSlot}
</div>
) : null}
</div>
</SubframeCore.ContextMenu.Item>
);
}
);
export interface ContextMenuRootProps
extends React.HTMLAttributes<HTMLDivElement> {
children?: React.ReactNode;
className?: string;
}
const ContextMenuRoot = React.forwardRef<HTMLDivElement, ContextMenuRootProps>(
function ContextMenuRoot(
{ children, className, ...otherProps }: ContextMenuRootProps,
ref
) {
return children ? (
<div
className={SubframeUtils.twClassNames(
"flex min-w-[192px] flex-col items-start rounded-md border border-solid border-border-default bg-surface-neutral-secondary px-1 py-1 shadow-lg",
className
)}
ref={ref}
{...otherProps}
>
{children}
</div>
) : null;
}
);
export const ContextMenu = Object.assign(ContextMenuRoot, {
ContextDivider,
ContextItem,
});