feat: update task file selection UI
This commit is contained in:
@@ -2,6 +2,7 @@ import { useState, useEffect } from 'react';
|
||||
import { trpc } from '@/lib/trpc';
|
||||
import { BarChart2, Ruler, Zap, Play, Trash2, ChevronDown, ChevronRight, RefreshCw, Flame, Box, Layers, Crosshair, Cpu, Timer } from 'lucide-react';
|
||||
import GenericResultView, { type Overlay3D } from './GenericResultView';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip';
|
||||
|
||||
/** 将毫秒数格式化为可读时长,如 2m 34s / 47s / 1h 5m */
|
||||
function fmtDuration(ms: number): string {
|
||||
@@ -162,6 +163,16 @@ type AssemblyMeta = SmoothHeatmapMeta & {
|
||||
parts?: AssemblyPartRow[];
|
||||
};
|
||||
|
||||
function getResultTitle(r: { type: string; pluginId?: string }) {
|
||||
if (r.type === 'error_analysis') return '误差分析';
|
||||
if (r.type === 'measurement') return '尺寸测量';
|
||||
if (r.type === 'smooth_heatmap') return '平滑热力';
|
||||
if (r.type === 'assembly_inspection') return '装配检测';
|
||||
if (r.type === 'obj_deviation') return '偏差热力';
|
||||
if (r.type === 'plugin') return `算法 · ${r.pluginId ?? '插件'}`;
|
||||
return '压缩';
|
||||
}
|
||||
|
||||
export default function AnalysisPanel({ taskId, onReplay, onViewSmoothHeatmap, onRunAssembly, onRunDeviation, externalPending, onViewPluginOverlay }: Props) {
|
||||
const utils = trpc.useUtils();
|
||||
const [expandedIds, setExpandedIds] = useState<Set<number>>(new Set());
|
||||
@@ -243,12 +254,13 @@ export default function AnalysisPanel({ taskId, onReplay, onViewSmoothHeatmap, o
|
||||
const expanded = expandedIds.has(r.id);
|
||||
const errorStats = r.errorStats as ErrorStats | null;
|
||||
const measurements = r.measurements as Measurement[] | null;
|
||||
const resultTitle = getResultTitle(r as { type: string; pluginId?: string });
|
||||
|
||||
return (
|
||||
<div key={r.id} className="industrial-card rounded overflow-hidden">
|
||||
<div key={r.id} className="industrial-card rounded overflow-hidden min-w-0">
|
||||
{/* 标题行 */}
|
||||
<div
|
||||
className="flex items-center gap-2 px-2 py-1.5 cursor-pointer hover:bg-secondary/40 group"
|
||||
className="flex items-center gap-2 px-2 py-1.5 cursor-pointer hover:bg-secondary/40 group min-w-0"
|
||||
onClick={() => toggleExpand(r.id)}
|
||||
>
|
||||
{expanded ? <ChevronDown className="w-3 h-3 text-muted-foreground" /> : <ChevronRight className="w-3 h-3 text-muted-foreground" />}
|
||||
@@ -259,21 +271,18 @@ export default function AnalysisPanel({ taskId, onReplay, onViewSmoothHeatmap, o
|
||||
{r.type === 'assembly_inspection' && <Layers className="w-3.5 h-3.5 text-cyan-400 flex-shrink-0" />}
|
||||
{r.type === 'obj_deviation' && <Crosshair className="w-3.5 h-3.5 text-rose-400 flex-shrink-0" />}
|
||||
{r.type === 'plugin' && <Cpu className="w-3.5 h-3.5 text-violet-400 flex-shrink-0" />}
|
||||
<span className="text-xs flex-1 truncate">
|
||||
{r.type === 'error_analysis'
|
||||
? '误差分析'
|
||||
: r.type === 'measurement'
|
||||
? '尺寸测量'
|
||||
: r.type === 'smooth_heatmap'
|
||||
? '平滑热力'
|
||||
: r.type === 'assembly_inspection'
|
||||
? '装配检测'
|
||||
: r.type === 'obj_deviation'
|
||||
? '偏差热力'
|
||||
: r.type === 'plugin'
|
||||
? `算法 · ${(r as { pluginId?: string }).pluginId ?? '插件'}`
|
||||
: '压缩'}
|
||||
</span>
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span className="text-xs flex-1 min-w-0 truncate">{resultTitle}</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent
|
||||
side="left"
|
||||
align="start"
|
||||
className="max-w-[min(28rem,calc(100vw-2rem))] break-all"
|
||||
>
|
||||
{resultTitle}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
<span className="text-[10px] text-muted-foreground">
|
||||
{new Date(r.createdAt).toLocaleDateString('zh-CN')}
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user