diff --git a/apps/console/src/features/catalog/remote-resource-picker.tsx b/apps/console/src/features/catalog/remote-resource-picker.tsx index e09ccb9..23fb158 100644 --- a/apps/console/src/features/catalog/remote-resource-picker.tsx +++ b/apps/console/src/features/catalog/remote-resource-picker.tsx @@ -9,6 +9,8 @@ interface ResourceOption { name: string; disabled?: boolean; detail?: string; + /** 名称后追加的状态节点(如「已删除」Tag);下拉项与选中态同样渲染。 */ + tag?: ReactNode; } interface RemoteResourceQuery { @@ -30,6 +32,10 @@ type RemoteResourcePickerProps = { triggerRef?: Ref<{ focus: () => void }>; showId?: boolean; emptyText?: string; + /** 展开时是否重拉远端候选(数据与页面主内容同源时关闭,避免展开触发整页刷新)。 */ + refreshOnOpen?: boolean; + /** 隐藏 Form.Item 标签(Select 保留 aria-label):内嵌工具栏行时由外部提供行内标签。 */ + hideLabel?: boolean; } & ( | { multiple?: false; @@ -84,7 +90,10 @@ function optionDetail(source: ResourceOption | undefined, showId: boolean): Reac if (!source) return null; return (
-
{source.name}
+
+ {source.name} + {source.tag} +
{showId && source.id ?
{source.id}
: null} {source.detail ?
{source.detail}
: null}
@@ -101,7 +110,19 @@ function sourceOf(option: DefaultOptionType | undefined, byId: Map>(null); useImperativeHandle(triggerRef, () => ({ focus: () => selectRef.current?.focus() }), []); const [search, setSearch] = useState(""); @@ -116,14 +137,21 @@ export function RemoteResourcePicker(props: RemoteResourcePickerProps) { const optionById = new Map(all.map((option) => [option.id, option])); const options: DefaultOptionType[] = all.map((option) => ({ value: option.id, - label: option.name, + label: option.tag ? ( + + {option.name} + {option.tag} + + ) : ( + option.name + ), disabled: props.multiple ? !selectedIds.has(option.id) && (option.disabled || atLimit) : option.disabled, })); const changeOpen = (next: boolean) => { if (disabled) return; if (next) { setSearch(""); - void remote.refresh(); + if (refreshOnOpen) void remote.refresh(); } }; @@ -131,14 +159,16 @@ export function RemoteResourcePicker(props: RemoteResourcePickerProps) {
- {label} - {required ? ( - - ) : null} - + hideLabel ? undefined : ( + <> + {label} + {required ? ( + + ) : null} + + ) } validateStatus={error ? "error" : undefined} help={error} diff --git a/apps/console/src/features/members/member-usage-page.tsx b/apps/console/src/features/members/member-usage-page.tsx index 7f4a24d..eb6e1dc 100644 --- a/apps/console/src/features/members/member-usage-page.tsx +++ b/apps/console/src/features/members/member-usage-page.tsx @@ -2,11 +2,12 @@ import type { MemberSessionUsage, MemberUsageSummary, MemberView, - ModelUsagePage, - ToolUsagePage, + UsageModelRow, + UsageSummary, + UsageToolRow, } from "@openagentkit/sdk/protocol"; import type { TableColumnsType } from "antd"; -import { Button, Empty, Result, Select, Spin, Table } from "antd"; +import { Button, Empty, Popover, Result, Spin, Table, Tabs, Tag } from "antd"; import { useEffect, useMemo, useState } from "react"; import { createAdminClient } from "../../lib/admin/index.ts"; import { useAdminQuery } from "../../lib/admin/use-admin-query.ts"; @@ -14,7 +15,9 @@ import { useMemberUsage } from "../../lib/admin/use-member-usage.ts"; import { getAdminClient } from "../../lib/api.ts"; import { adminRequest } from "../../lib/kit.ts"; import { StatCard, StatCell } from "../../lib/stat-card.tsx"; +import { RemoteResourcePicker } from "../catalog/remote-resource-picker.tsx"; import { InnerLayout } from "../navigation/inner-layout.tsx"; +import usageStyles from "../usage/usage.module.less"; import { MemberUsageLimits } from "../usage/usage-limit-panels.tsx"; import styles from "./members.module.less"; import { collectionLabels, UsageMetrics } from "./usage-metrics.tsx"; @@ -23,58 +26,77 @@ function captureTime(value?: string) { return value ? new Date(value).toLocaleString("zh-CN", { hour12: false }) : "尚未采集"; } -const SESSION_TELEMETRY_PAGE_SIZE = 20; +/** 会话列表行的短时间(月/日 时:分)。 */ +function listTime(value?: string) { + return value + ? new Date(value).toLocaleString("zh-CN", { + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + hour12: false, + }) + : "—"; +} -function usageTotalText(page?: ModelUsagePage | ToolUsagePage) { - return page ? page.total_call_count.toLocaleString("zh-CN") : "—"; +/** 详情元信息里的会话 ID:过长时截中段展示,完整 ID 在 title 与列表数据中保留。 */ +function shortId(id: string) { + return id.length <= 40 ? id : `${id.slice(0, 20)}…${id.slice(-12)}`; } -type TelemetryQueryState = { loading: boolean; data?: unknown; error?: string | null }; +const SESSION_TELEMETRY_PAGE_SIZE = 20; -function telemetryLoading(...queries: TelemetryQueryState[]) { - return queries.some((query) => query.loading || (!query.data && !query.error)); +/** 指标值可能为 null(上游未知指标),统一显示破折号而不是 0。 */ +function countText(value: number | null) { + return value === null ? "—" : value.toLocaleString("zh-CN"); } -function telemetryHasNext(page: { total: number } | undefined, pageNo: number, pageSize: number) { - return page ? pageNo * pageSize < page.total : false; +/** 会话行/卡的指标可能缺失(未采集或上游未返回),与 null 同样按缺失展示。 */ +function sessionNum(value: number | null | undefined) { + return value == null ? "—" : value.toLocaleString("zh-CN"); } -type ModelRow = ModelUsagePage["items"][number]; +/** 本地分页:上游一次返回全量明细,分页只在展示层切片。 */ +function slicePage(rows: T[], pageNo: number) { + return rows.slice((pageNo - 1) * SESSION_TELEMETRY_PAGE_SIZE, pageNo * SESSION_TELEMETRY_PAGE_SIZE); +} -function countText(value: number) { - return value.toLocaleString("zh-CN"); +/** 任一明细长度超过单页即仍有下一页。 */ +function telemetryHasNext(summary: UsageSummary | undefined, pageNo: number) { + const longest = Math.max(summary?.usage.models.length ?? 0, summary?.usage.tools.length ?? 0); + return pageNo * SESSION_TELEMETRY_PAGE_SIZE < longest; } -const modelColumns: TableColumnsType = [ - { title: "模型名", dataIndex: "model_name" }, - { title: "调用次数", dataIndex: "call_count", align: "right", render: (value: number) => countText(value) }, - { title: "失败次数", dataIndex: "failed_count", align: "right", render: (value: number) => countText(value) }, +const modelColumns: TableColumnsType = [ + { title: "模型名", dataIndex: "model_name", render: (value: string | null) => value ?? "未归因" }, + { title: "调用次数", align: "right", render: (_, row) => countText(row.usage.call_count.value) }, + { title: "失败次数", align: "right", render: (_, row) => countText(row.usage.failed_count.value) }, { title: "输入", align: "right", - render: (_, row) => {countText(row.tokens.input_tokens)}, + render: (_, row) => {countText(row.usage.input_tokens.value)}, }, { title: "输出", align: "right", - render: (_, row) => {countText(row.tokens.output_tokens)}, + render: (_, row) => {countText(row.usage.output_tokens.value)}, }, { title: "缓存读取", align: "right", - render: (_, row) => {countText(row.tokens.cache_read_tokens)}, + render: (_, row) => {countText(row.usage.cache_read_tokens.value)}, }, { title: "缓存创建", align: "right", - render: (_, row) => {countText(row.tokens.cache_creation_tokens)}, + render: (_, row) => {countText(row.usage.cache_creation_tokens.value)}, }, ]; -function SessionModelTable({ rows, loading }: { rows: ModelUsagePage["items"]; loading?: boolean }) { +function SessionModelTable({ rows, loading }: { rows: UsageModelRow[]; loading?: boolean }) { return ( row.model_name ?? "unknown"} size="small" loading={loading} columns={modelColumns} @@ -86,19 +108,17 @@ function SessionModelTable({ rows, loading }: { rows: ModelUsagePage["items"]; l ); } -type ToolRow = ToolUsagePage["items"][number]; - -const toolColumns: TableColumnsType = [ - { title: "工具名", dataIndex: "tool_name" }, - { title: "来源", dataIndex: "source" }, - { title: "调用次数", dataIndex: "call_count", align: "right", render: (value: number) => countText(value) }, - { title: "失败次数", dataIndex: "failed_count", align: "right", render: (value: number) => countText(value) }, +const toolColumns: TableColumnsType = [ + { title: "工具名", dataIndex: "tool_name", render: (value: string | null) => value ?? "未知" }, + { title: "来源", dataIndex: "source", render: (value: string | null) => value ?? "未知" }, + { title: "调用次数", align: "right", render: (_, row) => countText(row.usage.call_count.value) }, + { title: "失败次数", align: "right", render: (_, row) => countText(row.usage.failed_count.value) }, ]; -function SessionToolTable({ rows, loading }: { rows: ToolUsagePage["items"]; loading?: boolean }) { +function SessionToolTable({ rows, loading }: { rows: UsageToolRow[]; loading?: boolean }) { return (
`${row.source}/${row.tool_name}`} + rowKey={(row) => `${row.source ?? "unknown"}/${row.tool_name ?? "unknown"}`} size="small" loading={loading} columns={toolColumns} @@ -110,7 +130,7 @@ function SessionToolTable({ rows, loading }: { rows: ToolUsagePage["items"]; loa ); } -/** 已就绪明细的展示:模型/工具两块 + 分页;加载提示悬浮右上角,不参与布局,避免切换时高度抖动。 */ +/** 已就绪明细的展示:模型/工具两个 Tab 共享本地分页;加载提示悬浮右上角,不参与布局,避免切换时高度抖动。 */ function SessionTelemetryView({ shown, loading, @@ -118,12 +138,13 @@ function SessionTelemetryView({ hasNext, onPage, }: { - shown: { models: ModelUsagePage; tools: ToolUsagePage }; + shown: UsageSummary; loading: boolean; pageNo: number; hasNext: boolean; onPage: (pageNo: number) => void; }) { + const [tab, setTab] = useState<"models" | "tools">("models"); return ( <> {loading ? ( @@ -131,14 +152,32 @@ function SessionTelemetryView({ 正在加载…

) : null} -
-

模型调用明细 · 全部模型调用 {usageTotalText(shown.models)} 次

- -
-
-

工具调用明细 · 全部工具调用 {usageTotalText(shown.tools)} 次

- -
+ setTab(key === "tools" ? "tools" : "models")} + items={[ + { + key: "models", + label: ( + <> + 模型调用 + {countText(shown.usage.total.model_call_count.value)} 次 + + ), + children: , + }, + { + key: "tools", + label: ( + <> + 工具调用 + {countText(shown.usage.total.tool_call_count.value)} 次 + + ), + children: , + }, + ]} + /> {hasNext || pageNo > 1 ? (
`${row.workspace_id}/${row.model_name}`} + rowKey={(row) => row.model_name ?? "unknown"} size="small" loading={loading} columns={modelTelemetryColumns} @@ -624,7 +694,7 @@ function ModelUsageSection({ }} /> )} - {page && (page.total > TELEMETRY_PAGE_SIZE || filters.page_no > 1) ? ( + {filtered.length > TELEMETRY_PAGE_SIZE || filters.page_no > 1 ? ( ({ scope: scopeKeyOf(templateId, agentId), - start: toLocalMinuteInput(Date.now() - 7 * 24 * 60 * 60 * 1000), - end: toLocalMinuteInput(Date.now()), source: "", tool_name: "", page_no: 1, })); - /** 切换选中模版(含进入/离开「全部」)即归位分页与来源/工具筛选,保留时间区间。 */ + /** 切换选中模版(含进入/离开「全部」)即归位分页与来源/工具筛选。 */ useEffect(() => { const scope = scopeKeyOf(templateId, agentId); setFilters((current) => @@ -664,74 +737,30 @@ function ToolUsageSection({ : { ...current, scope, page_no: 1, source: "", tool_name: "" }, ); }, [templateId, agentId]); - /** 工具名下拉选项:按当前模版绑定智能体、时间区间与来源拉一页全量去重聚合;工具种类超过 100 时选项可能不全。 */ - const optionsQuery = useAdminQuery( - `usage:tool-options:${scopeKeyOf(templateId, agentId)}:${filters.start}:${filters.end}:${filters.source}`, - (signal) => - client.usage.toolUsage( - { - ...telemetryQuery(filters, agentId), - ...(filters.source ? { source: filters.source as ToolUsageQuery["source"] } : {}), - page_no: 1, - page_size: 100, - }, - signal, - ), - ); - const toolOptions = [...new Set((optionsQuery.data?.items ?? []).map((row) => row.tool_name))]; - const list = useAdminQuery( - `usage:tool-usage:${scopeKeyOf(templateId, agentId)}:${JSON.stringify(filters)}`, - (signal) => - client.usage.toolUsage( - { - ...telemetryQuery(filters, agentId), - ...(filters.source ? { source: filters.source as ToolUsageQuery["source"] } : {}), - ...(filters.tool_name ? { tool_name: filters.tool_name } : {}), - page_no: filters.page_no, - page_size: TELEMETRY_PAGE_SIZE, - }, - signal, - ), - ); - const page: ToolUsagePage | undefined = list.data; - const rows: ToolUsageItem[] = page?.items ?? []; - const hasNext = page ? filters.page_no * TELEMETRY_PAGE_SIZE < page.total : false; - const loading = list.loading || (!list.data && !list.error); + const allTools = summary?.usage.tools ?? []; + const bySource = filters.source ? allTools.filter((row) => row.source === filters.source) : allTools; + const toolOptions = [ + ...new Set(bySource.map((row) => row.tool_name).filter((name): name is string => Boolean(name))), + ]; + const filtered = filters.tool_name ? bySource.filter((row) => row.tool_name === filters.tool_name) : bySource; + const rows = filtered.slice((filters.page_no - 1) * TELEMETRY_PAGE_SIZE, filters.page_no * TELEMETRY_PAGE_SIZE); + const hasNext = filters.page_no * TELEMETRY_PAGE_SIZE < filtered.length; return (

工具调用

- {page ? ( + {summary ? ( - 全部工具调用 {usageNumber(page.total_call_count)} 次 · 共 {usageNumber(page.total)} 行 + 全部工具调用 {usageNumber(summary.usage.total.tool_call_count.value)} 次 + {toolSourceSuffix(summary.usage.total)} + {failedSuffix(summary.usage.total.tool_failed_count.value)} · 共 {usageNumber(filtered.length)} 行 ) : null}
- { - if (value) setFilters({ ...filters, start: value.format("YYYY-MM-DDTHH:mm"), page_no: 1 }); - }} - /> - 至 - { - if (value) setFilters({ ...filters, end: value.format("YYYY-MM-DDTHH:mm"), page_no: 1 }); - }} - />
`${row.workspace_id}/${row.source}/${row.tool_name}`} + rowKey={(row) => `${row.source ?? "unknown"}/${row.tool_name ?? "unknown"}`} size="small" loading={loading} columns={toolTelemetryColumns} @@ -768,7 +797,7 @@ function ToolUsageSection({ }} /> )} - {page && (page.total > TELEMETRY_PAGE_SIZE || filters.page_no > 1) ? ( + {filtered.length > TELEMETRY_PAGE_SIZE || filters.page_no > 1 ? ( number | null; +} -/** 单个汇总数字:小标签 + 大号数字(与统计卡同款结构,趋势卡内独立声明避免跨文件导出私有组件)。 */ -function TrendTotal({ label, value, unit }: { label: string; value: number; unit?: string }) { +/** 趋势指标视图:Token 消耗 / 调用次数 / 失败次数(模型+工具失败,不含中断)/ 运行时长(runtime_ms 换算成秒展示)。 + * pick 返回 null 表示该桶来源未知(协议未知=null,不按 0 折算),与区间合计共用同一 read 语义。 */ +const TREND_METRICS = { + tokens: { + label: "Token 消耗", + unit: "", + legendHint: "输入+输出", + decimals: 0, + pick: (total: UsageTrendPoint["usage"]["total"]) => total.total_tokens.value, + }, + calls: { + label: "调用次数", + unit: " 次", + decimals: 0, + pick: (total: UsageTrendPoint["usage"]["total"]) => total.model_call_count.value, + }, + failures: { + label: "失败次数", + unit: " 次", + decimals: 0, + pick: (total: UsageTrendPoint["usage"]["total"]) => + total.model_failed_count.value === null || total.tool_failed_count.value === null + ? null + : total.model_failed_count.value + total.tool_failed_count.value, + }, + runtime: { + label: "运行时长", + unit: " 秒", + decimals: 1, + pick: (total: UsageTrendPoint["usage"]["total"]) => + total.runtime_ms.value === null ? null : total.runtime_ms.value / 1000, + }, +} as const; +type TrendMetric = keyof typeof TREND_METRICS; + +/** 缓存 Token = 缓存读取 + 缓存写入;与总 Token 构成 Token 消耗视图的同桶双柱。任一来源未知则该桶未知。 */ +const CACHE_TOKEN_META: TrendChartMeta = { + label: "缓存 Token", + unit: "", + legendHint: "缓存读取+缓存写入", + decimals: 0, + pick: (total) => + total.cache_read_tokens.value === null || total.cache_creation_tokens.value === null + ? null + : total.cache_read_tokens.value + total.cache_creation_tokens.value, +}; + +/** 系列 → 柱色:accent 为主系列(主题蓝),secondary 为次系列(--kit-success 绿)。 */ +const BAR_CLASSES = { + accent: { today: styles.barAccentToday, past: styles.barAccentPast }, + secondary: { today: styles.barSecondaryToday, past: styles.barSecondaryPast }, +} as const; + +/** 任意时间窗的隐含分桶粒度:≤24h 按小时、≤120 天按天、更长按月(对齐原时间窗预设的口径)。 */ +function granularityOf(spanMs: number): UsageGranularity { + if (spanMs <= 24 * HOUR_MS) return "hour"; + if (spanMs <= 120 * DAY_MS) return "day"; + return "month"; +} + +/** Provider 省略无数据的桶;按响应粒度逐桶补齐得到稳定柱位(仅展示口径)。 + * 协议 null 表示来源未知:不按 0 补值,标记 unknown 供图表绘制与悬停区分。 */ +function filledBuckets( + trend: UsageTrend, + pick: (total: UsageTrendPoint["usage"]["total"]) => number | null, +): TrendBucketPoint[] { + const length = BUCKET_KEY_LENGTH[trend.granularity]; + const byKey = new Map( + trend.points.map((point): [string, { value: number; unknown: boolean }] => { + const metric = pick(point.usage.total); + return [ + point.start_time.slice(0, length), + metric === null ? { value: 0, unknown: true } : { value: metric, unknown: false }, + ]; + }), + ); + const end = Date.parse(trend.query_range.end_time) - 1; + const buckets: TrendBucketPoint[] = []; + for ( + let ms = bucketStart(trend.granularity, Date.parse(trend.query_range.start_time)); + ms <= end; + ms = nextBucketStart(trend.granularity, ms) + ) { + const key = bucketKey(trend.granularity, ms); + const known = byKey.get(key) ?? { value: 0, unknown: false }; + buckets.push({ key, value: known.value, unknown: known.unknown }); + } + return buckets; +} + +/** 单个汇总数字:小标签 + 大号数字(与统计卡同款结构,趋势卡内独立声明避免跨文件导出私有组件)。 + * unknown 标记该指标在区间内存在未知来源:协议规定未知为 null,不按 0 计入合计,悬停出说明。 */ +function TrendTotal({ + label, + value, + unit, + unknown, +}: { + label: string; + value: number; + unit?: string; + unknown?: boolean; +}) { return (
-
{label}
+
+ {label} + {unknown ? ( + + 含未知 + + ) : null} +
{value.toLocaleString("zh-CN", { maximumFractionDigits: unit ? 1 : 0 })} {unit ? {unit} : null} @@ -25,92 +191,295 @@ function TrendTotal({ label, value, unit }: { label: string; value: number; unit ); } -/** 指标切换:Token 消耗 / 运行时长(两者量级悬殊,图内一次展示一个,汇总行始终同时给出两个总数)。 */ +/** 指标切换:Token 消耗 / 调用次数 / 失败次数 / 运行时长(量级悬殊,图内一次展示一个,汇总行始终同时给出五个总数)。 */ function TrendMetricToggle({ value, onChange }: { value: TrendMetric; onChange: (metric: TrendMetric) => void }) { return ( onChange(next as TrendMetric)} - options={[ - { label: "Token 消耗", value: "tokens" }, - { label: "运行时长", value: "active_seconds" }, - ]} + options={(Object.keys(TREND_METRICS) as TrendMetric[]).map((value) => ({ + value, + label: TREND_METRICS[value].label, + }))} /> ); } -/** 每日单指标柱状图:div 柱 + 三档虚线刻度 + 底部日期;今天(to_day)用实色强调,柱高变化走冻结动效 token。 */ +/** 柱状图:div 柱 + 三档虚线刻度 + 底部时间;同桶可并排多系列柱,当前桶(小时/日/月)实色强调,柱高变化走冻结动效 token。 + * 悬停显示跟随鼠标的列级 tooltip(日期 + 各系列数值,未知桶标「未知」)并高亮当前列;未知桶在基线出短横标记, + * 小时粒度每 4 桶出一个 x 刻度(占位保留柱位对齐),日/月逐桶出刻度。 */ function TrendChart({ - points, - metric, - toDay, + series, + granularity, + currentKey, }: { - points: TemplateUsageTrendPoint[]; - metric: TrendMetric; - toDay: string; + series: TrendChartSeries[]; + granularity: UsageGranularity; + currentKey: string; }) { - const max = Math.max(...points.map((point) => point[metric]), 0); - const unit = metric === "tokens" ? " Token" : " 秒"; - const fmt = (value: number) => value.toLocaleString("zh-CN", { maximumFractionDigits: metric === "tokens" ? 0 : 1 }); + const [primary] = series; + const areaRef = useRef(null); + const [hover, setHover] = useState<{ index: number; x: number; y: number; flip: boolean } | null>(null); + if (!primary) return null; + const max = Math.max(...series.flatMap((s) => s.points.map((point) => point.value)), 0) || 1; + const fmtFor = (meta: TrendChartMeta) => (value: number) => + value.toLocaleString("zh-CN", { maximumFractionDigits: meta.decimals }); + const axisFmt = fmtFor(primary.meta); + const buckets = primary.points.map((point) => ({ + key: point.key, + current: point.key === currentKey, + label: bucketLabel(granularity, point.key), + bars: series.map((s) => { + const bucketPoint = s.points.find((candidate) => candidate.key === point.key); + return { + meta: s.meta, + variant: s.variant, + value: bucketPoint?.value ?? 0, + unknown: bucketPoint?.unknown ?? false, + }; + }), + })); + /** barSlot 以 flex 1 严格均分绘图区宽度,x 坐标按等分即可定位悬停列;半宽翻转让 tooltip 不溢出绘图区。 */ + const onTrack = (event: MouseEvent) => { + const rect = areaRef.current?.getBoundingClientRect(); + if (!rect || rect.width === 0) return; + const x = event.clientX - rect.left; + const index = Math.min(buckets.length - 1, Math.max(0, Math.floor((x / rect.width) * buckets.length))); + setHover({ index, x, y: event.clientY - rect.top, flip: x > rect.width / 2 }); + }; + const hoveredBucket = hover === null ? undefined : buckets[hover.index]; return ( -
- {/* pt-3 给 y 轴最上方的 max 刻度留出上溢空间(-translate-y-1/2 会探出容器半行),避免与汇总行重叠。 */} -
- {[0, 1, 2, 3].map((step) => ( - - {fmt((max * step) / 3)} - - ))} -
-
-
+ <> +
+ {/* pt-3 给 y 轴最上方的 max 刻度留出上溢空间(-translate-y-1/2 会探出容器半行),避免与汇总行重叠。 */} +
{[0, 1, 2, 3].map((step) => ( -
+ + {axisFmt((max * step) / 3)} + ))} -
- {points.map((point) => ( +
+
+
setHover(null)} + > + {[0, 1, 2, 3].map((step) => (
+ key={step} + className={step === 0 ? styles.gridLine : `${styles.gridLine} ${styles.gridLineDashed}`} + style={{ bottom: `${(step * 100) / 3}%` }} + /> + ))} +
+ {buckets.map((bucket, index) => (
+ key={bucket.key} + className={hover?.index === index ? `${styles.barSlot} ${styles.slotHover}` : styles.barSlot} + > + {bucket.bars.map((bar) => ( +
+ ))} +
+ ))} +
+ {hover && hoveredBucket ? ( +
+

{hoveredBucket.label}

+ {hoveredBucket.bars.map((bar) => ( +

+