-
Notifications
You must be signed in to change notification settings - Fork 4k
[NoQA] Feat/44307 card system messages #46281
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
Changes from all commits
614518e
36661fb
e4284d2
018e939
3137495
f0283e4
e74c3cf
93a771b
b7d963e
9ecee55
2346f07
fcb3cef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| import React from 'react'; | ||
| import type {OnyxEntry} from 'react-native-onyx'; | ||
| import {useOnyx} from 'react-native-onyx'; | ||
| import Button from '@components/Button'; | ||
| import RenderHTML from '@components/RenderHTML'; | ||
| import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; | ||
| import useEnvironment from '@hooks/useEnvironment'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import Navigation from '@libs/Navigation/Navigation'; | ||
| import CONST from '@src/CONST'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import ROUTES from '@src/ROUTES'; | ||
| import type {ReportAction} from '@src/types/onyx'; | ||
| import {isEmptyObject} from '@src/types/utils/EmptyObject'; | ||
|
|
||
| type IssueCardMessageProps = { | ||
| action: OnyxEntry<ReportAction>; | ||
| }; | ||
|
|
||
| function IssueCardMessage({action}: IssueCardMessageProps) { | ||
| const {translate} = useLocalize(); | ||
| const styles = useThemeStyles(); | ||
| const {environmentURL} = useEnvironment(); | ||
| // TODO: now mocking accountID with current user accountID instead of action.message.assigneeAccountID | ||
| const personalData = useCurrentUserPersonalDetails(); | ||
| const [privatePersonalDetails] = useOnyx(ONYXKEYS.PRIVATE_PERSONAL_DETAILS); | ||
|
|
||
| // TODO: now mocking accountID with current user accountID instead of action.message.assigneeAccountID | ||
| const assignee = `<mention-user accountID=${personalData.accountID}></mention-user>`; | ||
| const link = `<a href='${environmentURL}/${ROUTES.SETTINGS_WALLET}'>${translate('cardPage.expensifyCard')}</a>`; | ||
|
mountiny marked this conversation as resolved.
|
||
|
|
||
| const noMailingAddress = action?.actionName === CONST.REPORT.ACTIONS.TYPE.CARD_MISSING_ADDRESS && isEmptyObject(privatePersonalDetails?.address); | ||
|
|
||
| const getTranslation = () => { | ||
| switch (action?.actionName) { | ||
| case CONST.REPORT.ACTIONS.TYPE.CARD_ISSUED: | ||
| return translate('workspace.expensifyCard.issuedCard', assignee); | ||
| case CONST.REPORT.ACTIONS.TYPE.CARD_ISSUED_VIRTUAL: | ||
| return translate('workspace.expensifyCard.issuedCardVirtual', {assignee, link}); | ||
| case CONST.REPORT.ACTIONS.TYPE.CARD_MISSING_ADDRESS: | ||
| return translate(`workspace.expensifyCard.${noMailingAddress ? 'issuedCardNoMailingAddress' : 'addedAddress'}`, assignee); | ||
|
Comment on lines
+41
to
+42
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BugWrong system message for Screen.Recording.2024-07-29.at.4.25.24.PM.mov
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's because you have your address added - if you wouldn't have it a proper message with button to add an address would be displayed. After you add the address it is displayed like this - that's why I added two additional cases to test regardless you have it added or not
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can try to log into a new account that doesn't have address added to test it
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let me give it a try
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This occurs with new accounts as well: Screen.Recording.2024-07-29.at.4.32.02.PM.movIMO
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @allgandalf fixed! I forgot that I changed |
||
| default: | ||
| return ''; | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <> | ||
| <RenderHTML html={`<muted-text>${getTranslation()}</muted-text>`} /> | ||
| {noMailingAddress && ( | ||
| <Button | ||
| onPress={() => Navigation.navigate(ROUTES.SETTINGS_ADDRESS)} | ||
| success | ||
| medium | ||
| style={[styles.alignSelfStart, styles.mt3]} | ||
| text={translate('workspace.expensifyCard.addMailingAddress')} | ||
| /> | ||
| )} | ||
| </> | ||
| ); | ||
| } | ||
|
|
||
| IssueCardMessage.displayName = 'IssueCardMessage'; | ||
|
|
||
| export default IssueCardMessage; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,7 @@ import type { | |
| GoBackMessageParams, | ||
| GoToRoomParams, | ||
| InstantSummaryParams, | ||
| IssueVirtualCardParams, | ||
| LocalTimeParams, | ||
| LoggedInAsParams, | ||
| LogSizeParams, | ||
|
|
@@ -2707,6 +2708,11 @@ export default { | |
| `If you change this card's limit type to Smart Limit, new transactions will be declined because the ${limit} unapproved limit has already been reached.`, | ||
| changeCardMonthlyLimitTypeWarning: (limit: string) => | ||
| `If you change this card's limit type to Monthly, new transactions will be declined because the ${limit} monthly limit has already been reached.`, | ||
| addMailingAddress: 'Add mailing address', | ||
| issuedCard: (assignee: string) => `issued ${assignee} an Expensify Card! The card will arrive in 2-3 business days.`, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't have the Admin's name in the message in Figma https://www.figma.com/design/9J4v6CzMVLQbzXMnXC5Izq/%23wave-collect%3A-Workspace-Card-Feeds?node-id=2565-32040&t=p5sUZgAYMIDW3Lsb-0
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Odd :) If we are matching with the figma mocks, I'm okay with the current state, thanks for mentioning |
||
| issuedCardNoMailingAddress: (assignee: string) => `issued ${assignee} an Expensify Card! The card will be shipped once a mailing address is added.`, | ||
This comment was marked as resolved.
Sorry, something went wrong.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay i ready the convo #44307 (comment), I'll mark this as resolved |
||
| issuedCardVirtual: ({assignee, link}: IssueVirtualCardParams) => `issued ${assignee} a virtual ${link}! The card can be used right away.`, | ||
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay i ready the convo #44307 (comment), I'll mark this as resolved |
||
| addedAddress: (assignee: string) => `${assignee} added the address. Expensify Card will arrive in 2-3 business days.`, | ||
This comment was marked as resolved.
Sorry, something went wrong.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay i ready the convo #44307 (comment), I'll mark this as resolved |
||
| }, | ||
| categories: { | ||
| deleteCategories: 'Delete categories', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,7 @@ import type { | |
| GoBackMessageParams, | ||
| GoToRoomParams, | ||
| InstantSummaryParams, | ||
| IssueVirtualCardParams, | ||
| LocalTimeParams, | ||
| LoggedInAsParams, | ||
| LogSizeParams, | ||
|
|
@@ -2759,6 +2760,11 @@ export default { | |
| `Si cambias el tipo de límite de esta tarjeta a Límite inteligente, las nuevas transacciones serán rechazadas porque ya se ha alcanzado el límite de ${limit} no aprobado.`, | ||
| changeCardMonthlyLimitTypeWarning: (limit: string) => | ||
| `Si cambias el tipo de límite de esta tarjeta a Mensual, las nuevas transacciones serán rechazadas porque ya se ha alcanzado el límite de ${limit} mensual.`, | ||
| addMailingAddress: 'Añadir dirección de postal', | ||
| issuedCard: (assignee: string) => `¡emitió a ${assignee} una Tarjeta Expensify! La tarjeta llegará en 2-3 días laborables.`, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| issuedCardNoMailingAddress: (assignee: string) => `¡emitió a ${assignee} una Tarjeta Expensify! La tarjeta se enviará una vez que se añada una dirección postal.`, | ||
| issuedCardVirtual: ({assignee, link}: IssueVirtualCardParams) => `¡emitió a ${assignee} una ${link} virtual! La tarjeta puede utilizarse inmediatamente.`, | ||
| addedAddress: (assignee: string) => `${assignee} ha añadido la dirección. Tarjeta Expensify llegará en 2-3 días hábiles.`, | ||
| }, | ||
| categories: { | ||
| deleteCategories: 'Eliminar categorías', | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.