-
Notifications
You must be signed in to change notification settings - Fork 1
Fix some routing issues #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1415857
a850e24
a17c12d
5a1bee5
c2895fa
90463f1
ee4b197
8887534
a578c21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,13 @@ | ||
| import * as SplashScreen from 'expo-splash-screen'; | ||
| import { Stack } from 'expo-router'; | ||
| import { useEffect } from 'react'; | ||
| import { NotificationsProvider } from '../contexts/NotificationsContext'; | ||
|
|
||
| export default function AuthLayout() { | ||
| useEffect(() => { | ||
| SplashScreen.hideAsync(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a super minor thing, since
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think keeping it as is should be ok
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah sounds good |
||
| }, []); | ||
|
|
||
| return ( | ||
| <NotificationsProvider> | ||
| <Stack | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,6 @@ import DeleteAccountSheet from '@/app/components/ui/DeleteAccountSheet'; | |
| import ListItem from '@/app/components/ui/ListItem'; | ||
| import ListItemWrapper from '@/app/components/ui/ListItemWrapper'; | ||
| import SignOutSheet from '@/app/components/ui/SignOutSheet'; | ||
| import { router } from 'expo-router'; | ||
| import { LogOut, Pencil, Trash2 } from 'lucide-react-native'; | ||
| import React, { useEffect, useState } from 'react'; | ||
| import { Alert, ScrollView, StatusBar, StyleSheet, View } from 'react-native'; | ||
|
|
@@ -62,13 +61,12 @@ export default function AccountSettingsPage() { | |
| await signOutUser(); | ||
| console.log('Sign out successful'); | ||
| setShowSignOutSheet(false); | ||
| router.replace('/home' as any); | ||
| } catch (error) { | ||
| console.error('Sign out error:', error); | ||
| Alert.alert( | ||
| 'Error', | ||
| 'Failed to sign out: ' + | ||
| (error instanceof Error ? error.message : 'Unknown error') | ||
| (error instanceof Error ? error.message : 'Unknown error') | ||
| ); | ||
| } | ||
| }; | ||
|
|
@@ -111,15 +109,13 @@ export default function AccountSettingsPage() { | |
| await signOutUser(); | ||
| setShowDeleteSheet(false); | ||
| setIsDeleting(false); | ||
|
|
||
| router.replace('/home' as any); | ||
| } catch (error) { | ||
| console.error('Delete account error:', error); | ||
| setIsDeleting(false); | ||
| Alert.alert( | ||
| 'Error', | ||
| 'Failed to delete account: ' + | ||
| (error instanceof Error ? error.message : 'Unknown error') | ||
| (error instanceof Error ? error.message : 'Unknown error') | ||
| ); | ||
| } | ||
| }; | ||
|
|
@@ -157,7 +153,7 @@ export default function AccountSettingsPage() { | |
| iconLeft={Pencil} | ||
| variant="secondary" | ||
| title="Cannot change email address" | ||
| onPress={() => {}} | ||
| onPress={() => { }} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was looking at this email address section where we have the empty Perhaps instead of a clickable row, we could just display their email as static text, maybe with a little gray subtitle underneath saying 'Email cannot be changed'? I think that might make the UI feel a bit more intuitive. If it's not too hard to swap out, I think that would be a good UX polish.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's true; this is a remnant from when we were discussing not tying it NetIDs
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will defer to @clementroze on this
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah let me know what clement say about this, we can add that to the next PR thing if needs to be fixed
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i dont think it looks or feels like a clickable button because its disabeld (muted + gray) and there are no press states (bc of the i think we should still keep it bc its typical to be able to change your email in apps. Since we dont allow it because we have a special sign in with Cornell SSO case, we should still show which email they're signed in on for visibility. i also think we should follow the pattern of rather still showing something, but making it disabled, rather than just hiding or removing it completely lmk what yall think |
||
| /> | ||
| </ListItemWrapper> | ||
| </View> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,12 +44,13 @@ import PromptSelector from '../components/onboarding/PromptSelector'; | |
| import AppInput from '../components/ui/AppInput'; | ||
| import AppText from '../components/ui/AppText'; | ||
| import Button from '../components/ui/Button'; | ||
| import CityAutocomplete from '../components/ui/CityAutocomplete'; | ||
| import ListItem from '../components/ui/ListItem'; | ||
| import ListItemWrapper from '../components/ui/ListItemWrapper'; | ||
| import CityAutocomplete from '../components/ui/CityAutocomplete'; | ||
| import SearchableDropdown from '../components/ui/SearchableDropdown'; | ||
| import Sheet from '../components/ui/Sheet'; | ||
| import Tag from '../components/ui/Tag'; | ||
| import { useProfile } from '../contexts/ProfileContext'; | ||
| import { useThemeAware } from '../contexts/ThemeContext'; | ||
| import { useHapticFeedback } from '../hooks/useHapticFeedback'; | ||
| import { useOnboardingState } from '../hooks/useOnboardingState'; | ||
|
|
@@ -157,6 +158,7 @@ function DraggablePromptSelector({ | |
| export default function CreateProfileScreen() { | ||
| useThemeAware(); // Force re-render when theme changes | ||
| const haptic = useHapticFeedback(); | ||
| const { refreshProfile } = useProfile(); | ||
|
|
||
| const [currentStep, setCurrentStep] = useState(2); // Start at step 2 | ||
| const [direction, setDirection] = useState<'forward' | 'backward'>('forward'); | ||
|
|
@@ -204,7 +206,7 @@ export default function CreateProfileScreen() { | |
| useNativeDriver: true, | ||
| }), | ||
| ]).start(); | ||
| }, [currentStep]); | ||
| }, [currentStep, direction, slideAnim, fadeAnim]); | ||
|
|
||
| if (!isLoaded) { | ||
| return null; // Wait for AsyncStorage to load | ||
|
|
@@ -376,6 +378,8 @@ export default function CreateProfileScreen() { | |
| console.error('Failed to save preferences:', prefError); | ||
| } | ||
|
|
||
| await refreshProfile(); | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Awesome catch adding await refreshProfile() here before routing! This is a great way to prevent any weird split-second loading glitches or stale data. |
||
| // Clear storage and navigate to main app | ||
| await clearStorage(); | ||
| router.replace('/(auth)/(tabs)' as any); | ||
|
|
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice fix here to avoid route the user twice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yipee