diff --git a/app/(tabs)/beneficiaries/[id]/setup-wifi.tsx b/app/(tabs)/beneficiaries/[id]/setup-wifi.tsx index 61f6e7a..0d2297f 100644 --- a/app/(tabs)/beneficiaries/[id]/setup-wifi.tsx +++ b/app/(tabs)/beneficiaries/[id]/setup-wifi.tsx @@ -433,6 +433,23 @@ export default function SetupWiFiScreen() { router.replace(`/(tabs)/beneficiaries/${id}/equipment` as any); }; + // Retry a single sensor from results screen + const handleRetryFromResults = (deviceId: string) => { + const index = sensors.findIndex(s => s.deviceId === deviceId); + if (index >= 0) { + // Reset the sensor state + setSensors(prev => prev.map(s => + s.deviceId === deviceId + ? { ...s, status: 'pending' as SensorSetupStatus, error: undefined, steps: createInitialSteps() } + : s + )); + setCurrentIndex(index); + setIsPaused(false); + // Go back to batch setup phase + setPhase('batch_setup'); + } + }; + const getSignalStrength = (rssi: number): string => { if (rssi >= -50) return 'Excellent'; if (rssi >= -60) return 'Good'; @@ -507,21 +524,30 @@ export default function SetupWiFiScreen() { Failed {failedSensors.map(sensor => ( - - - - {sensor.deviceName} - {sensor.error && ( - {sensor.error} - )} - {sensor.status === 'skipped' && ( - Skipped - )} + + + + + {sensor.deviceName} + {sensor.error && ( + {sensor.error} + )} + {sensor.status === 'skipped' && ( + Skipped + )} + + handleRetryFromResults(sensor.deviceId)} + > + + Retry + ))} @@ -1039,6 +1065,20 @@ const styles = StyleSheet.create({ paddingVertical: Spacing.xs, gap: Spacing.sm, }, + resultItemWithAction: { + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'space-between', + paddingVertical: Spacing.sm, + borderBottomWidth: 1, + borderBottomColor: AppColors.border, + }, + resultItemLeft: { + flexDirection: 'row', + alignItems: 'flex-start', + flex: 1, + gap: Spacing.sm, + }, resultItemContent: { flex: 1, }, @@ -1052,6 +1092,20 @@ const styles = StyleSheet.create({ color: AppColors.error, marginTop: 2, }, + retryItemButton: { + flexDirection: 'row', + alignItems: 'center', + gap: Spacing.xs, + paddingVertical: Spacing.xs, + paddingHorizontal: Spacing.sm, + backgroundColor: AppColors.primaryLighter, + borderRadius: BorderRadius.md, + }, + retryItemButtonText: { + fontSize: FontSizes.sm, + fontWeight: FontWeights.semibold, + color: AppColors.primary, + }, bottomActions: { padding: Spacing.lg, borderTopWidth: 1,