From 0884b89ab776e7fe69818b79402e9598489fed2b Mon Sep 17 00:00:00 2001 From: hyochan Date: Tue, 6 Aug 2024 23:26:20 +0900 Subject: [PATCH] fix: profile update and onboarding --- app/(app)/(tabs)/profile.tsx | 57 +++++++++++++++----------- app/(app)/onboarding.tsx | 38 +++++++++-------- app/(app)/settings/profile-update.tsx | 38 +++++++++-------- assets/langs/en.json | 6 +-- bun.lockb | Bin 905357 -> 905357 bytes 5 files changed, 77 insertions(+), 62 deletions(-) diff --git a/app/(app)/(tabs)/profile.tsx b/app/(app)/(tabs)/profile.tsx index be25a61..610c4f8 100644 --- a/app/(app)/(tabs)/profile.tsx +++ b/app/(app)/(tabs)/profile.tsx @@ -1,6 +1,6 @@ import styled from '@emotion/native'; import {Stack} from 'expo-router'; -import {Icon, Typography} from 'dooboo-ui'; +import {Icon, Typography, useDooboo} from 'dooboo-ui'; import {t} from '../../../src/STRINGS'; import {useRecoilValue} from 'recoil'; import {authRecoilState} from '../../../src/recoil/atoms'; @@ -95,6 +95,7 @@ const TagText = styled.Text` export default function Profile(): JSX.Element { const {user, tags} = useRecoilValue(authRecoilState); + const {theme} = useDooboo(); return ( @@ -109,7 +110,7 @@ export default function Profile(): JSX.Element { source={user?.avatar_url ? {uri: user?.avatar_url} : IC_ICON} /> {user?.display_name || ''} - {user?.introduction || ''} + {user?.introduction ? {user?.introduction} : null} @@ -122,7 +123,7 @@ export default function Profile(): JSX.Element { gap: 4px; `} > - + {user?.github_id || ''} @@ -131,26 +132,36 @@ export default function Profile(): JSX.Element { {user?.affiliation || ''} - - - {t('onboarding.desiredConnection')} - {user?.desired_connection || ''} - - - {t('onboarding.futureExpectations')} - {user?.future_expectations || ''} - - - - {t('onboarding.userTags')}: - - {tags?.map((tag, index) => ( - - {tag} - - ))} - - + + {user?.desired_connection || user?.future_expectations ? ( + + {user?.desired_connection ? ( + + {t('onboarding.desiredConnection')} + {user?.desired_connection || ''} + + ) : null} + {user?.future_expectations ? ( + + {t('onboarding.futureExpectations')} + {user?.future_expectations || ''} + + ) : null} + + ) : null} + + {tags?.length ? ( + + {t('onboarding.userTags')} + + {tags.map((tag, index) => ( + + {tag} + + ))} + + + ) : null} diff --git a/app/(app)/onboarding.tsx b/app/(app)/onboarding.tsx index 93a8b06..63a0bcc 100644 --- a/app/(app)/onboarding.tsx +++ b/app/(app)/onboarding.tsx @@ -29,7 +29,7 @@ import {useRecoilState} from 'recoil'; import {authRecoilState} from '../../src/recoil/atoms'; import {ImageInsertArgs} from '../../src/types'; import FallbackComponent from '../../src/components/uis/FallbackComponent'; -import { showAlert } from '../../src/utils/alert'; +import {showAlert} from '../../src/utils/alert'; const Container = styled.SafeAreaView` flex: 1; @@ -55,11 +55,11 @@ const Content = styled.View` `; const schema = yup.object().shape({ - display_name: yup.string().required(t('common.requiredField')), + display_name: yup.string().required(t('common.requiredField')).min(2).max(20), + github_id: yup.string().required(t('common.requiredField')), + affiliation: yup.string().required(t('common.requiredField')), avatar_url: yup.string(), meetup_id: yup.string(), - affiliation: yup.string(), - github_id: yup.string(), other_sns_urls: yup.array().of(yup.string()), tags: yup.array().of(yup.string()), desired_connection: yup.string(), @@ -115,7 +115,7 @@ export default function Onboarding(): JSX.Element { let image: ImageInsertArgs | undefined = {}; - if (profileImg) { + if (profileImg && !profileImg.startsWith('http')) { const destPath = `users/${authId}`; image = await uploadFileToSupabase({ @@ -295,7 +295,7 @@ export default function Onboarding(): JSX.Element { displayNameError ? displayNameError : errors.display_name - ? errors.display_name.message + ? t('error.displayNameInvalid') : '' } /> @@ -304,9 +304,10 @@ export default function Onboarding(): JSX.Element { /> ( )} rules={{validate: (value) => !!value}} /> ( )} rules={{validate: (value) => !!value}} /> ( )} rules={{validate: (value) => !!value}} diff --git a/app/(app)/settings/profile-update.tsx b/app/(app)/settings/profile-update.tsx index e69d123..36cfe37 100644 --- a/app/(app)/settings/profile-update.tsx +++ b/app/(app)/settings/profile-update.tsx @@ -29,7 +29,7 @@ import { } from '../../../src/apis/profileQueries'; import FallbackComponent from '../../../src/components/uis/FallbackComponent'; import CustomLoadingIndicator from '../../../src/components/uis/CustomLoadingIndicator'; -import { showAlert } from '../../../src/utils/alert'; +import {showAlert} from '../../../src/utils/alert'; const Container = styled.SafeAreaView` flex: 1; @@ -49,11 +49,11 @@ const Content = styled.View` `; const schema = yup.object().shape({ - display_name: yup.string().required(t('common.requiredField')), - avatar_url: yup.string(), + display_name: yup.string().required(t('common.requiredField')).min(2).max(20), + github_id: yup.string().required(t('common.requiredField')), + affiliation: yup.string().required(t('common.requiredField')), meetup_id: yup.string(), - affiliation: yup.string(), - github_id: yup.string(), + avatar_url: yup.string(), other_sns_urls: yup.array().of(yup.string()), tags: yup.array().of(yup.string()), desired_connection: yup.string(), @@ -245,7 +245,7 @@ export default function ProfileUpdate(): JSX.Element { displayNameError ? displayNameError : errors.display_name - ? errors.display_name.message + ? t('error.displayNameInvalid') : '' } /> @@ -254,9 +254,10 @@ export default function ProfileUpdate(): JSX.Element { /> ( )} rules={{validate: (value) => !!value}} /> ( )} rules={{validate: (value) => !!value}} /> ( )} rules={{validate: (value) => !!value}} diff --git a/assets/langs/en.json b/assets/langs/en.json index d4f6dd1..29535ee 100644 --- a/assets/langs/en.json +++ b/assets/langs/en.json @@ -64,9 +64,9 @@ }, "error": { "default": "Error occurred!", - "displayNameExists": "The nickname already exists", - "displayNameInvalid": "Nickname must be between 2 and 20 characters", - "displayNameIsEmpty": "Please enter a nickname", + "displayNameExists": "The display name already exists", + "displayNameInvalid": "Display name must be between 2 and 20 characters", + "displayNameIsEmpty": "Please enter a display name", "unableToOpenEmailClient": "Unable to open email client", "projectIdNotFound": "Project ID not found", "mustUsePhysicalDeviceForSubject": "Must use physical device for {{subject}}" diff --git a/bun.lockb b/bun.lockb index 586b6e0203c670437bcc993fa176997f47cf9f1c..4bf1402d050ff123c491f7f290ef79c0471e43bc 100755 GIT binary patch delta 58 zcmeBOXx_WfyrG4$g{g(Pg{6hHg{_6Xg<}h6Z~_NooT0Ivfu2!&bOI+3a{)0o5c6!0 JPT(~v001D_5!(O& delta 58 zcmeBOXx_WfyrG4$g{g(Pg{6hHg{_6Xg<}h6Z~_Mt0|c~3CvXBW7Z7s;G0*ns1YV;8 E0Qp-GTmS$7