// statusUtils.ts // Utility functions to handle dewar statuses and icon colors export type DewarStatus = 'In Preparation' | 'Ready for Shipping' | 'Shipped' | 'Not Arrived' | 'Arrived' | 'Returned' | 'Delayed'; export const STATUS_TO_STEP: Record = { 'In Preparation': 0, 'Ready for Shipping': 1, 'Shipped': 1, 'Delayed': 1, 'Not Arrived': 2, 'Arrived': 2, 'Returned': 3 }; export const getStatusStepIndex = (status: DewarStatus): number => STATUS_TO_STEP[status]; export const determineIconColor = (iconIndex: number, status: DewarStatus): string => { const statusIndex = getStatusStepIndex(status); if (status === 'Delayed' && iconIndex === 1) { return 'orange'; } return iconIndex <= statusIndex ? (iconIndex === statusIndex ? (status === 'Shipped' ? 'green' : 'blue') : 'green') : 'grey'; };