import { IconChevronRight, IconMore } from '@douyinfe/semi-icons'; import { Button } from '@douyinfe/semi-ui'; import type { ReactNode } from 'react'; import { useState } from 'react'; import { WorkspaceSideSheet } from '../shared/WorkspaceSideSheet'; export type VehicleAction = { key: string; label: string; icon: ReactNode; to: string; type: 'primary' | 'tertiary'; }; export default function VehicleActions({ actions, mobile, onSelect }: { actions: VehicleAction[]; mobile: boolean; onSelect: (to: string) => void; }) { const [open, setOpen] = useState(false); const primaryActions = actions.filter((action) => action.key === 'switch' || action.key === 'tracks'); const overflowActions = actions.filter((action) => action.key !== 'switch' && action.key !== 'tracks'); const selectAction = (to: string) => { setOpen(false); onSelect(to); }; if (!mobile) return
{actions.map((action) => )}
; return <>
{primaryActions.map((action) => )} {overflowActions.length ? : null}
} ariaLabel="更多车辆操作" dialogId="v2-vehicle-mobile-actions" title="更多车辆操作" description="继续查看这辆车的历史、里程与告警" badge={`${overflowActions.length} 项`} onCancel={() => setOpen(false)} footerNote="选择操作后将自动进入对应车辆页面" primaryAction={{ label: '完成', onClick: () => setOpen(false) }} >
{overflowActions.map((action) => )}
; }