-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27750 from akinwale/task-27225
fix: consolidate 'I am a Teacher' and 'Intro to School Principal' pages
- Loading branch information
Showing
6 changed files
with
84 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,36 @@ | ||
import React from 'react'; | ||
import ScreenWrapper from '../../components/ScreenWrapper'; | ||
import HeaderWithBackButton from '../../components/HeaderWithBackButton'; | ||
import ROUTES from '../../ROUTES'; | ||
import Navigation from '../../libs/Navigation/Navigation'; | ||
import FixedFooter from '../../components/FixedFooter'; | ||
import styles from '../../styles/styles'; | ||
import Button from '../../components/Button'; | ||
import * as Illustrations from '../../components/Icon/Illustrations'; | ||
import variables from '../../styles/variables'; | ||
import useLocalize from '../../hooks/useLocalize'; | ||
import BlockingView from '../../components/BlockingViews/BlockingView'; | ||
import PropTypes from 'prop-types'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import ONYXKEYS from '../../ONYXKEYS'; | ||
import * as LoginUtils from '../../libs/LoginUtils'; | ||
import ImTeacherUpdateEmailPage from './ImTeacherUpdateEmailPage'; | ||
import IntroSchoolPrincipalPage from './IntroSchoolPrincipalPage'; | ||
|
||
const propTypes = {}; | ||
const propTypes = { | ||
/** Current user session */ | ||
session: PropTypes.shape({ | ||
/** Current user primary login */ | ||
email: PropTypes.string.isRequired, | ||
}), | ||
}; | ||
|
||
const defaultProps = {}; | ||
const defaultProps = { | ||
session: { | ||
email: null, | ||
}, | ||
}; | ||
|
||
function ImTeacherPage() { | ||
const {translate} = useLocalize(); | ||
|
||
return ( | ||
<ScreenWrapper testID="ImTeacherPage"> | ||
<HeaderWithBackButton | ||
title={translate('teachersUnitePage.iAmATeacher')} | ||
onBackButtonPress={() => Navigation.goBack(ROUTES.TEACHERS_UNITE)} | ||
/> | ||
<BlockingView | ||
shouldShowLink | ||
shouldEmbedLinkWithSubtitle | ||
icon={Illustrations.EmailAddress} | ||
title={translate('teachersUnitePage.updateYourEmail')} | ||
subtitle={translate('teachersUnitePage.schoolMailAsDefault')} | ||
linkKey="teachersUnitePage.contactMethods" | ||
onLinkPress={() => Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHODS)} | ||
iconWidth={variables.signInLogoWidthLargeScreen} | ||
iconHeight={variables.lhnLogoWidth} | ||
/> | ||
<FixedFooter style={[styles.flexGrow0]}> | ||
<Button | ||
success | ||
accessibilityLabel={translate('teachersUnitePage.updateEmail')} | ||
text={translate('teachersUnitePage.updateEmail')} | ||
onPress={() => Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHODS)} | ||
/> | ||
</FixedFooter> | ||
</ScreenWrapper> | ||
); | ||
function ImTeacherPage(props) { | ||
const isLoggedInEmailPublicDomain = LoginUtils.isEmailPublicDomain(props.session.email); | ||
return isLoggedInEmailPublicDomain ? <ImTeacherUpdateEmailPage /> : <IntroSchoolPrincipalPage />; | ||
} | ||
|
||
ImTeacherPage.propTypes = propTypes; | ||
ImTeacherPage.defaultProps = defaultProps; | ||
ImTeacherPage.displayName = 'ImTeacherPage'; | ||
|
||
export default ImTeacherPage; | ||
export default withOnyx({ | ||
session: { | ||
key: ONYXKEYS.SESSION, | ||
}, | ||
})(ImTeacherPage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from 'react'; | ||
import ScreenWrapper from '../../components/ScreenWrapper'; | ||
import HeaderWithBackButton from '../../components/HeaderWithBackButton'; | ||
import ROUTES from '../../ROUTES'; | ||
import Navigation from '../../libs/Navigation/Navigation'; | ||
import FixedFooter from '../../components/FixedFooter'; | ||
import styles from '../../styles/styles'; | ||
import Button from '../../components/Button'; | ||
import * as Illustrations from '../../components/Icon/Illustrations'; | ||
import variables from '../../styles/variables'; | ||
import useLocalize from '../../hooks/useLocalize'; | ||
import BlockingView from '../../components/BlockingViews/BlockingView'; | ||
|
||
const propTypes = {}; | ||
|
||
const defaultProps = {}; | ||
|
||
function ImTeacherUpdateEmailPage() { | ||
const {translate} = useLocalize(); | ||
|
||
return ( | ||
<ScreenWrapper testID="ImTeacherPage"> | ||
<HeaderWithBackButton | ||
title={translate('teachersUnitePage.iAmATeacher')} | ||
onBackButtonPress={() => Navigation.goBack(ROUTES.TEACHERS_UNITE)} | ||
/> | ||
<BlockingView | ||
shouldShowLink | ||
shouldEmbedLinkWithSubtitle | ||
icon={Illustrations.EmailAddress} | ||
title={translate('teachersUnitePage.updateYourEmail')} | ||
subtitle={translate('teachersUnitePage.schoolMailAsDefault')} | ||
linkKey="teachersUnitePage.contactMethods" | ||
onLinkPress={() => Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHODS)} | ||
iconWidth={variables.signInLogoWidthLargeScreen} | ||
iconHeight={variables.lhnLogoWidth} | ||
/> | ||
<FixedFooter style={[styles.flexGrow0]}> | ||
<Button | ||
success | ||
accessibilityLabel={translate('teachersUnitePage.updateEmail')} | ||
text={translate('teachersUnitePage.updateEmail')} | ||
onPress={() => Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHODS)} | ||
/> | ||
</FixedFooter> | ||
</ScreenWrapper> | ||
); | ||
} | ||
|
||
ImTeacherUpdateEmailPage.propTypes = propTypes; | ||
ImTeacherUpdateEmailPage.defaultProps = defaultProps; | ||
ImTeacherUpdateEmailPage.displayName = 'ImTeacherUpdateEmailPage'; | ||
|
||
export default ImTeacherUpdateEmailPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters