Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Workspace Invite Member page #5726

Merged
merged 18 commits into from
Oct 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
parasharrajat marked this conversation as resolved.
Show resolved Hide resolved
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);
Copy link
Member Author

@parasharrajat parasharrajat Oct 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to make this change otherwise, newly added members were being removed as soon as they were added to Onyx.

I am not sure how to debug the Onyx but I tried debugging the code and somehow internal Keychanged handler is getting old value in the next tick.


// 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