import React from 'react'; import { View } from 'react-native'; import dayjs from 'dayjs'; import { MyText, MyTouchableOpacity, BottomDialog, LoadingDialog, tw } from 'common-ui'; import { useRegionSwitchContext } from '../src/hooks/useRegionSwitch'; const RegionSwitchDialogs: React.FC = () => { const { isSwitching, switchMessage, results, clearResults } = useRegionSwitchContext(); return ( <> {results?.error ? 'Region switch failed' : `Cart updated for ${results?.regionName ?? ''}`} {results?.error ? ( {results.error} ) : ( {results?.lines.length === 0 && ( Your cart is empty in this region. )} {(results?.lines ?? []).map((line, index) => ( {line.name} × {line.quantity} {line.outcome === 'kept' && ( No change )} {line.outcome === 'moved' && ( Slot moved: {line.oldSlotTime ? dayjs(line.oldSlotTime).format('ddd h:mm A') : 'previous slot'} → {line.newSlotTime ? dayjs(line.newSlotTime).format('ddd h:mm A') : ''} )} {line.outcome === 'removed' && ( Removed{line.reason ? ` — ${line.reason}` : ''} )} ))} )} Done ); }; export default RegionSwitchDialogs;