From 97fe8bce644a81003f0bd1e42e970fc5ca1a0229 Mon Sep 17 00:00:00 2001 From: shafi54 <108669266+shafi-aviz@users.noreply.github.com> Date: Sun, 1 Feb 2026 12:09:55 +0530 Subject: [PATCH] enh --- apps/user-ui/app/(auth)/login.tsx | 106 ++++++++--- apps/user-ui/app/(drawer)/(tabs)/me/index.tsx | 9 + .../app/(drawer)/(tabs)/me/terms/index.tsx | 40 ++++ .../user-ui/components/TermsAndConditions.tsx | 177 ++++++++++++++++++ 4 files changed, 311 insertions(+), 21 deletions(-) create mode 100644 apps/user-ui/app/(drawer)/(tabs)/me/terms/index.tsx create mode 100644 apps/user-ui/components/TermsAndConditions.tsx diff --git a/apps/user-ui/app/(auth)/login.tsx b/apps/user-ui/app/(auth)/login.tsx index 0ffc5b1..46eccc9 100644 --- a/apps/user-ui/app/(auth)/login.tsx +++ b/apps/user-ui/app/(auth)/login.tsx @@ -1,11 +1,12 @@ import React, { useState, useEffect, useRef } from "react"; -import { View, Alert, TextInput } from "react-native"; +import { View, Alert, TextInput, ScrollView } from "react-native"; import { useForm, Controller } from "react-hook-form"; -import { MyButton, MyText, MyTextInput, tw, StorageServiceCasual, colors, MyTouchableOpacity } from "common-ui"; +import { MyButton, MyText, MyTextInput, tw, StorageServiceCasual, colors, MyTouchableOpacity, BottomDialog, Checkbox } from "common-ui"; import { useAuth } from "@/src/contexts/AuthContext"; import { trpc } from '@/src/trpc-client'; import GoogleSignInPKCE from "common-ui/src/components/google-sign-in"; +import { TermsAndConditionsContent } from "@/components/TermsAndConditions"; import { LinearGradient } from "expo-linear-gradient"; import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view"; import { SafeAreaView } from "react-native-safe-area-context"; @@ -26,6 +27,10 @@ function Login() { const [otpCells, setOtpCells] = useState(['', '', '', '']); const intervalRef = useRef(null); const inputRefs = useRef<(TextInput | null)[]>([null, null, null, null]); + + // Terms and Conditions state + const [termsAccepted, setTermsAccepted] = useState(true); + const [termsDialogOpen, setTermsDialogOpen] = useState(false); const loginMutation = trpc.user.auth.login.useMutation(); // const loginMutation = useLogin(); @@ -180,6 +185,12 @@ function Login() { const onSubmit = async (data: LoginFormInputs) => { clearErrors(); + // Check if terms are accepted + if (!termsAccepted) { + Alert.alert('Error', 'Please accept the Terms and Conditions to continue'); + return; + } + if (step === 'mobile') { const mobile = data.mobile.trim(); // Validate mobile number @@ -458,29 +469,82 @@ function Login() { )} {(step === 'mobile' || step === 'otp' || step === 'password') && ( - - - {isLoading || sendOtpMutation.isPending || verifyOtpMutation.isPending || loginMutation.isPending - ? (step === 'otp' ? "Verifying..." : step === 'password' ? "Logging in..." : "Processing...") - : (step === 'otp' ? "Verify & Login" : step === 'password' ? "Login" : "Continue")} - - + <> + {/* Terms and Conditions Checkbox */} + + setTermsAccepted(!termsAccepted)} + size={20} + fillColor={colors.brand600} + checkColor="#FFFFFF" + /> + + I agree to the + setTermsDialogOpen(true)}> + Terms and Conditions + + + + + + + {isLoading || sendOtpMutation.isPending || verifyOtpMutation.isPending || loginMutation.isPending + ? (step === 'otp' ? "Verifying..." : step === 'password' ? "Logging in..." : "Processing...") + : (step === 'otp' ? "Verify & Login" : step === 'password' ? "Login" : "Continue")} + + + )} + + {/* Terms and Conditions Dialog */} + setTermsDialogOpen(false)}> + + {/* Handle */} + + + Terms & Conditions + + + + + + + {/* Buttons */} + + setTermsDialogOpen(false)} + fillColor="gray1" + textColor="white1" + style={tw`flex-1 mr-2`} + /> + setTermsDialogOpen(false)} + fillColor="brand600" + textColor="white1" + style={tw`flex-1 ml-2`} + /> + + + ); } diff --git a/apps/user-ui/app/(drawer)/(tabs)/me/index.tsx b/apps/user-ui/app/(drawer)/(tabs)/me/index.tsx index 6798475..3898435 100644 --- a/apps/user-ui/app/(drawer)/(tabs)/me/index.tsx +++ b/apps/user-ui/app/(drawer)/(tabs)/me/index.tsx @@ -79,6 +79,13 @@ export default function Me() { onPress: () => router.push('/(drawer)/(tabs)/me/complaints'), subtitle: 'Talk to our customer care' }, + { + title: 'Terms & Conditions', + icon: 'document-text-outline', + color: '#6B7280', + onPress: () => router.push('/(drawer)/(tabs)/me/terms'), + subtitle: 'Read our legal policies' + }, ] } ]; @@ -157,6 +164,8 @@ export default function Me() { + + ); } \ No newline at end of file diff --git a/apps/user-ui/app/(drawer)/(tabs)/me/terms/index.tsx b/apps/user-ui/app/(drawer)/(tabs)/me/terms/index.tsx new file mode 100644 index 0000000..a8c1c4f --- /dev/null +++ b/apps/user-ui/app/(drawer)/(tabs)/me/terms/index.tsx @@ -0,0 +1,40 @@ +import React from 'react'; +import { View, ScrollView } from 'react-native'; +import { useRouter } from 'expo-router'; +import { AppContainer, MyText, tw, MyTouchableOpacity } from 'common-ui'; +import { Ionicons } from '@expo/vector-icons'; +import { TermsAndConditionsContent } from '@/components/TermsAndConditions'; + +export default function TermsAndConditions() { + const router = useRouter(); + + return ( + + + {/* Header */} + + router.back()} + style={tw`p-2 -ml-2`} + > + + + + Terms & Conditions + + + + {/* Content */} + + + + + + + + ); +} diff --git a/apps/user-ui/components/TermsAndConditions.tsx b/apps/user-ui/components/TermsAndConditions.tsx new file mode 100644 index 0000000..de830dc --- /dev/null +++ b/apps/user-ui/components/TermsAndConditions.tsx @@ -0,0 +1,177 @@ +import React from 'react'; +import { View, ScrollView } from 'react-native'; +import { MyText, tw } from 'common-ui'; + +interface TermsAndConditionsContentProps { + showTitle?: boolean; + compact?: boolean; +} + +export const TermsAndConditionsContent: React.FC = ({ + showTitle = true, + compact = false +}) => { + const textStyle = compact ? tw`text-xs text-gray-600` : tw`text-sm text-gray-600`; + const headingStyle = compact ? tw`text-sm font-bold text-gray-900` : tw`text-base font-bold text-gray-900`; + const subheadingStyle = compact ? tw`text-xs font-semibold text-gray-800` : tw`text-sm font-semibold text-gray-800`; + + return ( + + {showTitle && ( + <> + FRESHYO – Legal Policies + Last Updated: [Add Date] + + + By accessing or using the FRESHYO mobile application ("App"), you agree to the following policies. If you do not agree, please do not use the App. + + + )} + + {/* A. TERMS & CONDITIONS */} + A. TERMS & CONDITIONS + + 1. About FRESHYO + + FRESHYO is a grocery and fresh meat delivery application serving customers only within Mahabubnagar Town, Telangana, India. + + + 2. Eligibility + + Users must be 18 years or older to place orders. By registering, you confirm the accuracy of the information provided. + + + 3. Service Area + + Services are limited strictly to Mahabubnagar Town. Orders outside the service area may be cancelled without notice. + + + 4. Account Registration + + Registration requires a valid mobile number and OTP verification. Users are responsible for all activity under their account. FRESHYO reserves the right to suspend or terminate accounts for misuse. + + + 5. Orders + + Placing an order constitutes an offer to purchase. FRESHYO may accept or reject orders based on availability, pricing errors, or operational reasons. + + + 6. Pricing & Payment + + Prices are displayed in INR and include applicable taxes unless stated otherwise. Only Cash on Delivery (COD) is accepted. Full payment must be made at the time of delivery. Failure to pay may result in order cancellation and account restrictions. + + + 7. Delivery + + Delivery timelines are estimates and may vary. Users must ensure availability at the delivery address. Incorrect address or unavailability may lead to cancellation. + + + 8. Fresh Meat & Perishables + + Fresh meat and perishable items are non-returnable and non-refundable except for: wrong item delivered, spoiled or damaged item at delivery. Issues must be reported within 2 hours with photos. + + + 9. User Conduct + + Users must not: provide false information, abuse staff, misuse the App, or engage in illegal activity. Violations may result in permanent account termination. + + + 10. Intellectual Property + + All content, branding, and app design belong exclusively to FRESHYO. + + + 11. Limitation of Liability + + Liability is limited to the value of the order placed. Product images are indicative only. + + + 12. Force Majeure + + FRESHYO is not liable for delays caused by events beyond reasonable control. + + + 13. Governing Law + + Governed by Indian law. Jurisdiction: Courts of Telangana. + + + {/* B. PRIVACY POLICY */} + B. PRIVACY POLICY + + FRESHYO respects your privacy and is committed to protecting your data. + + + 1. Information We Collect + + Name, mobile number, delivery address, order history, app usage data (basic analytics). + + + 2. How We Use Information + + To process and deliver orders, to communicate order updates, to improve app experience, for customer support. + + + 3. Data Sharing + + Data is shared only with delivery partners for order fulfillment. We do not sell or rent personal data to third parties. + + + 4. Data Security + + We use reasonable security measures to protect your data. However, no system is 100% secure. + + + 5. Data Retention + + Data is retained only as long as necessary for business and legal purposes. + + + 6. User Rights + + Users may request: data correction, account deletion (subject to legal and operational requirements). + + + 7. Children's Privacy + + FRESHYO does not knowingly collect data from users under 18. + + + {/* C. REFUND & CANCELLATION POLICY */} + C. REFUND & CANCELLATION POLICY + + 1. Order Cancellation + + Orders can be cancelled before dispatch. Once dispatched, cancellation may not be allowed, especially for perishables. + + + 2. Refund Policy + + Since payments are Cash on Delivery, refunds (if applicable) will be handled via: cash adjustment, replacement, or store credit (at FRESHYO's discretion). + + + 3. Non-Refundable Items + + Fresh meat and perishable groceries except in cases of damage, spoilage, or wrong delivery. + + + 4. Reporting Issues + + Issues must be reported within 2 hours of delivery. Supporting photos are mandatory. + + + {/* D. CONTACT INFORMATION */} + D. CONTACT INFORMATION + 📧 Email: support@freshyo.in + 📞 Customer Support: 8688182552 + + {/* E. ACCEPTANCE */} + E. ACCEPTANCE + + By registering or placing an order, you confirm that you have read, understood, and agreed to all policies above. + + + ); +}; + +export default TermsAndConditionsContent;