Skip to content
Merged

UI #33

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
61 changes: 58 additions & 3 deletions app/app/(auth)/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import React, { useEffect, useRef, useState } from 'react';
import { CustomAlertModal } from '@/components/profile/CustomAlertModal';
import {
Alert,

Check warning on line 8 in app/app/(auth)/login.tsx

View workflow job for this annotation

GitHub Actions / ESLint Check

'Alert' is defined but never used
Animated,
Dimensions,
KeyboardAvoidingView,
Expand All @@ -22,9 +22,9 @@
import { useAuthStore } from '@/store/auth.store';
import { signUp, signIn, signInWithGoogle } from '@/services/auth.service';

const { width, height } = Dimensions.get('window');

Check warning on line 25 in app/app/(auth)/login.tsx

View workflow job for this annotation

GitHub Actions / ESLint Check

'width' is assigned a value but never used

// ── Design tokens — same palette as the rest of Swasthya AI ──────────────────
// ── Design tokens ──────────────────────────────────────────────────────────────
const C = {
primary: '#0474FC',
primaryDark: '#0355C5',
Expand Down Expand Up @@ -81,7 +81,7 @@
toValue: focused ? 1 : 0,
tension: 60, friction: 8, useNativeDriver: false,
}).start();
}, [focused]);

Check warning on line 84 in app/app/(auth)/login.tsx

View workflow job for this annotation

GitHub Actions / ESLint Check

React Hook useEffect has a missing dependency: 'borderAnim'. Either include it or remove the dependency array

const borderColor = borderAnim.interpolate({
inputRange: [0, 1],
Expand Down Expand Up @@ -231,7 +231,7 @@
]).start();
floatOrb(orb1, 0);
floatOrb(orb2, 1800);
}, []);

Check warning on line 234 in app/app/(auth)/login.tsx

View workflow job for this annotation

GitHub Actions / ESLint Check

React Hook useEffect has missing dependencies: 'fadeAnim', 'orb1', 'orb2', and 'slideAnim'. Either include them or remove the dependency array

// Tab slide animation
const slideTab = (newTab: 'signin' | 'signup') => {
Expand Down Expand Up @@ -278,6 +278,7 @@

// ── Handlers ─────────────────────────────────────────────────────────────────
const handleSignIn = async () => {
if (loading) return;
if (!validateSignIn()) return;
setLoading(true);
try {
Expand All @@ -304,6 +305,7 @@
};

const handleSignUp = async () => {
if (loading) return;
if (!validateSignUp()) return;
setLoading(true);
try {
Expand All @@ -315,7 +317,6 @@
isLoggedIn: true,
hasProfile: false,
hasFamilyGroup: false,
onboardingComplete: false,
});
router.replace('/');
} catch (e: any) {
Expand All @@ -326,11 +327,12 @@
};

const handleGoogle = async () => {
if (loading) return;
setLoading(true);
try {
const result = await signInWithGoogle();
if (result && result.user) {
const { getPatientById } = require('@/services/auth.service');

Check warning on line 335 in app/app/(auth)/login.tsx

View workflow job for this annotation

GitHub Actions / ESLint Check

A `require()` style import is forbidden
const dbPatient = await getPatientById(result.user.id);
setSessionState({
userId: result.user.id,
Expand All @@ -349,6 +351,21 @@
}
};

// ── Skip Handler ────────────────────────────────────────────────────────────
const handleSkip = () => {
setSessionState({
userId: 'skip-user-123',
patientId: 'skip-patient-123',
phoneNumber: '+91 9324474812',
isLoggedIn: true,
hasProfile: false,
hasFamilyGroup: false,
isHydrated: true,
hasShownIntro: true,
});
router.replace('/(onboarding)/family-setup');
};

// ── Render ───────────────────────────────────────────────────────────────────
return (
<View style={s.root}>
Expand All @@ -363,6 +380,18 @@
<Animated.View style={[s.orb, s.orb1, { transform: [{ translateY: orb1Y }, { scale: orb1S }] }]} />
<Animated.View style={[s.orb, s.orb2, { transform: [{ translateY: orb2Y }, { scale: orb2S }] }]} />

{/* Skip Button */}
<TouchableOpacity style={s.skipButton} onPress={handleSkip} activeOpacity={0.8}>
<LinearGradient
colors={['#10B981', '#059669']}
start={{ x: 0, y: 0 }}
end={{ x: 1, y: 1 }}
style={s.skipButtonGradient}
>
<Text style={s.skipButtonText}>Skip →</Text>
</LinearGradient>
</TouchableOpacity>

<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
style={{ flex: 1 }}
Expand Down Expand Up @@ -641,6 +670,32 @@
minHeight: height,
},

// Skip Button
skipButton: {
position: 'absolute',
top: Platform.OS === 'ios' ? 50 : 30,
right: 20,
zIndex: 100,
borderRadius: 12,
overflow: 'hidden',
shadowColor: '#10B981',
shadowOffset: { width: 0, height: 4 },
shadowOpacity: 0.25,
shadowRadius: 8,
elevation: 5,
},
skipButtonGradient: {
paddingHorizontal: 18,
paddingVertical: 10,
borderRadius: 12,
},
skipButtonText: {
fontFamily: FONT.semibold,
fontSize: 14,
color: '#FFFFFF',
letterSpacing: 0.5,
},

// Orbs
orb: { position: 'absolute', borderRadius: 999, opacity: 0.18 },
orb1: {
Expand Down Expand Up @@ -803,4 +858,4 @@
fontSize: 12,
color: C.primary,
},
});
});
Loading
Loading