refine Semi UI track replay summary

This commit is contained in:
lingniu
2026-07-18 18:21:25 +08:00
parent 5bfdc7f637
commit 23669d8190
4 changed files with 88 additions and 5 deletions

View File

@@ -227,7 +227,9 @@ test('renders a map-first replay workspace and connects stop, event, and panel i
expect(screen.queryByRole('textbox', { name: '搜索轨迹车辆' })).not.toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: '隐藏查询与明细' }));
expect(screen.getByRole('button', { name: '打开轨迹详情' })).toBeInTheDocument();
const expandRail = screen.getByRole('button', { name: '打开轨迹详情' });
expect(expandRail).toBeInTheDocument();
expect(expandRail).toHaveTextContent('轨迹详情8 km · 1 个停留');
fireEvent.click(screen.getByRole('button', { name: '打开轨迹详情' }));
expect(screen.getByRole('button', { name: '隐藏查询与明细' })).toBeInTheDocument();

View File

@@ -393,7 +393,12 @@ export default function TrackPage() {
<section className="v2-track-stage">
<TrackMap points={points} stops={track?.stops ?? []} activeIndex={boundedIndex} showStops={showStops} follow={follow} followDurationMs={playing ? Math.max(40, trackPlaybackInterval(playbackSpeed) - 10) : 180} onSelectIndex={selectIndex} onFollowChange={setFollow} />
{railCollapsed && track?.points.length ? <Button className="v2-track-rail-expand" theme="light" aria-label="打开轨迹详情" icon={<IconList />} onClick={() => setRailCollapsed(false)}></Button> : null}
{railCollapsed && track?.points.length ? <Button className="v2-track-rail-expand" theme="light" aria-label="打开轨迹详情" icon={<IconList />} onClick={() => setRailCollapsed(false)}>
<span className="v2-track-rail-expand-copy">
<strong></strong>
<small>{number(track.summary.distanceKm)} km · {track.stops.length} </small>
</span>
</Button> : null}
<div className="v2-track-stage-tools" role="toolbar" aria-label="地图轨迹工具">
<Button theme="borderless" aria-label={follow ? '关闭车辆跟随' : '开启车辆跟随'} className={follow ? 'is-active' : ''} icon={<IconMapPin />} disabled={!points.length} onClick={() => setFollow((value) => !value)}>{follow ? '跟随车辆' : '自由浏览'}</Button>
<Button theme="borderless" aria-label={showStops ? '隐藏停留点' : '显示停留点'} className={showStops ? 'is-active' : ''} icon={showStops ? <IconEyeOpened /> : <IconEyeClosed />} disabled={!track?.stops.length} onClick={() => setShowStops((value) => !value)}></Button>