import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { Settings2 } from "lucide-react"; import { Switch } from "@/components/ui/switch"; import { Button } from "@/components/ui/button"; import { formatBytes } from "@/utils"; import { useIsMobile } from "@/hooks/useMobile"; interface StatsBarProps { displayOptions: { time: boolean; online: boolean; regions: boolean; traffic: boolean; speed: boolean; }; setDisplayOptions: (options: any) => void; stats: { onlineCount: number; totalCount: number; uniqueRegions: number; totalTrafficUp: number; totalTrafficDown: number; currentSpeedUp: number; currentSpeedDown: number; }; loading: boolean; currentTime: Date; } export const StatsBar = ({ displayOptions, setDisplayOptions, stats, loading, currentTime, }: StatsBarProps) => { const isMobile = useIsMobile(); // 获取已启用的统计项列表 const enabledStats = Object.keys(displayOptions).filter( (key) => displayOptions[key as keyof typeof displayOptions] ); // 渲染统计项 const renderStatItem = (key: string) => { switch (key) { case "time": return ( displayOptions.time && (