quality / commitlint (push) Skipped
quality / changes (push) Successful in 8s
quality / go (push) Skipped
quality / bird2 (push) Skipped
quality / docker-check (push) Skipped
quality / openapi (push) Successful in 22s
quality / web (push) Successful in 1m0s
CD / quality (push) Successful in 1m35s
CD / publish (push) Successful in 2m59s
Секции страниц переведены на segmented Tabs (c-tabs-9), статус грида — ToggleGroup в toolbar. Убраны календарь задач, пустые вкладки мониторинга и demo-деревья ReUI. KPI overflow как в CFDM, DetailPanel на карточке модуля, один FrameSection. Co-authored-by: Cursor <cursoragent@cursor.com>
54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import { KpiStatGrid, type KpiStatItem } from '@/components/reui-kit'
|
|
import { Badge } from '@/components/reui/badge'
|
|
import { cn } from '@evobgp/ui/lib/utils'
|
|
|
|
export type AnalyticsKpiItem = {
|
|
label: string
|
|
value: string
|
|
delta?: {
|
|
direction: 'up' | 'down' | 'neutral'
|
|
label: string
|
|
tone?: 'success' | 'warning' | 'destructive' | 'muted'
|
|
}
|
|
}
|
|
|
|
function deltaBadgeVariant(
|
|
tone?: 'success' | 'warning' | 'destructive' | 'muted',
|
|
): 'success-light' | 'warning-light' | 'destructive-light' | 'outline' {
|
|
if (tone === 'success') return 'success-light'
|
|
if (tone === 'warning') return 'warning-light'
|
|
if (tone === 'destructive') return 'destructive-light'
|
|
return 'outline'
|
|
}
|
|
|
|
function toKpiItem(item: AnalyticsKpiItem): KpiStatItem {
|
|
return {
|
|
id: item.label,
|
|
value: item.value,
|
|
label: item.label,
|
|
footer: item.delta ? (
|
|
<Badge variant={deltaBadgeVariant(item.delta.tone)} size="sm">
|
|
{item.delta.label}
|
|
</Badge>
|
|
) : undefined,
|
|
}
|
|
}
|
|
|
|
/** Compact KPI row inside analytics panels (stats-12 embedded tiles). */
|
|
export function AnalyticsKpiRow({
|
|
items,
|
|
className,
|
|
}: {
|
|
items: AnalyticsKpiItem[]
|
|
className?: string
|
|
}) {
|
|
return (
|
|
<KpiStatGrid
|
|
items={items.map(toKpiItem)}
|
|
embedded
|
|
className={cn(className)}
|
|
aria-label="Показатели"
|
|
/>
|
|
)
|
|
}
|