From 2545aec4852d0e4cb72b4fadcaf16e56a7488433 Mon Sep 17 00:00:00 2001 From: Sergei Date: Mon, 29 Dec 2025 15:48:19 -0800 Subject: [PATCH] Add equipment status workflow to beneficiary cards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - BeneficiaryCard now shows equipment status badges (ordered/shipped/delivered) - Added AwaitingEquipmentScreen with progress tracker - "I received my kit" button to mark as delivered - "Activate" button when equipment is delivered - Fixed address field height in add-loved-one form 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/(auth)/add-loved-one.tsx | 18 +- app/(tabs)/beneficiaries/[id]/index.tsx | 260 +++++++++++++++++++++++- app/(tabs)/index.tsx | 124 +++++++++-- 3 files changed, 373 insertions(+), 29 deletions(-) diff --git a/app/(auth)/add-loved-one.tsx b/app/(auth)/add-loved-one.tsx index 9cf23c6..ea6f61d 100644 --- a/app/(auth)/add-loved-one.tsx +++ b/app/(auth)/add-loved-one.tsx @@ -184,16 +184,14 @@ export default function AddLovedOneScreen() { Address (optional) - - + + @@ -327,16 +325,6 @@ const styles = StyleSheet.create({ paddingVertical: Spacing.md, marginLeft: Spacing.sm, }, - addressInput: { - alignItems: 'flex-start', - }, - addressIcon: { - marginTop: Spacing.md, - }, - addressTextInput: { - minHeight: 60, - textAlignVertical: 'top', - }, buttonContainer: { marginTop: Spacing.md, }, diff --git a/app/(tabs)/beneficiaries/[id]/index.tsx b/app/(tabs)/beneficiaries/[id]/index.tsx index b2e4217..03e1cc9 100644 --- a/app/(tabs)/beneficiaries/[id]/index.tsx +++ b/app/(tabs)/beneficiaries/[id]/index.tsx @@ -41,7 +41,7 @@ const isLocalBeneficiary = (id: string | number): boolean => { }; // Setup state types -type SetupState = 'loading' | 'no_devices' | 'no_subscription' | 'ready'; +type SetupState = 'loading' | 'awaiting_equipment' | 'no_devices' | 'no_subscription' | 'ready'; // No Devices Screen Component function NoDevicesScreen({ @@ -162,6 +162,133 @@ function NoSubscriptionScreen({ ); } +// Equipment status configuration +const equipmentStatusInfo = { + ordered: { + icon: 'cube-outline' as const, + title: 'Kit Ordered', + subtitle: 'Your WellNuo kit is being prepared for shipping', + color: AppColors.info, + bgColor: AppColors.infoLight, + steps: [ + { label: 'Order placed', done: true }, + { label: 'Preparing', done: true }, + { label: 'Shipped', done: false }, + { label: 'Delivered', done: false }, + ], + }, + shipped: { + icon: 'car-outline' as const, + title: 'In Transit', + subtitle: 'Your WellNuo kit is on its way', + color: AppColors.warning, + bgColor: AppColors.warningLight, + steps: [ + { label: 'Order placed', done: true }, + { label: 'Preparing', done: true }, + { label: 'Shipped', done: true }, + { label: 'Delivered', done: false }, + ], + }, + delivered: { + icon: 'checkmark-circle-outline' as const, + title: 'Delivered', + subtitle: 'Your kit has arrived! Time to set it up.', + color: AppColors.success, + bgColor: AppColors.successLight, + steps: [ + { label: 'Order placed', done: true }, + { label: 'Preparing', done: true }, + { label: 'Shipped', done: true }, + { label: 'Delivered', done: true }, + ], + }, +}; + +// Awaiting Equipment Screen Component +function AwaitingEquipmentScreen({ + beneficiary, + onActivate, + onMarkReceived, +}: { + beneficiary: Beneficiary; + onActivate: () => void; + onMarkReceived: () => void; +}) { + const status = beneficiary.equipmentStatus as 'ordered' | 'shipped' | 'delivered'; + const info = equipmentStatusInfo[status] || equipmentStatusInfo.ordered; + const isDelivered = status === 'delivered'; + + return ( + + + + + {info.title} + {info.subtitle} + + {/* Progress steps */} + + {info.steps.map((step, index) => ( + + + {step.done && ( + + )} + + + {step.label} + + {index < info.steps.length - 1 && ( + + )} + + ))} + + + {/* Tracking number if available */} + {beneficiary.trackingNumber && ( + + + + Tracking Number + {beneficiary.trackingNumber} + + + )} + + {/* Actions */} + + {isDelivered ? ( +