diff options
Diffstat (limited to 'src/screens')
| -rw-r--r-- | src/screens/onboarding/InvitationCodeVerification.tsx | 13 | ||||
| -rw-r--r-- | src/screens/onboarding/Login.tsx | 2 | ||||
| -rw-r--r-- | src/screens/onboarding/PasswordResetRequest.tsx | 3 | ||||
| -rw-r--r-- | src/screens/onboarding/PasswordVerification.tsx (renamed from src/screens/onboarding/Verification.tsx) | 91 | ||||
| -rw-r--r-- | src/screens/onboarding/UpdateRequired.tsx | 84 | ||||
| -rw-r--r-- | src/screens/onboarding/index.ts | 25 | ||||
| -rw-r--r-- | src/screens/onboarding/legacy/AddWaitlistUserScreen.tsx (renamed from src/screens/onboarding/AddWaitlistUserScreen.tsx) | 0 | ||||
| -rw-r--r-- | src/screens/onboarding/legacy/Checkpoint.tsx (renamed from src/screens/onboarding/Checkpoint.tsx) | 17 | ||||
| -rw-r--r-- | src/screens/onboarding/legacy/ProfileOnboarding.tsx (renamed from src/screens/onboarding/ProfileOnboarding.tsx) | 12 | ||||
| -rw-r--r-- | src/screens/onboarding/legacy/RegistrationOne.tsx (renamed from src/screens/onboarding/RegistrationOne.tsx) | 37 | ||||
| -rw-r--r-- | src/screens/onboarding/legacy/RegistrationThree.tsx (renamed from src/screens/onboarding/RegistrationThree.tsx) | 26 | ||||
| -rw-r--r-- | src/screens/onboarding/legacy/RegistrationTwo.tsx (renamed from src/screens/onboarding/RegistrationTwo.tsx) | 23 | ||||
| -rw-r--r-- | src/screens/onboarding/legacy/SocialMedia.tsx (renamed from src/screens/onboarding/SocialMedia.tsx) | 17 | ||||
| -rw-r--r-- | src/screens/onboarding/legacy/TaggPopup.tsx | 143 | ||||
| -rw-r--r-- | src/screens/onboarding/legacy/WaitlistSuccessScreen.tsx (renamed from src/screens/onboarding/WaitlistSuccessScreen.tsx) | 10 | ||||
| -rw-r--r-- | src/screens/profile/CategorySelection.tsx (renamed from src/screens/onboarding/CategorySelection.tsx) | 106 | ||||
| -rw-r--r-- | src/screens/profile/CreateCustomCategory.tsx (renamed from src/screens/onboarding/CreateCustomCategory.tsx) | 8 | ||||
| -rw-r--r-- | src/screens/profile/index.ts | 2 |
18 files changed, 269 insertions, 350 deletions
diff --git a/src/screens/onboarding/InvitationCodeVerification.tsx b/src/screens/onboarding/InvitationCodeVerification.tsx index 6bc0ac9d..d84b2ba2 100644 --- a/src/screens/onboarding/InvitationCodeVerification.tsx +++ b/src/screens/onboarding/InvitationCodeVerification.tsx @@ -1,7 +1,7 @@ import AsyncStorage from '@react-native-community/async-storage'; import {RouteProp} from '@react-navigation/native'; import {StackNavigationProp} from '@react-navigation/stack'; -import React, {useContext} from 'react'; +import React from 'react'; import {Alert, KeyboardAvoidingView, StyleSheet, View} from 'react-native'; import {Text} from 'react-native-animatable'; import { @@ -27,7 +27,6 @@ import { import {OnboardingStackParams} from '../../routes'; import {BackgroundGradientType} from '../../types'; import {SCREEN_WIDTH, userLogin} from '../../utils'; -import {ChatContext} from '../../App'; type InvitationCodeVerificationRouteProp = RouteProp< OnboardingStackParams, @@ -59,7 +58,6 @@ const InvitationCodeVerification: React.FC<InvitationCodeVerificationProps> = ({ setValue, }); const dispatch = useDispatch(); - const {chatClient} = useContext(ChatContext); const handleInvitationCodeVerification = async () => { if (value.length === 6) { @@ -200,10 +198,6 @@ const styles = StyleSheet.create({ flexDirection: 'row', justifyContent: 'space-around', }, - noInviteCode: { - flexDirection: 'row', - justifyContent: 'center', - }, youveBeenAddedLabel: { marginVertical: '5%', width: SCREEN_WIDTH * 0.8, @@ -213,11 +207,6 @@ const styles = StyleSheet.create({ fontWeight: '500', marginBottom: '10%', }, - inviteCodeLink: { - color: 'white', - fontSize: 18, - textDecorationLine: 'underline', - }, }); export default InvitationCodeVerification; diff --git a/src/screens/onboarding/Login.tsx b/src/screens/onboarding/Login.tsx index 6d9abf82..041fba05 100644 --- a/src/screens/onboarding/Login.tsx +++ b/src/screens/onboarding/Login.tsx @@ -30,7 +30,7 @@ import {fcmService} from '../../services'; import {RootState} from '../../store/rootReducer'; import {BackgroundGradientType, UniversityType} from '../../types'; import {connectChatAccount, normalize, userLogin} from '../../utils'; -import UpdateRequired from './UpdateRequired'; +import UpdateRequired from '../../components/onboarding/UpdateRequired'; type VerificationScreenRouteProp = RouteProp<OnboardingStackParams, 'Login'>; type VerificationScreenNavigationProp = StackNavigationProp< diff --git a/src/screens/onboarding/PasswordResetRequest.tsx b/src/screens/onboarding/PasswordResetRequest.tsx index a63eae81..8a891bbb 100644 --- a/src/screens/onboarding/PasswordResetRequest.tsx +++ b/src/screens/onboarding/PasswordResetRequest.tsx @@ -74,9 +74,8 @@ const PasswordResetRequest: React.FC<PasswordResetRequestProps> = ({ handlePasswordResetRequest(form.value), ); if (success) { - navigation.navigate('Verification', { + navigation.navigate('PasswordVerification', { id: form.value, - screenType: VerificationScreenType.Password, }); } } else { diff --git a/src/screens/onboarding/Verification.tsx b/src/screens/onboarding/PasswordVerification.tsx index dda18364..6bda37a7 100644 --- a/src/screens/onboarding/Verification.tsx +++ b/src/screens/onboarding/PasswordVerification.tsx @@ -21,7 +21,6 @@ import { ArrowButton, Background, LoadingIndicator, - RegistrationWizard, SubmitButton, } from '../../components'; import {codeRegex} from '../../constants'; @@ -33,18 +32,16 @@ import {OnboardingStackParams} from '../../routes'; import { handlePasswordCodeVerification, handlePasswordResetRequest, - sendOtp, - verifyOtp, } from '../../services'; -import {BackgroundGradientType, VerificationScreenType} from '../../types'; +import {BackgroundGradientType} from '../../types'; type VerificationScreenRouteProp = RouteProp< OnboardingStackParams, - 'Verification' + 'PasswordVerification' >; type VerificationScreenNavigationProp = StackNavigationProp< OnboardingStackParams, - 'Verification' + 'PasswordVerification' >; interface VerificationProps { route: VerificationScreenRouteProp; @@ -58,39 +55,16 @@ const Verification: React.FC<VerificationProps> = ({route, navigation}) => { value, setValue, }); - const {id, screenType} = route.params; - const isPhoneVerification = screenType === VerificationScreenType.Phone; + const {id} = route.params; - const handlePhoneVerification = async () => { - const success = await trackPromise(verifyOtp(id, value)); - if (success) { - navigation.navigate('RegistrationTwo', {phone: id}); - } - }; - - const handlePasswordVerification = async () => { - const success = await trackPromise( - handlePasswordCodeVerification(id, value), - ); - if (success) { - navigation.navigate('PasswordReset', {value: id}); - } - }; - - /** - * Sends the verify_otp request upon tapping the Verify button. - * If successful, it navigates to the respected page. - */ const handleVerification = async () => { if (codeRegex.test(value)) { try { - switch (screenType) { - case VerificationScreenType.Phone: - handlePhoneVerification(); - break; - case VerificationScreenType.Password: - handlePasswordVerification(); - break; + const success = await trackPromise( + handlePasswordCodeVerification(id, value), + ); + if (success) { + navigation.navigate('PasswordReset', {value: id}); } } catch (error) { console.log(error); @@ -106,34 +80,19 @@ const Verification: React.FC<VerificationProps> = ({route, navigation}) => { */ const handleResend = async () => { try { - switch (screenType) { - case VerificationScreenType.Phone: - trackPromise(sendOtp(id)); - break; - case VerificationScreenType.Password: - trackPromise(handlePasswordResetRequest(id)); - break; - } + trackPromise(handlePasswordResetRequest(id)); } catch (error) { console.log(error); Alert.alert(ERROR_SOMETHING_WENT_WRONG); } }; - const handleGoBack = () => { - switch (screenType) { - case VerificationScreenType.Phone: - navigation.navigate('RegistrationOne'); - break; - case VerificationScreenType.Password: - navigation.navigate('PasswordResetRequest'); - break; - } - }; - const Footer = () => ( <View style={styles.footer}> - <ArrowButton direction="backward" onPress={() => handleGoBack()} /> + <ArrowButton + direction="backward" + onPress={() => navigation.navigate('PasswordResetRequest')} + /> </View> ); @@ -142,16 +101,9 @@ const Verification: React.FC<VerificationProps> = ({route, navigation}) => { centered style={styles.container} gradientType={BackgroundGradientType.Light}> - {isPhoneVerification ? ( - <RegistrationWizard style={styles.wizard} step="three" /> - ) : ( - <React.Fragment /> - )} <KeyboardAvoidingView behavior="padding" - style={ - isPhoneVerification ? styles.form : styles.formPasswordVerification - }> + style={styles.formPasswordVerification}> <Text style={styles.formHeader}>Enter 6 digit code</Text> <Text style={styles.description}> We sent a 6 digit verification code to the phone number you provided. @@ -200,16 +152,6 @@ const styles = StyleSheet.create({ alignItems: 'center', justifyContent: 'center', }, - wizard: { - marginTop: '3.5%', - flex: 1, - justifyContent: 'center', - }, - form: { - alignItems: 'center', - justifyContent: 'flex-start', - flex: 3, - }, formPasswordVerification: { alignItems: 'center', justifyContent: 'flex-start', @@ -261,9 +203,6 @@ const styles = StyleSheet.create({ button: { marginVertical: '5%', }, - loadingIndicator: { - marginVertical: '5%', - }, footer: { width: '100%', flexDirection: 'row', diff --git a/src/screens/onboarding/UpdateRequired.tsx b/src/screens/onboarding/UpdateRequired.tsx deleted file mode 100644 index adf7ba71..00000000 --- a/src/screens/onboarding/UpdateRequired.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import React from 'react'; -import {Image, Linking, Modal, StyleSheet, View} from 'react-native'; -import {Text} from 'react-native-animatable'; -import {CenteredView, TaggSquareButton} from '../../components'; -import {normalize, SCREEN_WIDTH} from '../../utils'; - -interface UpdateRequiredProps { - visible: boolean; -} - -const UpdateRequired: React.FC<UpdateRequiredProps> = ({visible}) => { - return ( - <Modal animationType={'slide'} transparent={true} visible={visible}> - <CenteredView> - <View style={styles.contentContainer}> - <Image - style={styles.logo} - source={require('../../assets/images/logo-purple.png')} - /> - <Text style={styles.header}>Update Required</Text> - <Text style={styles.body}> - You have to update your app to continue using Tagg, please download - the latest version from the app store - </Text> - <TaggSquareButton - title={'Update'} - onPress={() => { - Linking.openURL( - 'https://apps.apple.com/us/app/tagg-discover-your-community/id1537853613', - ); - }} - buttonStyle={'normal'} - buttonColor={'purple'} - labelColor={'white'} - labelStyle={styles.button} - /> - </View> - </CenteredView> - </Modal> - ); -}; - -const styles = StyleSheet.create({ - contentContainer: { - marginTop: '20%', - width: SCREEN_WIDTH * 0.9, - backgroundColor: 'white', - borderRadius: 5, - padding: '10%', - alignItems: 'center', - shadowColor: '#000', - shadowOffset: { - width: 0, - height: 2, - }, - shadowOpacity: 0.25, - shadowRadius: 3.84, - elevation: 5, - }, - logo: { - width: normalize(60), - height: normalize(60), - marginBottom: '10%', - }, - header: { - fontSize: normalize(17), - fontWeight: '700', - lineHeight: 20, - marginBottom: '5%', - }, - body: { - fontSize: normalize(13), - color: 'grey', - lineHeight: 20, - textAlign: 'center', - width: SCREEN_WIDTH * 0.8, - marginBottom: '10%', - }, - button: { - fontWeight: '700', - }, -}); - -export default UpdateRequired; diff --git a/src/screens/onboarding/index.ts b/src/screens/onboarding/index.ts index 49d7cfb9..7eb0587f 100644 --- a/src/screens/onboarding/index.ts +++ b/src/screens/onboarding/index.ts @@ -1,21 +1,10 @@ -export {default as Login} from './Login'; -export {default as RegistrationOne} from './RegistrationOne'; -export {default as RegistrationTwo} from './RegistrationTwo'; -export {default as RegistrationThree} from './RegistrationThree'; -export {default as Verification} from './Verification'; -export {default as Checkpoint} from './Checkpoint'; -export {default as ProfileOnboarding} from './ProfileOnboarding'; export {default as InvitationCodeVerification} from './InvitationCodeVerification'; -export {default as SocialMedia} from './SocialMedia'; -export {default as PasswordResetRequest} from './PasswordResetRequest'; -export {default as PasswordReset} from './PasswordReset'; -export {default as WelcomeScreen} from './WelcomeScreen'; -export {default as CategorySelection} from './CategorySelection'; -export {default as AddWaitlistUserScreen} from './AddWaitlistUserScreen'; -export {default as WaitlistSuccessScreen} from './WaitlistSuccessScreen'; -export {default as CreateCustomCategory} from './CreateCustomCategory'; -export {default as UpdateRequired} from './UpdateRequired'; +export {default as Login} from './Login'; export {default as OnboardingStepOne} from './OnboardingStepOne'; -export {default as PhoneVerification} from './PhoneVerification'; -export {default as OnboardingStepTwo} from './OnboardingStepTwo'; export {default as OnboardingStepThree} from './OnboardingStepThree'; +export {default as OnboardingStepTwo} from './OnboardingStepTwo'; +export {default as PasswordReset} from './PasswordReset'; +export {default as PasswordResetRequest} from './PasswordResetRequest'; +export {default as PhoneVerification} from './PhoneVerification'; +export {default as PasswordVerification} from './PasswordVerification'; +export {default as WelcomeScreen} from './WelcomeScreen'; diff --git a/src/screens/onboarding/AddWaitlistUserScreen.tsx b/src/screens/onboarding/legacy/AddWaitlistUserScreen.tsx index 489c30f1..489c30f1 100644 --- a/src/screens/onboarding/AddWaitlistUserScreen.tsx +++ b/src/screens/onboarding/legacy/AddWaitlistUserScreen.tsx diff --git a/src/screens/onboarding/Checkpoint.tsx b/src/screens/onboarding/legacy/Checkpoint.tsx index b0b42203..93ff0b7f 100644 --- a/src/screens/onboarding/Checkpoint.tsx +++ b/src/screens/onboarding/legacy/Checkpoint.tsx @@ -1,18 +1,17 @@ -import React from 'react'; import {RouteProp} from '@react-navigation/native'; import {StackNavigationProp} from '@react-navigation/stack'; +import React from 'react'; import { - View, - Text, - StyleSheet, - StatusBar, Platform, + StatusBar, + StyleSheet, + Text, TouchableOpacity, + View, } from 'react-native'; - -import {OnboardingStackParams} from '../../routes'; -import {RegistrationWizard, Background} from '../../components'; -import {BackgroundGradientType} from '../../types'; +import {Background, RegistrationWizard} from '../../../components'; +import {OnboardingStackParams} from '../../../routes'; +import {BackgroundGradientType} from '../../../types'; type CheckpointRouteProp = RouteProp<OnboardingStackParams, 'Checkpoint'>; type CheckpointNavigationProp = StackNavigationProp< diff --git a/src/screens/onboarding/ProfileOnboarding.tsx b/src/screens/onboarding/legacy/ProfileOnboarding.tsx index c173c8e3..bf0863dc 100644 --- a/src/screens/onboarding/ProfileOnboarding.tsx +++ b/src/screens/onboarding/legacy/ProfileOnboarding.tsx @@ -20,7 +20,7 @@ import { TaggBigInput, TaggDropDown, TaggInput, -} from '../../components'; +} from '../../../components'; import { bioRegex, CLASS_YEAR_LIST, @@ -28,7 +28,7 @@ import { genderRegex, TAGG_PURPLE, websiteRegex, -} from '../../constants'; +} from '../../../constants'; import { ERROR_DOUBLE_CHECK_CONNECTION, ERROR_PROFILE_CREATION_SHORT, @@ -36,10 +36,10 @@ import { ERROR_SOMETHING_WENT_WRONG_REFRESH, ERROR_UPLOAD_LARGE_PROFILE_PIC, ERROR_UPLOAD_SMALL_PROFILE_PIC, -} from '../../constants/strings'; -import {OnboardingStackParams} from '../../routes/onboarding'; -import {BackgroundGradientType} from '../../types'; -import {SCREEN_WIDTH} from '../../utils'; +} from '../../../constants/strings'; +import {OnboardingStackParams} from '../../../routes/onboarding'; +import {BackgroundGradientType} from '../../../types'; +import {SCREEN_WIDTH} from '../../../utils'; type ProfileOnboardingScreenRouteProp = RouteProp< OnboardingStackParams, diff --git a/src/screens/onboarding/RegistrationOne.tsx b/src/screens/onboarding/legacy/RegistrationOne.tsx index c9822f76..4bcc2720 100644 --- a/src/screens/onboarding/RegistrationOne.tsx +++ b/src/screens/onboarding/legacy/RegistrationOne.tsx @@ -1,34 +1,31 @@ -import React, {useState, useRef} from 'react'; import {RouteProp} from '@react-navigation/native'; import {StackNavigationProp} from '@react-navigation/stack'; +import React, {useRef, useState} from 'react'; import { - View, - Text, - StyleSheet, - StatusBar, Alert, + KeyboardAvoidingView, Platform, + StatusBar, + StyleSheet, + Text, TouchableOpacity, - KeyboardAvoidingView, + View, } from 'react-native'; - -import {OnboardingStackParams} from '../../routes'; - +import {trackPromise} from 'react-promise-tracker'; import { ArrowButton, - RegistrationWizard, - TaggInput, Background, LoadingIndicator, -} from '../../components'; - -import {trackPromise} from 'react-promise-tracker'; - -import {SEND_OTP_ENDPOINT} from '../../constants'; - -import {phoneRegex} from '../../constants'; -import {BackgroundGradientType, VerificationScreenType} from '../../types'; -import {ERROR_EMAIL_IN_USE, ERROR_SERVER_DOWN} from '../../constants/strings'; + RegistrationWizard, + TaggInput, +} from '../../../components'; +import {phoneRegex, SEND_OTP_ENDPOINT} from '../../../constants'; +import { + ERROR_EMAIL_IN_USE, + ERROR_SERVER_DOWN, +} from '../../../constants/strings'; +import {OnboardingStackParams} from '../../../routes'; +import {BackgroundGradientType, VerificationScreenType} from '../../../types'; type RegistrationScreenOneRouteProp = RouteProp< OnboardingStackParams, diff --git a/src/screens/onboarding/RegistrationThree.tsx b/src/screens/onboarding/legacy/RegistrationThree.tsx index 03348e6b..1f4266ff 100644 --- a/src/screens/onboarding/RegistrationThree.tsx +++ b/src/screens/onboarding/legacy/RegistrationThree.tsx @@ -3,38 +3,36 @@ * Purpose : Add a new screen to allow the user to enter first and last name */ -import React, {useState, useRef} from 'react'; +import AsyncStorage from '@react-native-community/async-storage'; import {RouteProp} from '@react-navigation/native'; import {StackNavigationProp} from '@react-navigation/stack'; +import React, {useRef, useState} from 'react'; import { - View, - Text, - StyleSheet, - StatusBar, Alert, + KeyboardAvoidingView, Platform, + StatusBar, + StyleSheet, + Text, TouchableOpacity, - KeyboardAvoidingView, - ActivityIndicator, + View, } from 'react-native'; - -import {OnboardingStackParams} from '../../routes'; import { ArrowButton, + Background, + LoadingIndicator, RegistrationWizard, TaggInput, TermsConditions, - Background, - LoadingIndicator, } from '../../components'; -import {passwordRegex, usernameRegex, REGISTER_ENDPOINT} from '../../constants'; -import AsyncStorage from '@react-native-community/async-storage'; -import {BackgroundGradientType} from '../../types'; +import {passwordRegex, REGISTER_ENDPOINT, usernameRegex} from '../../constants'; import { ERROR_DOUBLE_CHECK_CONNECTION, ERROR_REGISTRATION, ERROR_SOMETHING_WENT_WRONG_REFRESH, } from '../../constants/strings'; +import {OnboardingStackParams} from '../../routes'; +import {BackgroundGradientType} from '../../types'; type RegistrationScreenThreeRouteProp = RouteProp< OnboardingStackParams, diff --git a/src/screens/onboarding/RegistrationTwo.tsx b/src/screens/onboarding/legacy/RegistrationTwo.tsx index 6d7b2226..2dd86f90 100644 --- a/src/screens/onboarding/RegistrationTwo.tsx +++ b/src/screens/onboarding/legacy/RegistrationTwo.tsx @@ -1,29 +1,26 @@ -import React, {useState, useRef} from 'react'; import {RouteProp} from '@react-navigation/native'; import {StackNavigationProp} from '@react-navigation/stack'; +import React, {useRef, useState} from 'react'; import { - View, - Text, - StyleSheet, - StatusBar, Alert, + KeyboardAvoidingView, Platform, + StatusBar, + StyleSheet, + Text, TouchableOpacity, - KeyboardAvoidingView, + View, } from 'react-native'; - -import {OnboardingStackParams} from '../../routes'; - import { ArrowButton, + Background, RegistrationWizard, TaggInput, - Background, } from '../../components'; - -import {nameRegex, emailRegex} from '../../constants'; -import {BackgroundGradientType} from '../../types'; +import {emailRegex, nameRegex} from '../../constants'; import {ERROR_NEXT_PAGE} from '../../constants/strings'; +import {OnboardingStackParams} from '../../routes'; +import {BackgroundGradientType} from '../../types'; type RegistrationScreenTwoRouteProp = RouteProp< OnboardingStackParams, diff --git a/src/screens/onboarding/SocialMedia.tsx b/src/screens/onboarding/legacy/SocialMedia.tsx index 2a978f94..db24830a 100644 --- a/src/screens/onboarding/SocialMedia.tsx +++ b/src/screens/onboarding/legacy/SocialMedia.tsx @@ -10,19 +10,18 @@ import { TouchableOpacity, View, } from 'react-native'; -import {useDispatch} from 'react-redux'; -import { - BackgroundGradientType, - CategorySelectionScreenType, - LinkerType, -} from '../..//types'; import { Background, LinkSocialMedia, RegistrationWizard, -} from '../../components'; -import {SOCIAL_LIST, MOMENT_CATEGORIES} from '../../constants/'; -import {OnboardingStackParams} from '../../routes'; +} from '../../../components'; +import {SOCIAL_LIST} from '../../../constants'; +import {OnboardingStackParams} from '../../../routes'; +import { + BackgroundGradientType, + CategorySelectionScreenType, + LinkerType, +} from '../../../types'; /** * Social Media Screen for displaying social media linkers diff --git a/src/screens/onboarding/legacy/TaggPopup.tsx b/src/screens/onboarding/legacy/TaggPopup.tsx new file mode 100644 index 00000000..e71a4d2a --- /dev/null +++ b/src/screens/onboarding/legacy/TaggPopup.tsx @@ -0,0 +1,143 @@ +import {BlurView} from '@react-native-community/blur'; +import {RouteProp} from '@react-navigation/native'; +import {StackNavigationProp} from '@react-navigation/stack'; +import * as React from 'react'; +import {Platform, StyleSheet, Text, TouchableOpacity} from 'react-native'; +import {Image, View} from 'react-native-animatable'; +import {ArrowButton} from '../../../components/onboarding'; +import {OnboardingStackParams} from '../../../routes'; +import {SCREEN_HEIGHT, SCREEN_WIDTH} from '../../../utils'; +import CloseIcon from '../../../assets/ionicons/close-outline.svg'; + +type TaggPopupRouteProps = RouteProp<OnboardingStackParams, 'TaggPopup'>; +type TaggPopupNavigationProps = StackNavigationProp< + OnboardingStackParams, + 'TaggPopup' +>; + +interface TaggPopupProps { + route: TaggPopupRouteProps; + navigation: TaggPopupNavigationProps; +} + +const TaggPopup: React.FC<TaggPopupProps> = ({route, navigation}) => { + /** + * Custom popup / Tutorial screen for Tagg + * Just like a Singly Linked List, we have a next node + * if (next !== undefined) + * Display the next button and navigate to next popup node on click + * else + * Display close button, navigate back on close + */ + const {messageHeader, messageBody, next} = route.params.popupProps; + + return ( + <BlurView blurType="light" blurAmount={2} style={styles.container}> + <TouchableOpacity + style={styles.container} + onPressOut={() => { + navigation.goBack(); + }}> + <View style={styles.popup}> + <Image + style={styles.icon} + source={require('../../../assets/icons/notificationPrompts/plus-logo.png')} + /> + <View style={styles.textContainer}> + <Text style={styles.header}>{messageHeader}</Text> + <Text style={styles.subtext}>{messageBody}</Text> + </View> + {!next && ( + <TouchableOpacity + style={styles.closeButton} + onPress={() => { + navigation.goBack(); + }}> + <CloseIcon height={'50%'} width={'50%'} color={'white'} /> + </TouchableOpacity> + )} + </View> + {next && ( + <View style={styles.footer}> + <ArrowButton + direction="forward" + onPress={() => { + navigation.navigate('TaggPopup', {popupProps: next}); + }} + /> + </View> + )} + </TouchableOpacity> + </BlurView> + ); +}; + +const styles = StyleSheet.create({ + container: { + flex: 1, + flexDirection: 'column', + justifyContent: 'center', + alignItems: 'center', + width: '100%', + height: '100%', + }, + whiteColor: { + color: 'white', + }, + closeButton: { + position: 'relative', + height: '50%', + aspectRatio: 1, + left: '20%', + }, + textContainer: { + flex: 1, + flexDirection: 'column', + }, + icon: { + width: 40, + height: 40, + marginVertical: '1%', + }, + header: { + color: '#fff', + fontSize: SCREEN_WIDTH / 25, + fontWeight: '600', + textAlign: 'justify', + marginBottom: '2%', + marginLeft: '4%', + }, + subtext: { + color: '#fff', + fontSize: SCREEN_WIDTH / 30, + fontWeight: '600', + textAlign: 'justify', + marginBottom: '15%', + marginLeft: '3%', + }, + popup: { + width: SCREEN_WIDTH * 0.8, + height: SCREEN_WIDTH * 0.24, + backgroundColor: 'black', + borderRadius: 8, + flexDirection: 'row', + alignSelf: 'auto', + flexWrap: 'wrap', + position: 'absolute', + bottom: SCREEN_HEIGHT * 0.7, + padding: SCREEN_WIDTH / 40, + }, + footer: { + marginLeft: '50%', + flexDirection: 'column-reverse', + ...Platform.select({ + ios: { + bottom: '20%', + }, + android: { + bottom: '10%', + }, + }), + }, +}); +export default TaggPopup; diff --git a/src/screens/onboarding/WaitlistSuccessScreen.tsx b/src/screens/onboarding/legacy/WaitlistSuccessScreen.tsx index 1f603e3a..72bbec63 100644 --- a/src/screens/onboarding/WaitlistSuccessScreen.tsx +++ b/src/screens/onboarding/legacy/WaitlistSuccessScreen.tsx @@ -10,12 +10,12 @@ import { TouchableOpacity, View, } from 'react-native'; -import {ArrowButton, Background, SubmitButton} from '../../components'; -import {OnboardingStackParams} from '../../routes'; -import {BackgroundGradientType} from '../../types'; +import {ArrowButton, Background} from '../../../components'; +import {TAGG_WEBSITE} from '../../../constants'; +import {OnboardingStackParams} from '../../../routes'; +import {BackgroundGradientType} from '../../../types'; +import {SCREEN_HEIGHT} from '../../../utils'; import CelebrationLogo from '../../assets/icons/celebration-logo.svg'; -import {SCREEN_HEIGHT} from '../../utils'; -import {TAGG_WEBSITE} from '../../constants'; type WaitlistSuccessScreenProp = StackNavigationProp< OnboardingStackParams, diff --git a/src/screens/onboarding/CategorySelection.tsx b/src/screens/profile/CategorySelection.tsx index ab5ff3be..d3958025 100644 --- a/src/screens/onboarding/CategorySelection.tsx +++ b/src/screens/profile/CategorySelection.tsx @@ -1,6 +1,6 @@ import {RouteProp} from '@react-navigation/native'; import {StackNavigationProp} from '@react-navigation/stack'; -import React, {useContext, useEffect, useState} from 'react'; +import React, {useEffect, useState} from 'react'; import { Alert, Platform, @@ -12,28 +12,23 @@ import { } from 'react-native'; import {ScrollView} from 'react-native-gesture-handler'; import {useDispatch, useSelector} from 'react-redux'; -import {ChatContext} from '../../App'; import PlusIcon from '../../assets/icons/plus_icon-01.svg'; import {Background, MomentCategory} from '../../components'; import {MOMENT_CATEGORIES} from '../../constants'; import {ERROR_SOMETHING_WENT_WRONG} from '../../constants/strings'; -import {OnboardingStackParams} from '../../routes'; -import {postMomentCategories} from '../../services'; -import { - updateIsOnboardedUser, - updateMomentCategories, -} from '../../store/actions/'; +import {MainStackParams} from '../../routes'; +import {updateMomentCategories} from '../../store/actions'; import {RootState} from '../../store/rootReducer'; -import {BackgroundGradientType, CategorySelectionScreenType} from '../../types'; -import {getTokenOrLogout, SCREEN_WIDTH, userLogin} from '../../utils'; +import {BackgroundGradientType} from '../../types'; +import {SCREEN_WIDTH} from '../../utils'; type CategorySelectionRouteProps = RouteProp< - OnboardingStackParams, + MainStackParams, 'CategorySelection' >; type CategorySelectionNavigationProps = StackNavigationProp< - OnboardingStackParams, + MainStackParams, 'CategorySelection' >; @@ -42,20 +37,11 @@ interface CategorySelectionProps { navigation: CategorySelectionNavigationProps; } -const CategorySelection: React.FC<CategorySelectionProps> = ({ +const CategorySelection: React.FC<CategorySelectioProps> = ({ route, navigation, }) => { - /** - * Same component to be used for category selection while onboarding and while on profile - */ - const {screenType, user} = route.params; - const {chatClient} = useContext(ChatContext); - const isOnBoarding: boolean = - screenType === CategorySelectionScreenType.Onboarding; - const {userId, username} = user; - - // During onboarding this will fail and default to [] + const {newCustomCategory} = route.params; const {momentCategories = []} = useSelector( (state: RootState) => state.momentCategories, ); @@ -81,7 +67,6 @@ const CategorySelection: React.FC<CategorySelectionProps> = ({ const dispatch = useDispatch(); useEffect(() => { - const newCustomCategory = route.params.newCustomCategory; if (newCustomCategory) { setUncommitedCustomCategories([ ...uncommitedCustomCategories, @@ -89,23 +74,7 @@ const CategorySelection: React.FC<CategorySelectionProps> = ({ ]); selectedCategories.push(newCustomCategory); } - }, [route.params?.newCustomCategory]); - - /** - * Show the tutorial if a new user is OnBoarding - */ - useEffect(() => { - if (isOnBoarding) { - navigation.navigate('TaggPopup', { - popupProps: { - messageHeader: 'Category And Moments', - messageBody: - 'Use pictures and videos to share \ndifferent aspects of you', - next: undefined, - }, - }); - } - }, [isOnBoarding]); + }, [newCustomCategory]); /** * Handle selection of a new category @@ -166,20 +135,13 @@ const CategorySelection: React.FC<CategorySelectionProps> = ({ return; } try { - if (isOnBoarding) { - dispatch(updateIsOnboardedUser(true)); - const token = await getTokenOrLogout(dispatch); - await postMomentCategories(selectedCategories, token); - userLogin(dispatch, {userId: userId, username: username}); - } else { - dispatch( - updateMomentCategories( - momentCategories.concat(selectedCategories), - true, - ), - ); - navigation.goBack(); - } + dispatch( + updateMomentCategories( + momentCategories.concat(selectedCategories), + true, + ), + ); + navigation.goBack(); } catch (error) { console.log(error); Alert.alert(ERROR_SOMETHING_WENT_WRONG); @@ -197,24 +159,18 @@ const CategorySelection: React.FC<CategorySelectionProps> = ({ <StatusBar barStyle="light-content" /> <Text style={styles.subtext}>Create Categories</Text> <View style={styles.container}> - {!isOnBoarding && ( - <TouchableOpacity - style={styles.createCategory} - onPress={() => { - navigation.push('CreateCustomCategory', { - screenType, - user, - existingCategories: momentCategories.concat( - selectedCategories, - ), - }); - }}> - <PlusIcon width={30} height={30} color="white" /> - <Text style={styles.createCategoryLabel}> - Create your own category - </Text> - </TouchableOpacity> - )} + <TouchableOpacity + style={styles.createCategory} + onPress={() => { + navigation.push('CreateCustomCategory', { + existingCategories: momentCategories.concat(selectedCategories), + }); + }}> + <PlusIcon width={30} height={30} color="white" /> + <Text style={styles.createCategoryLabel}> + Create your own category + </Text> + </TouchableOpacity> <View style={styles.linkerContainer}> {/* commited custom categories */} {customCategories.map((category, index) => ( @@ -251,9 +207,7 @@ const CategorySelection: React.FC<CategorySelectionProps> = ({ <TouchableOpacity onPress={handleButtonPress} style={styles.finalAction}> - <Text style={styles.finalActionLabel}> - {isOnBoarding ? 'Login' : 'Create'} - </Text> + <Text style={styles.finalActionLabel}>Create</Text> </TouchableOpacity> </View> </Background> diff --git a/src/screens/onboarding/CreateCustomCategory.tsx b/src/screens/profile/CreateCustomCategory.tsx index eab72c7d..c4b17b1e 100644 --- a/src/screens/onboarding/CreateCustomCategory.tsx +++ b/src/screens/profile/CreateCustomCategory.tsx @@ -11,17 +11,17 @@ import { TouchableOpacity, } from 'react-native'; import {Background} from '../../components'; -import {OnboardingStackParams} from '../../routes'; +import {MainStackParams} from '../../routes'; import {BackgroundGradientType} from '../../types'; import {SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; type CreateCustomCategoryRouteProps = RouteProp< - OnboardingStackParams, + MainStackParams, 'CreateCustomCategory' >; type CreateCustomCategoryNavigationProps = StackNavigationProp< - OnboardingStackParams, + MainStackParams, 'CreateCustomCategory' >; @@ -45,8 +45,6 @@ const CreateCustomCategory: React.FC<CreateCustomCategoryProps> = ({ Alert.alert('Looks like you already have that one created!'); } else { navigation.navigate('CategorySelection', { - screenType: route.params.screenType, - user: route.params.user, newCustomCategory: newCategory, }); } diff --git a/src/screens/profile/index.ts b/src/screens/profile/index.ts index b7efdd3b..d5377494 100644 --- a/src/screens/profile/index.ts +++ b/src/screens/profile/index.ts @@ -10,3 +10,5 @@ export {default as InviteFriendsScreen} from './InviteFriendsScreen'; export {default as SettingsScreen} from './SettingsScreen'; export {default as PrivacyScreen} from './PrivacyScreen'; export {default as AccountType} from './AccountType'; +export {default as CategorySelection} from './CategorySelection'; +export {default as CreateCustomCategory} from './CreateCustomCategory'; |
