diff --git a/e2e/changePasswordTest.spec.ts b/e2e/changePasswordTest.spec.ts index c63300e1..b2045655 100644 --- a/e2e/changePasswordTest.spec.ts +++ b/e2e/changePasswordTest.spec.ts @@ -31,7 +31,7 @@ describe('changePassword', () => { await element(by.id('tabs.settings')).tap(); await scrollDownAndTap( - 'main.settings.account.password.button', + 'main.settings.account.password.change', 'main.settings.index.view', ); diff --git a/e2e/logoutTest.spec.ts b/e2e/logoutTest.spec.ts index 35686184..4f312873 100644 --- a/e2e/logoutTest.spec.ts +++ b/e2e/logoutTest.spec.ts @@ -10,7 +10,7 @@ import { signIn, } from './helpers'; -describe('Delete', () => { +describe('Logout', () => { beforeAll(async () => { await device.launchApp(); }); diff --git a/src/Screens/Main/Settings/UserAccount/FormItem.tsx b/src/Screens/Main/Settings/UserAccount/FormItem.tsx new file mode 100644 index 00000000..90f119be --- /dev/null +++ b/src/Screens/Main/Settings/UserAccount/FormItem.tsx @@ -0,0 +1,64 @@ +import React from 'react'; +import RN from 'react-native'; + +import { MessageId } from '../../../../localization'; +import colors from '../../../components/colors'; +import fonts from '../../../components/fonts'; + +import Message from '../../../components/Message'; +import IconButton from '../../../components/IconButton'; + +type FormButton = { + testID: string; + onClick: () => void; +}; + +type Props = { + labelMessageId: MessageId; + button?: FormButton; + style?: RN.StyleProp; + children: React.ReactNode; +}; + +export const FormItem = ({ + labelMessageId, + button, + children, + style, +}: Props) => { + return ( + + + + {button && ( + + )} + + {children} + + ); +}; + +const styles = RN.StyleSheet.create({ + dataContainer: { + paddingVertical: 16, + borderBottomColor: colors.formBorderGray, + borderBottomWidth: 1, + }, + headerContainer: { + display: 'flex', + flexDirection: 'row', + flex: 1, + justifyContent: 'space-between', + paddingTop: 16, + }, + fieldName: { + ...fonts.regularBold, + color: colors.darkestBlue, + }, +}); diff --git a/src/Screens/Main/Settings/UserAccount/MainForm.tsx b/src/Screens/Main/Settings/UserAccount/MainForm.tsx index 7db8d91b..3935c7b8 100644 --- a/src/Screens/Main/Settings/UserAccount/MainForm.tsx +++ b/src/Screens/Main/Settings/UserAccount/MainForm.tsx @@ -8,12 +8,13 @@ import { tuple } from 'fp-ts/lib/function'; import * as userAccountState from '../../../../state/reducers/userAccount'; import * as actions from '../../../../state/actions'; -import RemoteData from '../../../components/RemoteData'; -import Message from '../../../components/Message'; import colors from '../../../components/colors'; import fonts from '../../../components/fonts'; + +import RemoteData from '../../../components/RemoteData'; +import Message from '../../../components/Message'; import MentorForm from './MentorForm'; -import IconButton from 'src/Screens/components/IconButton'; +import { FormItem } from './FormItem'; type Props = { openPasswordForm: () => void; @@ -42,45 +43,32 @@ export default ({ openPasswordForm, openEmailForm }: Props) => { > {([{ userId, userName, displayName, email, role }, hasBoth]) => ( <> - - + {userName} - - {hasBoth ? ( - - + + + {hasBoth && ( + {displayName} - - ) : null} - - - - - + + )} + {email ? ( { id="main.settings.account.email.missing" /> )} - - - - - - + + {'********'} - + {role === 'mentor' ? : null} )} @@ -124,18 +107,6 @@ const styles = RN.StyleSheet.create({ paddingBottom: 32, marginBottom: 32, }, - headerContainer: { - display: 'flex', - flexDirection: 'row', - flex: 1, - justifyContent: 'space-between', - paddingTop: 16, - }, - dataContainer: { - paddingVertical: 16, - borderBottomColor: colors.formBorderGray, - borderBottomWidth: 1, - }, dataContainerLast: { paddingVertical: 16, }, @@ -144,20 +115,8 @@ const styles = RN.StyleSheet.create({ color: colors.darkestBlue, marginBottom: 24, }, - fieldName: { - ...fonts.regularBold, - color: colors.darkestBlue, - }, fieldValueText: { color: colors.darkestBlue, }, - link: { - marginTop: 8, - marginBottom: 24, - }, - buttonText: { - ...fonts.regularBold, - color: colors.darkestBlue, - }, errorStyle: { margin: 0 }, });