diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/onboarding/UniversitySelection.tsx | 12 | ||||
-rw-r--r-- | src/screens/onboarding/OnboardingStepThree.tsx | 23 | ||||
-rw-r--r-- | src/types/types.ts | 6 |
3 files changed, 28 insertions, 13 deletions
diff --git a/src/components/onboarding/UniversitySelection.tsx b/src/components/onboarding/UniversitySelection.tsx index 37a95790..8ef013d3 100644 --- a/src/components/onboarding/UniversitySelection.tsx +++ b/src/components/onboarding/UniversitySelection.tsx @@ -1,14 +1,18 @@ -import React, {useState} from 'react'; +import React from 'react'; import {Image, ImageSourcePropType, StyleSheet, Text, View} from 'react-native'; import {TouchableOpacity} from 'react-native-gesture-handler'; +import {UniversityType} from '../../types'; import {normalize} from '../../utils'; interface UniversitySelectionProps { - selected: string; - setSelected: (selected: string) => void; + selected: UniversityType | undefined; + setSelected: (selected: UniversityType) => void; } -const UniversitySelection: React.FC<UniversitySelectionProps> = ({selected, setSelected}) => { +const UniversitySelection: React.FC<UniversitySelectionProps> = ({ + selected, + setSelected, +}) => { const crestData = [ { imagePath: require('../../assets/images/badges/brown_badge.png'), diff --git a/src/screens/onboarding/OnboardingStepThree.tsx b/src/screens/onboarding/OnboardingStepThree.tsx index 120380c1..81f4dc97 100644 --- a/src/screens/onboarding/OnboardingStepThree.tsx +++ b/src/screens/onboarding/OnboardingStepThree.tsx @@ -26,11 +26,12 @@ import { ERROR_SELECT_BIRTHDAY, ERROR_SELECT_CLASS_YEAR, ERROR_SELECT_GENDER, + ERROR_SELECT_UNIVERSITY, ERROR_UPLOAD_SMALL_PROFILE_PIC, } from '../../constants/strings'; import {OnboardingStackParams} from '../../routes/onboarding'; import {patchEditProfile} from '../../services'; -import {BackgroundGradientType} from '../../types'; +import {BackgroundGradientType, UniversityType} from '../../types'; import {normalize, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; type OnboardingStepThreeRouteProp = RouteProp< @@ -52,9 +53,10 @@ const OnboardingStepThree: React.FC<OnboardingStepThreeProps> = ({ }) => { const {userId, username} = route.params; let emptyDate: string | undefined; + let emptyUniversity: UniversityType | undefined; const [form, setForm] = React.useState({ smallPic: '', - university: '', + university: emptyUniversity, birthdate: emptyDate, gender: '', isValidGender: true, @@ -158,7 +160,7 @@ const OnboardingStepThree: React.FC<OnboardingStepThreeProps> = ({ Alert.alert(ERROR_SELECT_CLASS_YEAR); return; } - if (form.university === '') { + if (!form.university) { Alert.alert(ERROR_SELECT_UNIVERSITY); return; } @@ -243,12 +245,15 @@ const OnboardingStepThree: React.FC<OnboardingStepThreeProps> = ({ /> </View> <View style={styles.contentContainer}> - <UniversitySelection selected={form.university} setSelected={(selected) => { - setForm({ - ...form, - university: selected - }) - }}/> + <UniversitySelection + selected={form.university} + setSelected={(selected) => { + setForm({ + ...form, + university: selected, + }); + }} + /> <TaggDropDown onValueChange={(value: string) => handleClassYearUpdate(value)} items={classYearList} diff --git a/src/types/types.ts b/src/types/types.ts index dc2817bd..412d9000 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -21,12 +21,18 @@ export interface CategoryPreviewType { export type FriendshipStatusType = 'friends' | 'requested' | 'no_record'; +export enum UniversityType { + brown = 'Brown', + cornell = 'Cornell', +} + export interface ProfileType { name: string; biography: string; website: string; gender: string; university_class: number; + university: UniversityType | undefined; profile_completion_stage: number; suggested_people_linked: number; birthday: Date | undefined; |