fix(charts): simplify time labels in investigation views
This commit is contained in:
@@ -2,6 +2,7 @@ import { useId, useState } from "react";
|
||||
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
||||
import { ChevronDown, Eye, EyeOff, LocateFixed, MapPinned, Pause, X } from "lucide-react";
|
||||
import { AgentChartView, type AnswerUiBlock } from "@/features/agent";
|
||||
import { formatChartDisplayText } from "@/shared/utils/date-time-text";
|
||||
import { Badge } from "@/shared/ui/badge";
|
||||
import { Button } from "@/shared/ui/button";
|
||||
import { Card, CardContent, CardHeader } from "@/shared/ui/card";
|
||||
@@ -295,13 +296,13 @@ export function InvestigationPresentationPanel({
|
||||
<Card
|
||||
data-investigation-chart={item.chart_id}
|
||||
role="group"
|
||||
aria-label={item.chart.title}
|
||||
aria-label={formatChartDisplayText(item.chart.title)}
|
||||
className="border-border shadow-none"
|
||||
>
|
||||
<CardHeader className="flex-row items-start justify-between gap-2 space-y-0 p-3 pb-2">
|
||||
<div className="min-w-0">
|
||||
<h3 className="break-words text-xs font-semibold leading-5 [overflow-wrap:anywhere]">
|
||||
{item.chart.title}
|
||||
{formatChartDisplayText(item.chart.title)}
|
||||
</h3>
|
||||
<p className="mt-1 text-[11px] text-muted-foreground">
|
||||
{item.chart.series.some((series) => series.type === "scatter") ? "折线与历史散点" : item.chart.chart_type === "bar" ? "柱状图" : "折线图"} ·{" "}
|
||||
@@ -310,7 +311,7 @@ export function InvestigationPresentationPanel({
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex shrink-0 items-center gap-1">
|
||||
<FloatingWindow title={item.chart.title} fillContent
|
||||
<FloatingWindow title={formatChartDisplayText(item.chart.title)} fillContent
|
||||
openRequestKey={chartWindowKey === undefined ? undefined : JSON.stringify([chartWindowKey, item])}>
|
||||
{() => <div className="flex h-full min-h-0 min-w-0 flex-col gap-2">
|
||||
<AgentChartView chart={item.chart} embedded expanded />
|
||||
@@ -323,7 +324,7 @@ export function InvestigationPresentationPanel({
|
||||
size="icon-sm"
|
||||
className="shrink-0"
|
||||
disabled={reviewing}
|
||||
aria-label={`关闭图表 ${item.chart.title}`}
|
||||
aria-label={`关闭图表 ${formatChartDisplayText(item.chart.title)}`}
|
||||
onClick={() => onCloseChart(item.chart_id)}
|
||||
>
|
||||
<X size={14} aria-hidden />
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { formatChartDisplayText } from "@/shared/utils/date-time-text";
|
||||
import type { InvestigationPresentationCommand } from "../api/investigation-presentation";
|
||||
import { investigationActionLabels } from "./investigation-dev-preview";
|
||||
import type { PresentationView } from "./presentation-view-history";
|
||||
@@ -8,11 +9,11 @@ export function presentationCommandLabel(
|
||||
) {
|
||||
const detail =
|
||||
command.action === "open_chart"
|
||||
? command.chart.title
|
||||
? formatChartDisplayText(command.chart.title)
|
||||
: command.action === "set_overlay"
|
||||
? command.title
|
||||
: command.action === "close_chart"
|
||||
? view.charts.find((chart) => chart.chart_id === command.chart_id)?.chart.title
|
||||
? formatChartDisplayText(view.charts.find((chart) => chart.chart_id === command.chart_id)?.chart.title ?? "")
|
||||
: "feature_ids" in command
|
||||
? command.feature_ids.slice(0, 3).join("、")
|
||||
: null;
|
||||
|
||||
Reference in New Issue
Block a user