import { motion, AnimatePresence } from 'framer-motion'; import { useFlowStore } from '../../store/useFlowStore'; import { Icon } from '../shared/Icon'; import { Tooltip } from '../shared/Tooltip'; import { MESSAGE_COLORS } from '../../data/types'; import { MESSAGE_TYPE_ICONS } from '../../utils/iconMap'; import { StakeholderToggle } from './StakeholderToggle'; import { DecisionTreeView } from './DecisionTreeView'; import { RiderUIStatesTable } from './RiderUIStatesTable'; import { DriverUIStatesTable } from './DriverUIStatesTable'; import { BullMQJobsList } from './BullMQJobsList'; import { FeatureFlagMatrix } from './FeatureFlagMatrix'; import { DeeplinkActionsChips } from './DeeplinkActionsChips'; import { TroubleshootingSection } from './TroubleshootingSection'; const CANCELABILITY_RULES = [ { status: '<= ACCEPTED', canCancel: 'Yes', color: '#22c55e', dotColor: '#22c55e' }, { status: 'DRIVING', canCancel: 'Maybe (Fee Applies)', color: '#eab308', dotColor: '#eab308' }, { status: 'COMPLETED', canCancel: 'No', color: '#ef4444', dotColor: '#3b82f6' }, { status: 'CANCELLED', canCancel: 'No', color: '#ef4444', dotColor: '#64748b' }, ]; const MESSAGE_LEGEND = [ { type: 'request', label: 'Request', description: 'Inbound data stream' }, { type: 'response', label: 'Response', description: 'System confirmation' }, { type: 'event', label: 'Event', description: 'State change trigger' }, { type: 'job', label: 'Job', description: 'Background process' }, { type: 'notification', label: 'Notification', description: 'User alert' }, { type: 'cleanup', label: 'Cleanup', description: 'Garbage collection' }, ] as const; export function RulesLegendPanel() { const isOpen = useFlowStore((s) => s.isReferencePanelOpen); const toggle = useFlowStore((s) => s.toggleReferencePanel); return ( {isOpen && ( <> {/* Backdrop */} {/* Panel */} {/* Header */}

System Reference

Rules and visual guides for ride lifecycle

{/* Stakeholder Toggle */} {/* Scrollable Content */}
{/* Cancelability Rules */}

Cancelability Rules

{CANCELABILITY_RULES.map((rule) => ( ))}
Ride Status Rider Can Cancel?
{rule.status}
{rule.canCancel}
{/* Message Legend */}

Message Legend

{MESSAGE_LEGEND.map(({ type, label, description }) => { const color = MESSAGE_COLORS[type]; const iconName = MESSAGE_TYPE_ICONS[type] || 'circle'; return (

{label}

{description}

); })}
{/* Decision Tree */} {/* Rider UI States */} {/* Driver UI States */} {/* BullMQ Jobs */} {/* Feature Flags */} {/* Deeplink Actions */} {/* Troubleshooting */}
{/* Footer */}
)}
); }