diff --git a/src/components/organisms/quickProfileModal/children/actionPanel.tsx b/src/components/organisms/quickProfileModal/children/actionPanel.tsx index bcd1b7d75..523b59926 100644 --- a/src/components/organisms/quickProfileModal/children/actionPanel.tsx +++ b/src/components/organisms/quickProfileModal/children/actionPanel.tsx @@ -37,7 +37,7 @@ export const ActionPanel = ({ ) : ( { navigation.navigate(ROUTES.DRAWER.MAIN); openInbox(); - + }; const _handleOnPressRegister = () => { @@ -58,23 +58,21 @@ export const RegisterAccountModal = forwardRef(({ username, email, refUsername } setIsRegistering(false); }) .catch((err) => { - let title = intl.formatMessage({ id: 'alert.fail' }); let body = intl.formatMessage({ id: 'alert.unknow_error' }); if (get(err, 'response.status') === 500) { - - title = intl.formatMessage({ id: 'alert.fail' }) - body = intl.formatMessage({ id: 'register.500_error' }) + title = intl.formatMessage({ id: 'alert.fail' }); + body = intl.formatMessage({ id: 'register.500_error' }); } else if (get(err, 'response.data.message')) { title = intl.formatMessage({ id: 'alert.fail' }); - body = intl.formatMessage({ id: 'register.error_message' }, { message: err.response.data.message }); + body = intl.formatMessage( + { id: 'register.error_message' }, + { message: err.response.data.message }, + ); } - Alert.alert( - title, - body - ); + Alert.alert(title, body); setIsRegistering(false); }); }; @@ -88,26 +86,30 @@ export const RegisterAccountModal = forwardRef(({ username, email, refUsername } setIsRegistering(false); }; - - const _renderIntermediateComponent = () => { if (!isRegistering && !isRegistered) { return null; } - const _textId = isRegistered ? 'register.registered' : 'register.registering' - const _indicator = isRegistered ? - - : - ; + const _textId = isRegistered ? 'register.registered' : 'register.registering'; + const _indicator = isRegistered ? ( + + ) : ( + + ); - const _action = isRegistered && + const _action = isRegistered && ( - + />; + ); return ( @@ -119,9 +121,9 @@ export const RegisterAccountModal = forwardRef(({ username, email, refUsername } {_action} - ) + ); - } + }; const _renderUserInfo = (text: string, style: TextStyle) => ( @@ -156,34 +158,34 @@ export const RegisterAccountModal = forwardRef(({ username, email, refUsername } }; const _renderRegisterOptions = ({ productList, buyItem }) => { - return ( - isRegistered || isRegistering ? _renderIntermediateComponent() : ( - - {!disableFree && - _renderCard({ - titleId: 'free_account.title', - descriptionId: 'free_account.desc', + return isRegistered || isRegistering ? ( + _renderIntermediateComponent() + ) : ( + + {!disableFree && + _renderCard({ + titleId: 'free_account.title', + descriptionId: 'free_account.desc', - btnTitle: intl.formatMessage({ id: 'free_account.btn_register' }), - onPress: _handleOnPressRegister, - })} - {productList.map((product) => - _renderCard({ - titleId: 'buy_account.title', - descriptionId: 'buy_account.desc', + btnTitle: intl.formatMessage({ id: 'free_account.btn_register' }), + onPress: _handleOnPressRegister, + })} + {productList.map((product) => + _renderCard({ + titleId: 'buy_account.title', + descriptionId: 'buy_account.desc', - btnTitle: intl.formatMessage( - { id: 'buy_account.btn_register' }, - { price: product.localizedPrice }, - ), - onPress: () => { - setIsRegistering(true); - buyItem(product.productId); - }, - }), - )} - - ) + btnTitle: intl.formatMessage( + { id: 'buy_account.btn_register' }, + { price: product.localizedPrice }, + ), + onPress: () => { + setIsRegistering(true); + buyItem(product.productId); + }, + }), + )} + ); }; @@ -193,27 +195,30 @@ export const RegisterAccountModal = forwardRef(({ username, email, refUsername } {_renderUserInfo(username, styles.usernameStyle)} - {_renderUserInfo(email + email, styles.emailStyle)} + {_renderUserInfo(email, styles.emailStyle)} - - {({ buyItem, productList, isLoading }) => ( - - {isLoading ? : _renderRegisterOptions({ productList, buyItem })} - - )} - - - ); - + + {({ buyItem, productList, isLoading }) => ( + + {isLoading ? ( + + ) : ( + _renderRegisterOptions({ productList, buyItem }) + )} + + )} + + + ); }; return ( diff --git a/src/screens/register/registerScreen.js b/src/screens/register/registerScreen.js index 9a1a579c2..40c529741 100644 --- a/src/screens/register/registerScreen.js +++ b/src/screens/register/registerScreen.js @@ -129,8 +129,8 @@ const RegisterScreen = ({ navigation, route }) => { const _onContinuePress = () => { Keyboard.dismiss(); - registerAccountModalRef.current?.showModal() - } + registerAccountModalRef.current?.showModal(); + }; return ( @@ -236,7 +236,7 @@ const RegisterScreen = ({ navigation, route }) => { iconName="arrow-forward" iconColor="white" iconPosition="right" - text={intl.formatMessage({id:'alert.continue'})} + text={intl.formatMessage({ id: 'alert.continue' })} isDisable={!isUsernameValid || !isRefUsernameValid || !isEmailValid} style={styles.mainButton} />