feat(platform-web): show searched vehicle service status

This commit is contained in:
lingniu
2026-07-04 02:33:04 +08:00
parent 58b125912e
commit 337e9f3dac
3 changed files with 103 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ import {
} from '@douyinfe/semi-icons';
import type { ReactNode } from 'react';
import { useState } from 'react';
import type { VehicleServiceStatus } from '../api/types';
export type PageKey = 'dashboard' | 'vehicles' | 'realtime' | 'detail' | 'history' | 'mileage' | 'quality';
@@ -34,12 +35,14 @@ function linkHealthClassName(count: number | null) {
export function AppShell({
activePage,
linkIssueCount,
currentVehicleStatus,
onChange,
onVehicleSearch,
children
}: {
activePage: PageKey;
linkIssueCount: number | null;
currentVehicleStatus?: VehicleServiceStatus;
onChange: (page: PageKey) => void;
onVehicleSearch: (keyword: string) => void | Promise<void>;
children: ReactNode;
@@ -86,6 +89,11 @@ export function AppShell({
<Button theme="solid" type="primary" loading={searching} onClick={search}></Button>
</Space>
<Space spacing={12}>
{currentVehicleStatus ? (
<Tag color={currentVehicleStatus.severity === 'ok' ? 'green' : currentVehicleStatus.severity === 'error' ? 'red' : 'orange'}>
{currentVehicleStatus.title}
</Tag>
) : null}
<Tag color="blue"></Tag>
<Tag color="grey"> / </Tag>
<Button size="small" className={linkHealthClassName(linkIssueCount)} onClick={() => onChange('quality')}>