import React, { useMemo } from 'react'; import { useTheme, useMediaQuery } from '@mui/material'; import { MdPublic, MdSwapHoriz, MdExpandMore, MdCheckCircle, MdAccessTime, MdAccountBalanceWallet, MdStraighten, MdTrendingUp, MdTrendingDown, MdErrorOutline, MdFormatListBulleted, MdTimer, MdWarning, MdClose, MdSpeed, MdStar, MdFlag, MdHourglassBottom } from 'react-icons/md'; import { stepColor, getStatusStyle, FINAL_STATUSES, SKIPPED_STATUSES, ordinal } from './dispatchShared'; // Right-side data panel rendered in Compare mode. Pure presentation + // memoized derivations: feed it the comparison state from Dispatch and // the panel handles its own layout (compliance score, day overview, route // sequence with cascade grouping, KPIs, highlights, trips, focused-step // details, deviations, full step list). // // Props: // focusedRider — the rider whose day is being compared // compareDeltas — per-step planned/actual deltas (see useMemo // in Dispatch.js) // compareSummary — day rollup: plannedKm/actualKm/onTime/etc // actualOrdered — compareDeltas sorted by sequenceStep (visit // order). Used by the route-sequence section. // focusedCompareStep — currently focused step (1..N) or null // setFocusedCompareStep — setter; pass a function-updater for toggle // sequenceOpen — whether the "Route sequence" section is open // setSequenceOpen — setter for sequenceOpen // expandedSeqGroups — Set of expanded sequence-diff group indices // setExpandedSeqGroups — setter (Set state) // onClose — called when the user clicks the × header btn function CompareDataPanel({ focusedRider, compareDeltas, compareSummary, actualOrdered, focusedCompareStep, setFocusedCompareStep, sequenceOpen, setSequenceOpen, expandedSeqGroups, setExpandedSeqGroups, onClose }) { // Mobile flag — gates only layout (a className on the root