Skip to content

Commit 6fb9fd7

Browse files
authored
Merge pull request #10402 from Expensify/cmartins-refactorRequestCallPage
Refactor request call page to use Form
2 parents e353c75 + 2116f11 commit 6fb9fd7

File tree

7 files changed

+141
-175
lines changed

7 files changed

+141
-175
lines changed

src/ONYXKEYS.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,6 @@ export default {
150150
// Set when we are loading payment methods
151151
IS_LOADING_PAYMENT_METHODS: 'isLoadingPaymentMethods',
152152

153-
// Stores values for the request call form
154-
REQUEST_CALL_FORM: 'requestCallForm',
155-
156153
// The number of minutes a user has to wait for a call.
157154
INBOX_CALL_USER_WAIT_TIME: 'inboxCallUserWaitTime',
158155

@@ -180,5 +177,6 @@ export default {
180177
// List of Form ids
181178
FORMS: {
182179
ADD_DEBIT_CARD_FORM: 'addDebitCardForm',
180+
REQUEST_CALL_FORM: 'requestCallForm',
183181
},
184182
};

src/components/Form.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ class Form extends React.Component {
9191
return;
9292
}
9393

94-
// Set loading state and call submit handler
95-
FormActions.setIsLoading(this.props.formID, true);
94+
// Call submit handler
9695
this.props.onSubmit(this.inputValues);
9796
}
9897

src/components/Section.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,24 @@ const propTypes = {
2222

2323
/** Contents to display inside the section */
2424
children: PropTypes.node,
25+
26+
/** Customize the Section container */
27+
containerStyles: PropTypes.arrayOf(PropTypes.object),
2528
};
2629

2730
const defaultProps = {
2831
menuItems: null,
2932
children: null,
3033
icon: null,
3134
IconComponent: null,
35+
containerStyles: [],
3236
};
3337

3438
const Section = (props) => {
3539
const IconComponent = props.IconComponent;
3640
return (
3741
<>
38-
<View style={styles.pageWrapper}>
42+
<View style={[styles.pageWrapper, ...props.containerStyles]}>
3943
<View style={[styles.flexRow, styles.alignItemsCenter, styles.w100]}>
4044
<View style={[styles.flexShrink1]}>
4145
<Text style={[styles.h1]}>{props.title}</Text>

src/languages/en.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -909,10 +909,9 @@ export default {
909909
title: 'Request a call',
910910
subtitle: 'Need help?',
911911
description: 'Our team is ready to help each step of the way. Enter your name and phone number, and we\'ll give you a call back asap.',
912-
extension: 'Extension (Optional)',
912+
phoneNumberExtension: 'Extension (Optional)',
913913
callMe: 'Call me',
914914
growlMessageOnSave: 'Call requested.',
915-
growlMessageEmptyName: 'Please provide both a first and last name so our guides know how to address you!',
916915
callButton: 'Call',
917916
callButtonTooltip: 'Get live help from our team',
918917
blockedFromConcierge: 'Due to previous interactions with our staff, a call cannot be scheduled at this time.',
@@ -925,7 +924,11 @@ export default {
925924
guides: 'Please note that our Guides are typically available from Sunday at 5pm CT to Friday at 5pm CT.',
926925
},
927926
error: {
928-
phoneExtension: 'Please enter a valid phone extension number',
927+
phoneNumberExtension: 'Please enter a valid phone extension number',
928+
firstName: 'Please provide your first name so our guides know how to address you!',
929+
lastName: 'Please provide your last name so our guides know how to address you!',
930+
firstNameLength: 'First name shouldn\'t be longer than 50 characters',
931+
lastNameLength: 'Last name shouldn\'t be longer than 50 characters',
929932
},
930933
},
931934
requestCallConfirmationScreen: {

src/languages/es.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -911,10 +911,9 @@ export default {
911911
title: 'Llámame por teléfono',
912912
subtitle: '¿Necesitas ayuda?',
913913
description: 'Nuestro equipo está listo para ayudarte en cada paso. Ingresa tu nombre y número de teléfono y te llamaremos lo antes posible.',
914-
extension: 'Extensión (Opcional)',
914+
phoneNumberExtension: 'Extensión (Opcional)',
915915
callMe: 'Llámame',
916916
growlMessageOnSave: 'Llamada solicitada.',
917-
growlMessageEmptyName: 'Por favor ingresa tu nombre completo',
918917
callButton: 'Llamar',
919918
callButtonTooltip: 'Recibe ayuda telefónica de nuestro equipo',
920919
blockedFromConcierge: 'Debido a sus interacciones pasadas con nuestro equipo, la llamada no puede ser agendada en este momento.',
@@ -927,7 +926,11 @@ export default {
927926
guides: 'Tenga en cuenta que nuestras guías suelen estar disponibles desde el domingo a las 5pm CT hasta el viernes a las 5pm CT.',
928927
},
929928
error: {
930-
phoneExtension: 'Por favor, introduzca una extensión telefónica válida',
929+
phoneNumberExtension: 'Por favor, introduzca una extensión telefónica válida',
930+
firstName: 'Por favor ingresa tu nombre!',
931+
lastName: 'Por favor ingresa tu apellido!',
932+
firstNameLength: 'El nombre no debe tener más de 50 caracteres',
933+
lastNameLength: 'El apellido no debe tener más de 50 caracteres',
931934
},
932935
},
933936
requestCallConfirmationScreen: {

src/libs/actions/Inbox.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ function requestCall({
1919
}) {
2020
const optimisticData = [{
2121
onyxMethod: CONST.ONYX.METHOD.MERGE,
22-
key: ONYXKEYS.REQUEST_CALL_FORM,
22+
key: ONYXKEYS.FORMS.REQUEST_CALL_FORM,
2323
value: {
24-
loading: true,
24+
isLoading: true,
2525
},
2626
}];
2727

2828
const successData = [
2929
{
3030
onyxMethod: CONST.ONYX.METHOD.MERGE,
31-
key: ONYXKEYS.REQUEST_CALL_FORM,
31+
key: ONYXKEYS.FORMS.REQUEST_CALL_FORM,
3232
value: {
33-
loading: false,
33+
isLoading: false,
3434
error: '',
3535
didRequestCallSucceed: true,
3636
},
@@ -39,9 +39,9 @@ function requestCall({
3939

4040
const failureData = [{
4141
onyxMethod: CONST.ONYX.METHOD.MERGE,
42-
key: ONYXKEYS.REQUEST_CALL_FORM,
42+
key: ONYXKEYS.FORMS.REQUEST_CALL_FORM,
4343
value: {
44-
loading: false,
44+
isLoading: false,
4545
},
4646
}];
4747

@@ -63,7 +63,7 @@ function openRequestCallPage() {
6363
// Reset the error message in case we had one set from a previous failed attempt at requesting a call.
6464
const optimisticData = [{
6565
onyxMethod: CONST.ONYX.METHOD.MERGE,
66-
key: ONYXKEYS.REQUEST_CALL_FORM,
66+
key: ONYXKEYS.FORMS.REQUEST_CALL_FORM,
6767
value: {
6868
error: '',
6969
},
@@ -72,7 +72,7 @@ function openRequestCallPage() {
7272
}
7373

7474
function clearDidRequestCallSucceed() {
75-
Onyx.merge(ONYXKEYS.REQUEST_CALL_FORM, {didRequestCallSucceed: false});
75+
Onyx.merge(ONYXKEYS.FORMS.REQUEST_CALL_FORM, {didRequestCallSucceed: false});
7676
}
7777

7878
export {

0 commit comments

Comments
 (0)