Skip to content

Commit

Permalink
Merge pull request #23063 from dhairyasenjaliya/teachersUniteFlow
Browse files Browse the repository at this point in the history
[New Feature] - Teachers Unite sign-up flows
  • Loading branch information
youssef-lr authored Aug 30, 2023
2 parents a3e301c + 3ba6d89 commit 16c611e
Show file tree
Hide file tree
Showing 26 changed files with 856 additions and 40 deletions.
1 change: 1 addition & 0 deletions assets/animations/SaveTheWorld.json

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions assets/images/heart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2558,6 +2558,12 @@ const CONST = {
TRANSLATION_KEYS: {
ATTACHMENT: 'common.attachment',
},
TEACHERS_UNITE: {
PUBLIC_ROOM_ID: '207591744844000',
POLICY_ID: 'ABD1345ED7293535',
POLICY_NAME: 'Expensify.org / Teachers Unite!',
PUBLIC_ROOM_NAME: '#teachers-unite',
},
CUSTOM_STATUS_TYPES: {
NEVER: 'never',
THIRTY_MINUTES: 'thirtyMinutes',
Expand Down
2 changes: 2 additions & 0 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ const ONYXKEYS = {
SETTINGS_STATUS_SET_FORM: 'settingsStatusSetForm',
SETTINGS_STATUS_CLEAR_AFTER_FORM: 'settingsStatusClearAfterForm',
SETTINGS_STATUS_SET_CLEAR_AFTER_FORM: 'settingsStatusSetClearAfterForm',
I_KNOW_A_TEACHER_FORM: 'iKnowTeacherForm',
INTRO_SCHOOL_PRINCIPAL_FORM: 'introSchoolPrincipalForm',
},
} as const;

Expand Down
4 changes: 4 additions & 0 deletions src/ROUTES.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ export default {
FLAG_COMMENT: `flag/:reportID/:reportActionID`,
getFlagCommentRoute: (reportID, reportActionID) => `flag/${reportID}/${reportActionID}`,
SEARCH: 'search',
SAVE_THE_WORLD: 'save-the-world',
I_KNOW_A_TEACHER: 'save-the-world/i-know-a-teacher',
INTRO_SCHOOL_PRINCIPAL: 'save-the-world/intro-school-principal',
I_AM_A_TEACHER: 'save-the-world/i-am-a-teacher',
DETAILS: 'details',
getDetailsRoute: (login) => `details?login=${encodeURIComponent(login)}`,
PROFILE: 'a/:accountID',
Expand Down
41 changes: 29 additions & 12 deletions src/components/BlockingViews/BlockingView.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ const propTypes = {

/** Function to call when pressing the navigation link */
onLinkPress: PropTypes.func,

/** Whether we should embed the link with subtitle */
shouldEmbedLinkWithSubtitle: PropTypes.bool,
};

const defaultProps = {
Expand All @@ -48,10 +51,30 @@ const defaultProps = {
iconWidth: variables.iconSizeSuperLarge,
iconHeight: variables.iconSizeSuperLarge,
onLinkPress: () => Navigation.dismissModal(),
shouldEmbedLinkWithSubtitle: false,
};

function BlockingView(props) {
const {translate} = useLocalize();
function renderContent() {
return (
<>
<AutoEmailLink
style={[styles.textAlignCenter]}
text={props.subtitle}
/>
{props.shouldShowLink ? (
<TextLink
onPress={props.onLinkPress}
style={[styles.link, styles.mt2]}
>
{translate(props.linkKey)}
</TextLink>
) : null}
</>
);
}

return (
<View style={[styles.flex1, styles.alignItemsCenter, styles.justifyContentCenter, styles.ph10]}>
<Icon
Expand All @@ -61,18 +84,12 @@ function BlockingView(props) {
height={props.iconHeight}
/>
<Text style={[styles.notFoundTextHeader]}>{props.title}</Text>
<AutoEmailLink
style={[styles.textAlignCenter]}
text={props.subtitle}
/>
{props.shouldShowLink ? (
<TextLink
onPress={props.onLinkPress}
style={[styles.link, styles.mt2]}
>
{translate(props.linkKey)}
</TextLink>
) : null}

{props.shouldEmbedLinkWithSubtitle ? (
<Text style={[styles.textAlignCenter]}>{renderContent()}</Text>
) : (
<View style={[styles.alignItemsCenter, styles.justifyContentCenter]}>{renderContent()}</View>
)}
</View>
);
}
Expand Down
2 changes: 2 additions & 0 deletions src/components/Icon/Expensicons.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import Gear from '../../../assets/images/gear.svg';
import Globe from '../../../assets/images/globe.svg';
import GoogleLogo from '../../../assets/images/signIn/google-logo.svg';
import Hashtag from '../../../assets/images/hashtag.svg';
import Heart from '../../../assets/images/heart.svg';
import History from '../../../assets/images/history.svg';
import Hourglass from '../../../assets/images/hourglass.svg';
import ImageCropCircleMask from '../../../assets/images/image-crop-circle-mask.svg';
Expand Down Expand Up @@ -188,6 +189,7 @@ export {
Globe,
GoogleLogo,
Hashtag,
Heart,
History,
Hourglass,
ImageCropCircleMask,
Expand Down
2 changes: 2 additions & 0 deletions src/components/Icon/Illustrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import CoffeeMug from '../../../assets/images/simple-illustrations/simple-illust
import ConciergeBlue from '../../../assets/images/product-illustrations/concierge--blue.svg';
import ConciergeExclamation from '../../../assets/images/product-illustrations/concierge--exclamation.svg';
import CreditCardsBlue from '../../../assets/images/product-illustrations/credit-cards--blue.svg';
import EmailAddress from '../../../assets/images/simple-illustrations/simple-illustration__email-address.svg';
import InvoiceOrange from '../../../assets/images/product-illustrations/invoice--orange.svg';
import JewelBoxBlue from '../../../assets/images/product-illustrations/jewel-box--blue.svg';
import JewelBoxGreen from '../../../assets/images/product-illustrations/jewel-box--green.svg';
Expand Down Expand Up @@ -55,6 +56,7 @@ export {
ConciergeBlue,
ConciergeExclamation,
CreditCardsBlue,
EmailAddress,
InvoiceOrange,
JewelBoxBlue,
JewelBoxGreen,
Expand Down
3 changes: 2 additions & 1 deletion src/components/LottieAnimations.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ const Hands = require('../../assets/animations/Hands.json');
const PreferencesDJ = require('../../assets/animations/PreferencesDJ.json');
const ReviewingBankInfo = require('../../assets/animations/ReviewingBankInfo.json');
const WorkspacePlanet = require('../../assets/animations/WorkspacePlanet.json');
const SaveTheWorld = require('../../assets/animations/SaveTheWorld.json');

export {ExpensifyLounge, Fireworks, Hands, PreferencesDJ, ReviewingBankInfo, WorkspacePlanet};
export {ExpensifyLounge, Fireworks, Hands, PreferencesDJ, ReviewingBankInfo, SaveTheWorld, WorkspacePlanet};
1 change: 0 additions & 1 deletion src/components/withLocalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, {createContext, forwardRef} from 'react';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import lodashGet from 'lodash/get';

import getComponentDisplayName from '../libs/getComponentDisplayName';
import ONYXKEYS from '../ONYXKEYS';
import * as Localize from '../libs/Localize';
Expand Down
28 changes: 27 additions & 1 deletion src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ export default {
someone: 'Someone',
total: 'Total',
edit: 'Edit',
letsDoThis: `Let's do this!`,
letsStart: `Let's start`,
showMore: 'Show more',
merchant: 'Merchant',
category: 'Category',
Expand Down Expand Up @@ -372,6 +374,7 @@ export default {
draftedMessage: 'Drafted message',
listOfChatMessages: 'List of chat messages',
listOfChats: 'List of chats',
saveTheWorld: 'Save the world',
},
tabSelector: {
manual: 'Manual',
Expand Down Expand Up @@ -520,7 +523,7 @@ export default {
enteredMethodIsAlreadySubmited: 'The Entered Contact Method already exists.',
passwordRequired: 'password required.',
contactMethodRequired: 'Contact method is required.',
invalidContactMethod: 'Invalid contact method.',
invalidContactMethod: 'Invalid contact method',
},
newContactMethod: 'New contact method',
},
Expand Down Expand Up @@ -1613,6 +1616,29 @@ export default {
levelTwoResult: 'Message hidden from channel, plus anonymous warning and message is reported for review.',
levelThreeResult: 'Message removed from channel plus anonymous warning and message is reported for review.',
},
teachersUnitePage: {
teachersUnite: 'Teachers unite!',
joinExpensifyOrg: 'Join Expensify.org in eliminating injustice around the world and help teachers split their expenses for classrooms in need!',
iKnowATeacher: 'I know a teacher',
iAmATeacher: 'I am a teacher',
getInTouch: 'Excellent! Please share their information so we can get in touch with them.',
introSchoolPrincipal: 'Intro to your school principal',
schoolPrincipalVerfiyExpense:
'Expensify.org splits the cost of essential school supplies so that students from low-income households can have a better learning experience. Your principal will be asked to verify your expenses.',
principalFirstName: 'Principal first name',
principalLastName: 'Principal last name',
principalWorkEmail: 'Principal work email',
updateYourEmail: 'Update your email address',
updateEmail: 'Update email address',
contactMethods: 'Contact methods.',
schoolMailAsDefault: 'Before you move forward, please make sure to set your school email as your default contact method. You can do so in Settings > Profile > ',
error: {
enterPhoneEmail: 'Enter a valid email or phone number',
enterEmail: 'Enter an email',
enterValidEmail: 'Enter a valid email',
tryDifferentEmail: 'Please try a different email',
},
},
distance: {
addStop: 'Add stop',
deleteWaypoint: 'Delete waypoint',
Expand Down
29 changes: 28 additions & 1 deletion src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ export default {
someone: 'Alguien',
total: 'Total',
edit: 'Editar',
letsDoThis: '¡Hagámoslo!',
letsStart: 'Empecemos',
showMore: 'Mostrar más',
merchant: 'Comerciante',
category: 'Categoría',
Expand Down Expand Up @@ -371,6 +373,7 @@ export default {
draftedMessage: 'Mensaje borrador',
listOfChatMessages: 'Lista de mensajes del chat',
listOfChats: 'lista de chats',
saveTheWorld: 'Salvar el mundo',
},
tabSelector: {
manual: 'Manual',
Expand Down Expand Up @@ -520,7 +523,7 @@ export default {
enteredMethodIsAlreadySubmited: 'El método de contacto ingresado ya existe.',
passwordRequired: 'Se requiere contraseña',
contactMethodRequired: 'Se requiere método de contacto.',
invalidContactMethod: 'Método de contacto no válido.',
invalidContactMethod: 'Método de contacto no válido',
},
newContactMethod: 'Nuevo método de contacto',
},
Expand Down Expand Up @@ -2100,6 +2103,30 @@ export default {
levelTwoResult: 'Mensaje ocultado del canal, más advertencia anónima y mensaje reportado para revisión.',
levelThreeResult: 'Mensaje eliminado del canal, más advertencia anónima y mensaje reportado para revisión.',
},
teachersUnitePage: {
teachersUnite: '¡Profesores unidos!',
joinExpensifyOrg: 'Únete a Expensify.org para eliminar la injusticia en todo el mundo y ayuda a los profesores a dividir sus gastos para las aulas más necesitadas.',
iKnowATeacher: 'Yo conozco a un profesor',
iAmATeacher: 'Soy profesor',
getInTouch: '¡Excelente! Por favor, comparte su información para que podamos ponernos en contacto con ellos.',
introSchoolPrincipal: 'Introducción al director del colegio',
schoolPrincipalVerfiyExpense:
'Expensify.org divide el coste del material escolar esencial para que los estudiantes de familias con bajos ingresos puedan tener una mejor experiencia de aprendizaje. Se pedirá a tu director que verifique tus gastos.',
principalFirstName: 'Nombre del director',
principalLastName: 'Apellido del director',
principalWorkEmail: 'Correo electrónico de trabajo del director',
updateYourEmail: 'Actualiza tu dirección de correo electrónico',
updateEmail: 'Actualización de la dirección de correo electrónico',
contactMethods: 'Métodos de contacto.',
schoolMailAsDefault:
'Antes de seguir adelante, asegúrate de establecer el correo electrónico de tu colegio como método de contacto predeterminado. Puede hacerlo en Configuración > Perfil > ',
error: {
enterPhoneEmail: 'Ingrese un correo electrónico o número de teléfono válido',
enterEmail: 'Introduce un correo electrónico',
enterValidEmail: 'Introduzca un correo electrónico válido',
tryDifferentEmail: 'Por favor intenta con un e-mail diferente',
},
},
distance: {
addStop: 'Agregar parada',
deleteWaypoint: 'Eliminar punto de ruta',
Expand Down
45 changes: 44 additions & 1 deletion src/libs/LoginUtils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import _ from 'underscore';
import Str from 'expensify-common/lib/str';
import Onyx from 'react-native-onyx';
import {PUBLIC_DOMAINS} from 'expensify-common/lib/CONST';
import {parsePhoneNumber} from 'awesome-phonenumber';
import CONST from '../CONST';
import ONYXKEYS from '../ONYXKEYS';

Expand Down Expand Up @@ -28,4 +32,43 @@ function appendCountryCode(phone) {
return phone.startsWith('+') ? phone : `+${countryCodeByIP}${phone}`;
}

export {getPhoneNumberWithoutSpecialChars, appendCountryCode};
/**
* Check email is public domain or not
*
* @param {String} email
* @return {Boolean}
*/
function isEmailPublicDomain(email) {
const emailDomain = Str.extractEmailDomain(email);
return _.includes(PUBLIC_DOMAINS, emailDomain.toLowerCase(), false);
}

/**
* Check if number is valid
* @param {String} values
* @returns {String} - Returns valid phone number formatted
*/
function validateNumber(values) {
const parsedPhoneNumber = parsePhoneNumber(values);

if (parsedPhoneNumber.possible && Str.isValidPhone(values.slice(0))) {
return parsedPhoneNumber.number.e164 + CONST.SMS.DOMAIN;
}

return '';
}

/**
* Check number is valid and attach country code
* @param {String} partnerUserID
* @returns {String} - Returns valid phone number with country code
*/
function getPhoneLogin(partnerUserID) {
if (_.isEmpty(partnerUserID)) {
return '';
}

return appendCountryCode(getPhoneNumberWithoutSpecialChars(partnerUserID));
}

export {getPhoneNumberWithoutSpecialChars, appendCountryCode, isEmailPublicDomain, validateNumber, getPhoneLogin};
Loading

0 comments on commit 16c611e

Please sign in to comment.