"use client"; import { useState } from "react"; import { Box, CalendarClock, Clock3, Droplets, Eye, EyeOff, type LucideIcon } from "lucide-react"; import { MAP_ICON_CELL_RADIUS_CLASS_NAME } from "@/features/map/core/components/map-control-styles"; import { cn } from "@/lib/utils"; import type { WorkbenchAlert, WorkbenchScenario, WorkbenchUser } from "../types"; import { AlertMenu, ScenarioMenu, UserMenu } from "./workbench-top-bar-menus"; export type WorkbenchTopBarProps = { dataTime: string; modelName: string; scenarios: WorkbenchScenario[]; activeScenarioId: string; alerts: WorkbenchAlert[]; user: WorkbenchUser; conditionFeedVisible: boolean; taskTickerAvailable: boolean; taskTickerVisible: boolean; onSelectScenario: (scenarioId: string) => void; onSelectAlert: (alert: WorkbenchAlert) => void; onToggleConditionFeed: () => void; onToggleTaskTicker: () => void; onPreviewScenario: () => void; onCompareScenario: () => void; onExportScenarioReport: () => void; onAnalyzeAlertsWithAgent: () => void | Promise; onShowDataStatus: () => void; onRefreshTiles: () => void; onShowShortcuts: () => void; onExportConfig: () => void; }; const headerControlButtonClassName = "inline-flex h-8 items-center gap-2 rounded-full border border-transparent bg-transparent text-sm font-semibold text-slate-700 transition-colors hover:bg-white/70 hover:text-blue-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600/20 focus-visible:ring-offset-2 data-[state=open]:bg-white/90 data-[state=open]:text-blue-700"; const headerControlIconClassName = "grid h-5 w-5 shrink-0 place-items-center rounded-full bg-slate-100/80 text-slate-500 transition-colors group-hover:bg-blue-50 group-hover:text-blue-700 group-data-[state=open]:bg-blue-50 group-data-[state=open]:text-blue-700"; type HeaderMenuId = "alerts" | "compact-alerts" | "scenario" | "user"; export function WorkbenchTopBar({ dataTime, modelName, scenarios, activeScenarioId, alerts, user, conditionFeedVisible, taskTickerAvailable, taskTickerVisible, onSelectScenario, onSelectAlert, onToggleConditionFeed, onToggleTaskTicker, onPreviewScenario, onCompareScenario, onExportScenarioReport, onAnalyzeAlertsWithAgent, onShowDataStatus, onRefreshTiles, onShowShortcuts, onExportConfig }: WorkbenchTopBarProps) { const [openMenu, setOpenMenu] = useState(null); const activeScenario = scenarios.find((scenario) => scenario.id === activeScenarioId) ?? scenarios[0]; const createMenuOpenChange = (menuId: HeaderMenuId) => (open: boolean) => { setOpenMenu(open ? menuId : null); }; return (

排水管网

调度工作台

{taskTickerAvailable ? : null} {activeScenario ? ( ) : null}
); } function TaskTickerToggle({ available, visible, onToggle }: { available: boolean; visible: boolean; onToggle: () => void; }) { const Icon = visible ? EyeOff : Eye; if (!available) { return null; } return ( ); } function ConditionFeedToggle({ visible, onToggle }: { visible: boolean; onToggle: () => void; }) { return ( ); } function HeaderReadout({ icon: Icon, label, value }: { icon?: LucideIcon; label: string; value: string }) { return (
{Icon ?
); } function HeaderDivider() { return
; }