Skip to content

Commit

Permalink
Merge pull request #5726 from parasharrajat/newWorkspaceInvite
Browse files Browse the repository at this point in the history
Refactor Workspace Invite Member page
  • Loading branch information
Julesssss authored Oct 19, 2021
2 parents 64cb863 + add3414 commit a5f2739
Show file tree
Hide file tree
Showing 9 changed files with 246 additions and 170 deletions.
15 changes: 13 additions & 2 deletions src/components/FormAlertWithSubmitButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const propTypes = {
/** Whether to show the alert text */
isAlertVisible: PropTypes.bool.isRequired,

/** Whether the button is disabled */
isDisabled: PropTypes.bool,

/** Submit function */
onSubmit: PropTypes.func.isRequired,

Expand All @@ -31,22 +34,29 @@ const propTypes = {
/** Whether message is in html format */
isMessageHtml: PropTypes.bool,

/** Styles for container element */
containerStyles: PropTypes.arrayOf(PropTypes.object),

...withLocalizePropTypes,
};

const defaultProps = {
message: '',
isDisabled: false,
isMessageHtml: false,
containerStyles: [],
};

const FormAlertWithSubmitButton = ({
isAlertVisible,
isDisabled,
onSubmit,
buttonText,
translate,
onFixTheErrorsLinkPressed,
message,
isMessageHtml,
containerStyles,
}) => {
/**
* @returns {React.Component}
Expand Down Expand Up @@ -91,7 +101,7 @@ const FormAlertWithSubmitButton = ({
}

return (
<View style={[styles.mh5, styles.mb5, styles.flex1, styles.justifyContentEnd]}>
<View style={[styles.mh5, styles.mb5, styles.flex1, styles.justifyContentEnd, ...containerStyles]}>
{isAlertVisible && (
<View style={[styles.flexRow, styles.alignItemsCenter, styles.mb3]}>
<Icon src={Exclamation} fill={colors.red} />
Expand All @@ -100,9 +110,10 @@ const FormAlertWithSubmitButton = ({
)}
<Button
success
pressOnEnter
text={buttonText}
onPress={onSubmit}
pressOnEnter
isDisabled={isDisabled}
/>
</View>
);
Expand Down
7 changes: 1 addition & 6 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,14 +702,9 @@ export default {
},
invite: {
invitePeople: 'Invite new members',
invitePeoplePrompt: 'Invite new members to your workspace.',
personalMessagePrompt: 'Add a personal message (optional)',
enterEmailOrPhone: 'Emails or phone numbers',
EmailOrPhonePlaceholder: 'Enter comma-separated list of emails or phone numbers',
pleaseEnterValidLogin: 'Please ensure the email or phone number is valid (e.g. +15005550006).',
pleaseEnterUniqueLogin: 'That user is already a member of this workspace.',
pleaseSelectUser: 'Please select a user from contacts.',
genericFailureMessage: 'An error occurred inviting the user to the workspace, please try again.',
systemUserError: ({email}) => `Sorry, you cannot invite ${email} to a workspace.`,
welcomeNote: ({workspaceName}) => `You have been invited to ${workspaceName}! Download the Expensify mobile app to start tracking your expenses.`,
},
editor: {
Expand Down
7 changes: 1 addition & 6 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,14 +704,9 @@ export default {
},
invite: {
invitePeople: 'Invitar nuevos miembros',
invitePeoplePrompt: 'Invita nuevos miembros a tu espacio de trabajo.',
personalMessagePrompt: 'Agregar un mensaje personal (Opcional)',
enterEmailOrPhone: 'Correos electrónicos o números de teléfono',
EmailOrPhonePlaceholder: 'Introduce una lista de correos electrónicos o números de teléfono separado por comas',
pleaseEnterValidLogin: 'Asegúrese de que el correo electrónico o el número de teléfono sean válidos (e.g. +15005550006).',
pleaseEnterUniqueLogin: 'Ese usuario ya es miembro de este espacio de trabajo.',
pleaseSelectUser: 'Asegúrese de que el correo electrónico o el número de teléfono sean válidos (e.g. +15005550006).',
genericFailureMessage: 'Se produjo un error al invitar al usuario al espacio de trabajo. Vuelva a intentarlo..',
systemUserError: ({email}) => `Lo sentimos, no puedes invitar a ${email} a un espacio de trabajo.`,
welcomeNote: ({workspaceName}) => `¡Has sido invitado a ${workspaceName}! Descargue la aplicación móvil Expensify para comenzar a rastrear sus gastos.`,
},
editor: {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/actions/Policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function invite(logins, welcomeNote, policyID) {
policy.alertMessage = '';

// Optimistically add the user to the policy
Onyx.set(key, policy);
Onyx.merge(key, policy);

// Make the API call to merge the login into the policy
API.Policy_Employees_Merge({
Expand Down
20 changes: 0 additions & 20 deletions src/libs/userUtils.js

This file was deleted.

Loading

0 comments on commit a5f2739

Please sign in to comment.