From b869e9e3ab35f3221aa1f9c77e83d5db1f27b01b Mon Sep 17 00:00:00 2001 From: Sergei Date: Tue, 30 Dec 2025 21:14:24 -0800 Subject: [PATCH] Update subscription, equipment screens and auth flow --- app/(auth)/login.tsx | 59 +- app/(tabs)/beneficiaries/[id]/dashboard.tsx | 579 +++++++++++++++-- app/(tabs)/beneficiaries/[id]/equipment.tsx | 609 ++++++++++++++++++ app/(tabs)/beneficiaries/[id]/index.tsx | 276 ++++---- app/(tabs)/beneficiaries/[id]/share.tsx | 538 ++++++++++------ .../[id]}/subscription.tsx | 149 ++++- app/(tabs)/index.tsx | 61 +- app/(tabs)/profile/index.tsx | 110 +++- app/_layout.tsx | 5 +- components/ProfileDrawer.tsx | 21 +- components/SubscriptionPayment.tsx | 414 ++++++++++++ components/ui/Toast.tsx | 290 ++++++++- contexts/AuthContext.tsx | 2 + package-lock.json | 12 + package.json | 1 + services/api.ts | 159 +++++ 16 files changed, 2798 insertions(+), 487 deletions(-) create mode 100644 app/(tabs)/beneficiaries/[id]/equipment.tsx rename app/(tabs)/{profile => beneficiaries/[id]}/subscription.tsx (77%) create mode 100644 components/SubscriptionPayment.tsx diff --git a/app/(auth)/login.tsx b/app/(auth)/login.tsx index 2eb9684..6c97ae2 100644 --- a/app/(auth)/login.tsx +++ b/app/(auth)/login.tsx @@ -12,13 +12,16 @@ import { ScrollView, StyleSheet, Text, + TouchableOpacity, View, } from 'react-native'; +import { Ionicons } from '@expo/vector-icons'; export default function LoginScreen() { const { checkEmail, requestOtp, isLoading, error, clearError } = useAuth(); const [email, setEmail] = useState(''); const [partnerCode, setPartnerCode] = useState(''); + const [showPartnerCode, setShowPartnerCode] = useState(false); const [validationError, setValidationError] = useState(null); // Clear errors on mount @@ -140,22 +143,33 @@ export default function LoginScreen() { returnKeyType="next" /> - { - // Only allow digits, max 6 - const digits = text.replace(/\D/g, '').slice(0, 6); - setPartnerCode(digits); - }} - keyboardType="number-pad" - maxLength={6} - editable={!isLoading} - onSubmitEditing={handleContinue} - returnKeyType="done" - /> + {/* Partner Code Toggle */} + {!showPartnerCode ? ( + setShowPartnerCode(true)} + > + + I have a partner code + + ) : ( + { + // Only allow digits, max 5 + const code = text.replace(/\D/g, '').slice(0, 5); + setPartnerCode(code); + }} + keyboardType="number-pad" + maxLength={5} + editable={!isLoading} + onSubmitEditing={handleContinue} + returnKeyType="done" + /> + )}