From 18d1650d1706f045b1c55c2519cb47ffb26657a8 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Thu, 4 Apr 2024 18:55:57 +0700 Subject: [PATCH 01/59] fix: Generate Workspace Avatar Color based on PolicyID instead of Workspace Name --- src/components/Avatar.tsx | 8 ++++++-- src/components/HeaderWithBackButton/index.tsx | 1 + src/components/MentionSuggestions.tsx | 1 + src/components/MultipleAvatars.tsx | 4 ++++ src/components/RoomHeaderAvatars.tsx | 2 ++ src/components/SubscriptAvatar.tsx | 2 ++ src/components/WorkspaceSwitcherButton.tsx | 2 +- src/libs/ReportUtils.ts | 4 ++-- src/pages/WorkspaceSwitcherPage.tsx | 2 +- src/pages/home/report/ReportActionItemSingle.tsx | 1 + src/pages/workspace/WorkspaceInitialPage.tsx | 1 + src/pages/workspace/WorkspaceProfilePage.tsx | 3 ++- src/pages/workspace/WorkspacesListPage.tsx | 1 + src/pages/workspace/WorkspacesListRow.tsx | 5 +++++ src/styles/utils/index.ts | 4 ++-- 15 files changed, 32 insertions(+), 9 deletions(-) diff --git a/src/components/Avatar.tsx b/src/components/Avatar.tsx index 2b2d0a60f657..62d62a4a1760 100644 --- a/src/components/Avatar.tsx +++ b/src/components/Avatar.tsx @@ -49,6 +49,9 @@ type AvatarProps = { /** Owner of the avatar. If user, displayName. If workspace, policy name */ name?: string; + + /** ID of the policy */ + policyID?: number | string; }; function Avatar({ @@ -62,6 +65,7 @@ function Avatar({ fallbackIconTestID = '', type = CONST.ICON_TYPE_AVATAR, name = '', + policyID, }: AvatarProps) { const theme = useTheme(); const styles = useThemeStyles(); @@ -84,7 +88,7 @@ function Avatar({ const imageStyle: StyleProp = [StyleUtils.getAvatarStyle(size), imageStyles, styles.noBorderRadius]; const iconStyle = imageStyles ? [StyleUtils.getAvatarStyle(size), styles.bgTransparent, imageStyles] : undefined; - const iconFillColor = isWorkspace ? StyleUtils.getDefaultWorkspaceAvatarColor(name).fill : fill; + const iconFillColor = isWorkspace ? StyleUtils.getDefaultWorkspaceAvatarColor(policyID?.toString() ?? '').fill : fill; const fallbackAvatar = isWorkspace ? ReportUtils.getDefaultWorkspaceAvatar(name) : fallbackIcon || Expensicons.FallbackAvatar; const fallbackAvatarTestID = isWorkspace ? ReportUtils.getDefaultWorkspaceAvatarTestID(name) : fallbackIconTestID || 'SvgFallbackAvatar Icon'; @@ -110,7 +114,7 @@ function Avatar({ fill={imageError ? theme.offline : iconFillColor} additionalStyles={[ StyleUtils.getAvatarBorderStyle(size, type), - isWorkspace && StyleUtils.getDefaultWorkspaceAvatarColor(name), + isWorkspace && StyleUtils.getDefaultWorkspaceAvatarColor(policyID?.toString() ?? ''), imageError && StyleUtils.getBackgroundColorStyle(theme.fallbackIconColor), iconAdditionalStyles, ]} diff --git a/src/components/HeaderWithBackButton/index.tsx b/src/components/HeaderWithBackButton/index.tsx index f3293596aa46..c20f2fdda1d2 100755 --- a/src/components/HeaderWithBackButton/index.tsx +++ b/src/components/HeaderWithBackButton/index.tsx @@ -124,6 +124,7 @@ function HeaderWithBackButton({ containerStyles={[StyleUtils.getWidthAndHeightStyle(StyleUtils.getAvatarSize(CONST.AVATAR_SIZE.DEFAULT)), styles.mr3]} source={policyAvatar?.source} name={policyAvatar?.name} + policyID={policyAvatar?.id} type={policyAvatar?.type} /> )} diff --git a/src/components/MentionSuggestions.tsx b/src/components/MentionSuggestions.tsx index 23040a242807..1ed0e6441757 100644 --- a/src/components/MentionSuggestions.tsx +++ b/src/components/MentionSuggestions.tsx @@ -72,6 +72,7 @@ function MentionSuggestions({prefix, mentions, highlightedMentionIndex = 0, onSe source={item.icons[0].source} size={isIcon ? CONST.AVATAR_SIZE.MENTION_ICON : CONST.AVATAR_SIZE.SMALLER} name={item.icons[0].name} + policyID={item.icons[0].id} type={item.icons[0].type} fill={isIcon ? theme.success : undefined} fallbackIcon={item.icons[0].fallbackIcon} diff --git a/src/components/MultipleAvatars.tsx b/src/components/MultipleAvatars.tsx index dedaba500a9c..14acbd62fc1d 100644 --- a/src/components/MultipleAvatars.tsx +++ b/src/components/MultipleAvatars.tsx @@ -156,6 +156,7 @@ function MultipleAvatars({ size={size} fill={icons[0].fill} name={icons[0].name} + policyID={icons[0].id} type={icons[0].type} fallbackIcon={icons[0].fallbackIcon} /> @@ -205,6 +206,7 @@ function MultipleAvatars({ source={icon.source ?? fallbackIcon} size={size} name={icon.name} + policyID={icon.id} type={icon.type} fallbackIcon={icon.fallbackIcon} /> @@ -263,6 +265,7 @@ function MultipleAvatars({ imageStyles={[singleAvatarStyle]} name={icons[0].name} type={icons[0].type} + policyID={icons[0].id} fallbackIcon={icons[0].fallbackIcon} /> @@ -282,6 +285,7 @@ function MultipleAvatars({ size={avatarSize} imageStyles={[singleAvatarStyle]} name={icons[1].name} + policyID={icons[1].id} type={icons[1].type} fallbackIcon={icons[1].fallbackIcon} /> diff --git a/src/components/RoomHeaderAvatars.tsx b/src/components/RoomHeaderAvatars.tsx index c23108adc0ea..227db04b1b55 100644 --- a/src/components/RoomHeaderAvatars.tsx +++ b/src/components/RoomHeaderAvatars.tsx @@ -52,6 +52,7 @@ function RoomHeaderAvatars({icons, reportID, isGroupChat}: RoomHeaderAvatarsProp imageStyles={styles.avatarLarge} size={CONST.AVATAR_SIZE.LARGE} name={icons[0].name} + policyID={icons[0].id} type={icons[0].type} fallbackIcon={icons[0].fallbackIcon} /> @@ -87,6 +88,7 @@ function RoomHeaderAvatars({icons, reportID, isGroupChat}: RoomHeaderAvatarsProp size={CONST.AVATAR_SIZE.LARGE} containerStyles={[...iconStyle, StyleUtils.getAvatarBorderRadius(CONST.AVATAR_SIZE.LARGE_BORDERED, icon.type)]} name={icon.name} + policyID={icon.id} type={icon.type} fallbackIcon={icon.fallbackIcon} /> diff --git a/src/components/SubscriptAvatar.tsx b/src/components/SubscriptAvatar.tsx index 3e0f5fb9785a..744082191884 100644 --- a/src/components/SubscriptAvatar.tsx +++ b/src/components/SubscriptAvatar.tsx @@ -82,6 +82,7 @@ function SubscriptAvatar({ source={mainAvatar?.source} size={size} name={mainAvatar?.name} + policyID={mainAvatar?.id} type={mainAvatar?.type} fallbackIcon={mainAvatar?.fallbackIcon} /> @@ -108,6 +109,7 @@ function SubscriptAvatar({ size={isSmall ? CONST.AVATAR_SIZE.SMALL_SUBSCRIPT : CONST.AVATAR_SIZE.SUBSCRIPT} fill={secondaryAvatar.fill} name={secondaryAvatar.name} + policyID={secondaryAvatar.id} type={secondaryAvatar.type} fallbackIcon={secondaryAvatar.fallbackIcon} /> diff --git a/src/components/WorkspaceSwitcherButton.tsx b/src/components/WorkspaceSwitcherButton.tsx index a94f54682c85..6c0d5c2797e3 100644 --- a/src/components/WorkspaceSwitcherButton.tsx +++ b/src/components/WorkspaceSwitcherButton.tsx @@ -31,7 +31,7 @@ function WorkspaceSwitcherButton({policy}: WorkspaceSwitcherButtonProps) { const avatar = policy?.avatar ? policy.avatar : getDefaultWorkspaceAvatar(policy?.name); return { source: avatar, - name: policy?.name ?? '', + name: policy?.id ?? '', type: CONST.ICON_TYPE_WORKSPACE, }; }, [policy]); diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 98577e73766a..17719331950b 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -1653,7 +1653,7 @@ function getWorkspaceIcon(report: OnyxEntry, policy: OnyxEntry = source: policyExpenseChatAvatarSource ?? '', type: CONST.ICON_TYPE_WORKSPACE, name: workspaceName, - id: -1, + id: report?.policyID, }; return workspaceIcon; } @@ -1800,7 +1800,7 @@ function getIcons( source: policyExpenseChatAvatarSource, type: CONST.ICON_TYPE_WORKSPACE, name: domainName ?? '', - id: -1, + id: report?.policyID, }; return [domainIcon]; } diff --git a/src/pages/WorkspaceSwitcherPage.tsx b/src/pages/WorkspaceSwitcherPage.tsx index 6f077f764474..28b8f063034a 100644 --- a/src/pages/WorkspaceSwitcherPage.tsx +++ b/src/pages/WorkspaceSwitcherPage.tsx @@ -134,7 +134,7 @@ function WorkspaceSwitcherPage({policies}: WorkspaceSwitcherPageProps) { { source: policy?.avatar ? policy.avatar : ReportUtils.getDefaultWorkspaceAvatar(policy?.name), fallbackIcon: Expensicons.FallbackWorkspaceAvatar, - name: policy?.name, + name: policy?.id, type: CONST.ICON_TYPE_WORKSPACE, }, ], diff --git a/src/pages/home/report/ReportActionItemSingle.tsx b/src/pages/home/report/ReportActionItemSingle.tsx index 696cd7a7d850..5c6edd5ef7a4 100644 --- a/src/pages/home/report/ReportActionItemSingle.tsx +++ b/src/pages/home/report/ReportActionItemSingle.tsx @@ -199,6 +199,7 @@ function ReportActionItemSingle({ source={icon.source} type={icon.type} name={icon.name} + policyID={icon.id} fallbackIcon={fallbackIcon} /> diff --git a/src/pages/workspace/WorkspaceInitialPage.tsx b/src/pages/workspace/WorkspaceInitialPage.tsx index 512b637f7f46..88f6555e99ac 100644 --- a/src/pages/workspace/WorkspaceInitialPage.tsx +++ b/src/pages/workspace/WorkspaceInitialPage.tsx @@ -242,6 +242,7 @@ function WorkspaceInitialPage({policyDraft, policy: policyProp, policyMembers, r source: avatar, name: policy?.name ?? '', type: CONST.ICON_TYPE_WORKSPACE, + id: policy.id ?? '', }; }, [policy]); diff --git a/src/pages/workspace/WorkspaceProfilePage.tsx b/src/pages/workspace/WorkspaceProfilePage.tsx index 662335d0b358..06b1e95b7bee 100644 --- a/src/pages/workspace/WorkspaceProfilePage.tsx +++ b/src/pages/workspace/WorkspaceProfilePage.tsx @@ -83,10 +83,11 @@ function WorkspaceProfilePage({policy, currencyList = {}, route}: WorkSpaceProfi fallbackIcon={Expensicons.FallbackWorkspaceAvatar} size={CONST.AVATAR_SIZE.XLARGE} name={policyName} + policyID={policy?.id ?? ''} type={CONST.ICON_TYPE_WORKSPACE} /> ), - [policy?.avatar, policyName, styles.alignSelfCenter, styles.avatarXLarge], + [policy?.avatar, policy?.id, policyName, styles.alignSelfCenter, styles.avatarXLarge], ); const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false); diff --git a/src/pages/workspace/WorkspacesListPage.tsx b/src/pages/workspace/WorkspacesListPage.tsx index 549d307b2a2f..9e5f24d8882a 100755 --- a/src/pages/workspace/WorkspacesListPage.tsx +++ b/src/pages/workspace/WorkspacesListPage.tsx @@ -200,6 +200,7 @@ function WorkspacesListPage({policies, allPolicyMembers, reimbursementAccount, r {({hovered}) => ( Date: Thu, 4 Apr 2024 19:32:18 +0700 Subject: [PATCH 02/59] change name props Avatar --- src/components/Avatar.tsx | 10 +++++----- src/components/HeaderWithBackButton/index.tsx | 2 +- src/components/MentionSuggestions.tsx | 2 +- src/components/MultipleAvatars.tsx | 8 ++++---- src/components/RoomHeaderAvatars.tsx | 4 ++-- src/components/SubscriptAvatar.tsx | 4 ++-- src/pages/home/report/ReportActionItemSingle.tsx | 2 +- src/pages/workspace/WorkspaceProfilePage.tsx | 2 +- src/pages/workspace/WorkspacesListRow.tsx | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/components/Avatar.tsx b/src/components/Avatar.tsx index 62d62a4a1760..af492376a191 100644 --- a/src/components/Avatar.tsx +++ b/src/components/Avatar.tsx @@ -50,8 +50,8 @@ type AvatarProps = { /** Owner of the avatar. If user, displayName. If workspace, policy name */ name?: string; - /** ID of the policy */ - policyID?: number | string; + /** ID of the Icon */ + iconID?: number | string; }; function Avatar({ @@ -65,7 +65,7 @@ function Avatar({ fallbackIconTestID = '', type = CONST.ICON_TYPE_AVATAR, name = '', - policyID, + iconID, }: AvatarProps) { const theme = useTheme(); const styles = useThemeStyles(); @@ -88,7 +88,7 @@ function Avatar({ const imageStyle: StyleProp = [StyleUtils.getAvatarStyle(size), imageStyles, styles.noBorderRadius]; const iconStyle = imageStyles ? [StyleUtils.getAvatarStyle(size), styles.bgTransparent, imageStyles] : undefined; - const iconFillColor = isWorkspace ? StyleUtils.getDefaultWorkspaceAvatarColor(policyID?.toString() ?? '').fill : fill; + const iconFillColor = isWorkspace ? StyleUtils.getDefaultWorkspaceAvatarColor(iconID?.toString() ?? '').fill : fill; const fallbackAvatar = isWorkspace ? ReportUtils.getDefaultWorkspaceAvatar(name) : fallbackIcon || Expensicons.FallbackAvatar; const fallbackAvatarTestID = isWorkspace ? ReportUtils.getDefaultWorkspaceAvatarTestID(name) : fallbackIconTestID || 'SvgFallbackAvatar Icon'; @@ -114,7 +114,7 @@ function Avatar({ fill={imageError ? theme.offline : iconFillColor} additionalStyles={[ StyleUtils.getAvatarBorderStyle(size, type), - isWorkspace && StyleUtils.getDefaultWorkspaceAvatarColor(policyID?.toString() ?? ''), + isWorkspace && StyleUtils.getDefaultWorkspaceAvatarColor(iconID?.toString() ?? ''), imageError && StyleUtils.getBackgroundColorStyle(theme.fallbackIconColor), iconAdditionalStyles, ]} diff --git a/src/components/HeaderWithBackButton/index.tsx b/src/components/HeaderWithBackButton/index.tsx index c20f2fdda1d2..17b79a19bde3 100755 --- a/src/components/HeaderWithBackButton/index.tsx +++ b/src/components/HeaderWithBackButton/index.tsx @@ -124,7 +124,7 @@ function HeaderWithBackButton({ containerStyles={[StyleUtils.getWidthAndHeightStyle(StyleUtils.getAvatarSize(CONST.AVATAR_SIZE.DEFAULT)), styles.mr3]} source={policyAvatar?.source} name={policyAvatar?.name} - policyID={policyAvatar?.id} + iconID={policyAvatar?.id} type={policyAvatar?.type} /> )} diff --git a/src/components/MentionSuggestions.tsx b/src/components/MentionSuggestions.tsx index 1ed0e6441757..009003b2367c 100644 --- a/src/components/MentionSuggestions.tsx +++ b/src/components/MentionSuggestions.tsx @@ -72,7 +72,7 @@ function MentionSuggestions({prefix, mentions, highlightedMentionIndex = 0, onSe source={item.icons[0].source} size={isIcon ? CONST.AVATAR_SIZE.MENTION_ICON : CONST.AVATAR_SIZE.SMALLER} name={item.icons[0].name} - policyID={item.icons[0].id} + iconID={item.icons[0].id} type={item.icons[0].type} fill={isIcon ? theme.success : undefined} fallbackIcon={item.icons[0].fallbackIcon} diff --git a/src/components/MultipleAvatars.tsx b/src/components/MultipleAvatars.tsx index 14acbd62fc1d..cbceace6df16 100644 --- a/src/components/MultipleAvatars.tsx +++ b/src/components/MultipleAvatars.tsx @@ -156,7 +156,7 @@ function MultipleAvatars({ size={size} fill={icons[0].fill} name={icons[0].name} - policyID={icons[0].id} + iconID={icons[0].id} type={icons[0].type} fallbackIcon={icons[0].fallbackIcon} /> @@ -206,7 +206,7 @@ function MultipleAvatars({ source={icon.source ?? fallbackIcon} size={size} name={icon.name} - policyID={icon.id} + iconID={icon.id} type={icon.type} fallbackIcon={icon.fallbackIcon} /> @@ -265,7 +265,7 @@ function MultipleAvatars({ imageStyles={[singleAvatarStyle]} name={icons[0].name} type={icons[0].type} - policyID={icons[0].id} + iconID={icons[0].id} fallbackIcon={icons[0].fallbackIcon} /> @@ -285,7 +285,7 @@ function MultipleAvatars({ size={avatarSize} imageStyles={[singleAvatarStyle]} name={icons[1].name} - policyID={icons[1].id} + iconID={icons[1].id} type={icons[1].type} fallbackIcon={icons[1].fallbackIcon} /> diff --git a/src/components/RoomHeaderAvatars.tsx b/src/components/RoomHeaderAvatars.tsx index 227db04b1b55..5738f58af6ff 100644 --- a/src/components/RoomHeaderAvatars.tsx +++ b/src/components/RoomHeaderAvatars.tsx @@ -52,7 +52,7 @@ function RoomHeaderAvatars({icons, reportID, isGroupChat}: RoomHeaderAvatarsProp imageStyles={styles.avatarLarge} size={CONST.AVATAR_SIZE.LARGE} name={icons[0].name} - policyID={icons[0].id} + iconID={icons[0].id} type={icons[0].type} fallbackIcon={icons[0].fallbackIcon} /> @@ -88,7 +88,7 @@ function RoomHeaderAvatars({icons, reportID, isGroupChat}: RoomHeaderAvatarsProp size={CONST.AVATAR_SIZE.LARGE} containerStyles={[...iconStyle, StyleUtils.getAvatarBorderRadius(CONST.AVATAR_SIZE.LARGE_BORDERED, icon.type)]} name={icon.name} - policyID={icon.id} + iconID={icon.id} type={icon.type} fallbackIcon={icon.fallbackIcon} /> diff --git a/src/components/SubscriptAvatar.tsx b/src/components/SubscriptAvatar.tsx index 744082191884..d7ddb9ddf9b0 100644 --- a/src/components/SubscriptAvatar.tsx +++ b/src/components/SubscriptAvatar.tsx @@ -82,7 +82,7 @@ function SubscriptAvatar({ source={mainAvatar?.source} size={size} name={mainAvatar?.name} - policyID={mainAvatar?.id} + iconID={mainAvatar?.id} type={mainAvatar?.type} fallbackIcon={mainAvatar?.fallbackIcon} /> @@ -109,7 +109,7 @@ function SubscriptAvatar({ size={isSmall ? CONST.AVATAR_SIZE.SMALL_SUBSCRIPT : CONST.AVATAR_SIZE.SUBSCRIPT} fill={secondaryAvatar.fill} name={secondaryAvatar.name} - policyID={secondaryAvatar.id} + iconID={secondaryAvatar.id} type={secondaryAvatar.type} fallbackIcon={secondaryAvatar.fallbackIcon} /> diff --git a/src/pages/home/report/ReportActionItemSingle.tsx b/src/pages/home/report/ReportActionItemSingle.tsx index 5c6edd5ef7a4..ecfa4f603aa7 100644 --- a/src/pages/home/report/ReportActionItemSingle.tsx +++ b/src/pages/home/report/ReportActionItemSingle.tsx @@ -199,7 +199,7 @@ function ReportActionItemSingle({ source={icon.source} type={icon.type} name={icon.name} - policyID={icon.id} + iconID={icon.id} fallbackIcon={fallbackIcon} /> diff --git a/src/pages/workspace/WorkspaceProfilePage.tsx b/src/pages/workspace/WorkspaceProfilePage.tsx index 06b1e95b7bee..c328bea9bb96 100644 --- a/src/pages/workspace/WorkspaceProfilePage.tsx +++ b/src/pages/workspace/WorkspaceProfilePage.tsx @@ -83,7 +83,7 @@ function WorkspaceProfilePage({policy, currencyList = {}, route}: WorkSpaceProfi fallbackIcon={Expensicons.FallbackWorkspaceAvatar} size={CONST.AVATAR_SIZE.XLARGE} name={policyName} - policyID={policy?.id ?? ''} + iconID={policy?.id ?? ''} type={CONST.ICON_TYPE_WORKSPACE} /> ), diff --git a/src/pages/workspace/WorkspacesListRow.tsx b/src/pages/workspace/WorkspacesListRow.tsx index d3a3ce3f8399..dfe91b7d1f8a 100644 --- a/src/pages/workspace/WorkspacesListRow.tsx +++ b/src/pages/workspace/WorkspacesListRow.tsx @@ -148,7 +148,7 @@ function WorkspacesListRow({ source={workspaceIcon} fallbackIcon={fallbackWorkspaceIcon} name={title} - policyID={policyID} + iconID={policyID} type={CONST.ICON_TYPE_WORKSPACE} /> Date: Wed, 10 Apr 2024 12:10:54 +0530 Subject: [PATCH 03/59] Use periods at the end of error messages --- package-lock.json | 6 +- package.json | 2 +- src/languages/en.ts | 142 ++++++++++++++++++------------------ src/languages/es.ts | 170 ++++++++++++++++++++++---------------------- 4 files changed, 161 insertions(+), 159 deletions(-) diff --git a/package-lock.json b/package-lock.json index d61279efb85b..834f3a225ac7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -206,7 +206,7 @@ "electron-builder": "24.13.2", "eslint": "^7.6.0", "eslint-config-airbnb-typescript": "^17.1.0", - "eslint-config-expensify": "^2.0.44", + "eslint-config-expensify": "^2.0.46", "eslint-config-prettier": "^8.8.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-jest": "^24.1.0", @@ -26606,7 +26606,9 @@ } }, "node_modules/eslint-config-expensify": { - "version": "2.0.44", + "version": "2.0.46", + "resolved": "https://js-registry.sharechat.com/eslint-config-expensify/-/eslint-config-expensify-2.0.46.tgz", + "integrity": "sha512-yRJ1GmIKTN0e0x1bCHbefzvLVlQJeM1Xv7zXuRfY1nll1s0F4f6HI6vs/kMpveWn/KzcKhBmrNqASGslhRUb3A==", "dev": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index 0e988576aaa4..13f4c394d2d7 100644 --- a/package.json +++ b/package.json @@ -257,7 +257,7 @@ "electron-builder": "24.13.2", "eslint": "^7.6.0", "eslint-config-airbnb-typescript": "^17.1.0", - "eslint-config-expensify": "^2.0.44", + "eslint-config-expensify": "^2.0.46", "eslint-config-prettier": "^8.8.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-jest": "^24.1.0", diff --git a/src/languages/en.ts b/src/languages/en.ts index 3b670f7b6ebc..15fa4b9df13e 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -222,20 +222,20 @@ export default { conjunctionAt: 'at', genericErrorMessage: 'Oops... something went wrong and your request could not be completed. Please try again later.', error: { - invalidAmount: 'Invalid amount', - acceptTerms: 'You must accept the Terms of Service to continue', + invalidAmount: 'Invalid amount.', + acceptTerms: 'You must accept the Terms of Service to continue.', phoneNumber: `Please enter a valid phone number, with the country code (e.g. ${CONST.EXAMPLE_PHONE_NUMBER})`, fieldRequired: 'This field is required.', requestModified: 'This request is being modified by another member.', characterLimit: ({limit}: CharacterLimitParams) => `Exceeds the maximum length of ${limit} characters`, characterLimitExceedCounter: ({length, limit}) => `Character limit exceeded (${length}/${limit})`, - dateInvalid: 'Please select a valid date', + dateInvalid: 'Please select a valid date.', invalidDateShouldBeFuture: 'Please choose today or a future date.', invalidTimeShouldBeFuture: 'Please choose a time at least one minute ahead.', - invalidCharacter: 'Invalid character', - enterMerchant: 'Enter a merchant name', - enterAmount: 'Enter an amount', - enterDate: 'Enter a date', + invalidCharacter: 'Invalid character.', + enterMerchant: 'Enter a merchant name.', + enterAmount: 'Enter an amount.', + enterDate: 'Enter a date.', }, comma: 'comma', semicolon: 'semicolon', @@ -695,17 +695,17 @@ export default { invalidCategoryLength: 'The length of the category chosen exceeds the maximum allowed (255). Please choose a different or shorten the category name first.', invalidAmount: 'Please enter a valid amount before continuing.', invalidTaxAmount: ({amount}: RequestAmountParams) => `Maximum tax amount is ${amount}`, - invalidSplit: 'Split amounts do not equal total amount', - other: 'Unexpected error, please try again later', - genericCreateFailureMessage: 'Unexpected error requesting money, please try again later', - receiptFailureMessage: "The receipt didn't upload. ", - saveFileMessage: 'Download the file ', - loseFileMessage: 'or dismiss this error and lose it', - genericDeleteFailureMessage: 'Unexpected error deleting the money request, please try again later', - genericEditFailureMessage: 'Unexpected error editing the money request, please try again later', - genericSmartscanFailureMessage: 'Transaction is missing fields', - duplicateWaypointsErrorMessage: 'Please remove duplicate waypoints', - atLeastTwoDifferentWaypoints: 'Please enter at least two different addresses', + invalidSplit: 'Split amounts do not equal total amount.', + other: 'Unexpected error, please try again later.', + genericCreateFailureMessage: 'Unexpected error requesting money, please try again later.', + receiptFailureMessage: "The receipt didn't upload.", + saveFileMessage: 'Download the file .', + loseFileMessage: 'or dismiss this error and lose it.', + genericDeleteFailureMessage: 'Unexpected error deleting the money request, please try again later.', + genericEditFailureMessage: 'Unexpected error editing the money request, please try again later.', + genericSmartscanFailureMessage: 'Transaction is missing fields.', + duplicateWaypointsErrorMessage: 'Please remove duplicate waypoints.', + atLeastTwoDifferentWaypoints: 'Please enter at least two different addresses.', splitBillMultipleParticipantsErrorMessage: 'Split bill is only allowed between a single workspace or individual users. Please update your selection.', invalidMerchant: 'Please enter a correct merchant.', }, @@ -942,9 +942,9 @@ export default { currentPassword: 'Current password', newPassword: 'New password', newPasswordPrompt: 'New password must be different than your old password, have at least 8 characters, 1 capital letter, 1 lowercase letter, and 1 number.', - errors: { - currentPassword: 'Current password is required', - newPasswordSameAsOld: 'New password must be different than your old password', + error: { + currentPassword: 'Current password is required.', + newPasswordSameAsOld: 'New password must be different than your old password.', newPassword: 'Your password must have at least 8 characters, 1 capital letter, 1 lowercase letter, and 1 number.', }, }, @@ -974,7 +974,7 @@ export default { }, recoveryCodeForm: { error: { - pleaseFillRecoveryCode: 'Please enter your recovery code', + pleaseFillRecoveryCode: 'Please enter your recovery code.', incorrectRecoveryCode: 'Incorrect recovery code. Please try again.', }, useRecoveryCode: 'Use recovery code', @@ -983,7 +983,7 @@ export default { }, twoFactorAuthForm: { error: { - pleaseFillTwoFactorAuth: 'Please enter your two-factor authentication code', + pleaseFillTwoFactorAuth: 'Please enter your two-factor authentication code.', incorrect2fa: 'Incorrect two-factor authentication code. Please try again.', }, }, @@ -998,7 +998,7 @@ export default { composerLabel: 'Notes', myNote: 'My note', error: { - genericFailureMessage: "Private notes couldn't be saved", + genericFailureMessage: "Private notes couldn't be saved.", }, }, addDebitCardPage: { @@ -1013,15 +1013,15 @@ export default { expensifyPassword: 'Expensify password', error: { invalidName: 'Name can only include letters.', - addressZipCode: 'Please enter a valid zip code', - debitCardNumber: 'Please enter a valid debit card number', - expirationDate: 'Please select a valid expiration date', - securityCode: 'Please enter a valid security code', - addressStreet: 'Please enter a valid billing address that is not a PO Box', - addressState: 'Please select a state', - addressCity: 'Please enter a city', - genericFailureMessage: 'An error occurred while adding your card, please try again', - password: 'Please enter your Expensify password', + addressZipCode: 'Please enter a valid zip code.', + debitCardNumber: 'Please enter a valid debit card number.', + expirationDate: 'Please select a valid expiration date.', + securityCode: 'Please enter a valid security code.', + addressStreet: 'Please enter a valid billing address that is not a PO Box.', + addressState: 'Please select a state.', + addressCity: 'Please enter a city.', + genericFailureMessage: 'An error occurred while adding your card, please try again.', + password: 'Please enter your Expensify password.', }, }, walletPage: { @@ -1281,9 +1281,9 @@ export default { requestNewCode: 'Request a new code in ', requestNewCodeAfterErrorOccurred: 'Request a new code', error: { - pleaseFillMagicCode: 'Please enter your magic code', + pleaseFillMagicCode: 'Please enter your magic code.', incorrectMagicCode: 'Incorrect magic code.', - pleaseFillTwoFactorAuth: 'Please enter your two-factor authentication code', + pleaseFillTwoFactorAuth: 'Please enter your two-factor authentication code.', }, }, passwordForm: { @@ -1334,14 +1334,14 @@ export default { [CONST.ONBOARDING_CHOICES.LOOKING_AROUND]: "I'm just looking around", }, error: { - requiredFirstName: 'Please input your first name to continue', - requiredLastName: 'Please input your last name to continue', + requiredFirstName: 'Please input your first name to continue.', + requiredLastName: 'Please input your last name to continue.', }, }, personalDetails: { error: { - containsReservedWord: 'Name cannot contain the words Expensify or Concierge', - hasInvalidCharacter: 'Name cannot contain a comma or semicolon', + containsReservedWord: 'Name cannot contain the words Expensify or Concierge.', + hasInvalidCharacter: 'Name cannot contain a comma or semicolon.', }, }, privatePersonalDetails: { @@ -1479,32 +1479,32 @@ export default { hasCurrencyError: 'Oops! It appears that your workspace currency is set to a different currency than USD. To proceed, please set it to USD and try again', error: { youNeedToSelectAnOption: 'You need to select an option to proceed.', - noBankAccountAvailable: 'Sorry, no bank account is available', - noBankAccountSelected: 'Please choose an account', - taxID: 'Please enter a valid tax ID number', + noBankAccountAvailable: 'Sorry, no bank account is available.', + noBankAccountSelected: 'Please choose an account.', + taxID: 'Please enter a valid tax ID number.', website: 'Please enter a valid website. The website should be in lowercase.', zipCode: `Incorrect zip code format. Acceptable format: ${CONST.COUNTRY_ZIP_REGEX_DATA.US.samples}`, - phoneNumber: 'Please enter a valid phone number', - companyName: 'Please enter a valid legal business name', - addressCity: 'Please enter a valid city', - addressStreet: 'Please enter a valid street address that is not a PO box', - addressState: 'Please select a valid state', - incorporationDateFuture: 'Incorporation date cannot be in the future', - incorporationState: 'Please select a valid state', + phoneNumber: 'Please enter a valid phone number.', + companyName: 'Please enter a valid legal business name.', + addressCity: 'Please enter a valid city.', + addressStreet: 'Please enter a valid street address that is not a PO box.', + addressState: 'Please select a valid state.', + incorporationDateFuture: 'Incorporation date cannot be in the future.', + incorporationState: 'Please select a valid state.', industryCode: 'Please enter a valid industry classification code. Must be 6 digits.', - restrictedBusiness: 'Please confirm company is not on the list of restricted businesses', - routingNumber: 'Please enter a valid routing number', - accountNumber: 'Please enter a valid account number', - routingAndAccountNumberCannotBeSame: 'The routing number and account number cannot be the same', - companyType: 'Please select a valid company type', + restrictedBusiness: 'Please confirm company is not on the list of restricted businesses.', + routingNumber: 'Please enter a valid routing number.', + accountNumber: 'Please enter a valid account number.', + routingAndAccountNumberCannotBeSame: 'The routing number and account number cannot be the same.', + companyType: 'Please select a valid company type.', tooManyAttempts: 'Due to a high number of login attempts, this option has been temporarily disabled for 24 hours. Please try again later or manually enter details instead.', - address: 'Please enter a valid address', - dob: 'Please select a valid date of birth', - age: 'Must be over 18 years old', - ssnLast4: 'Please enter valid last 4 digits of SSN', - firstName: 'Please enter a valid first name', - lastName: 'Please enter a valid last name', - noDefaultDepositAccountOrDebitCardAvailable: 'Please add a default deposit bank account or debit card', + address: 'Please enter a valid address.', + dob: 'Please select a valid date of birth.', + age: 'Must be over 18 years old.', + ssnLast4: 'Please enter valid last 4 digits of SSN.', + firstName: 'Please enter a valid first name.', + lastName: 'Please enter a valid last name.', + noDefaultDepositAccountOrDebitCardAvailable: 'Please add a default deposit bank account or debit card.', validationAmounts: 'The validation amounts you entered are incorrect. Please double-check your bank statement and try again.', }, }, @@ -1767,7 +1767,7 @@ export default { termsAndConditions: 'terms and conditions', certifyTrueAndAccurate: 'I certify that the information provided is true and accurate', error: { - certify: 'Must certify information is true and accurate', + certify: 'Must certify information is true and accurate.', }, }, completeVerificationStep: { @@ -1980,7 +1980,7 @@ export default { foreignDefault: 'Foreign currency default', customTaxName: 'Custom tax name', value: 'Value', - errors: { + error: { taxRateAlreadyExists: 'This tax name is already in use.', valuePercentageRange: 'Please enter a valid percentage between 0 and 100.', customNameRequired: 'Custom tax name is required.', @@ -2449,8 +2449,8 @@ export default { okay: 'Okay', }, error: { - title: 'Update Check Failed', - message: "We couldn't look for an update. Please check again in a bit!", + title: 'Update Check Failed.', + message: "We couldn't look for an update. Please check again in a bit!.", }, }, report: { @@ -2576,10 +2576,10 @@ export default { 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', + enterPhoneEmail: 'Enter a valid email or phone number.', + enterEmail: 'Enter an email.', + enterValidEmail: 'Enter a valid email.', + tryDifferentEmail: 'Please try a different email.', }, }, cardTransactions: { @@ -2601,8 +2601,8 @@ export default { subtitle: 'The map will be generated when you go back online', onlineSubtitle: 'One moment while we set up the map', }, - errors: { - selectSuggestedAddress: 'Please select a suggested address or use current location', + error: { + selectSuggestedAddress: 'Please select a suggested address or use current location.', }, }, reportCardLostOrDamaged: { diff --git a/src/languages/es.ts b/src/languages/es.ts index 5027174b2922..d9ca5932aeff 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -212,20 +212,20 @@ export default { conjunctionAt: 'a', genericErrorMessage: 'Ups... algo no ha ido bien y la acción no se ha podido completar. Por favor, inténtalo más tarde.', error: { - invalidAmount: 'Importe no válido', - acceptTerms: 'Debes aceptar los Términos de Servicio para continuar', + invalidAmount: 'Importe no válido.', + acceptTerms: 'Debes aceptar los Términos de Servicio para continuar.', phoneNumber: `Introduce un teléfono válido, incluyendo el código del país (p. ej. ${CONST.EXAMPLE_PHONE_NUMBER})`, fieldRequired: 'Este campo es obligatorio.', requestModified: 'Esta solicitud está siendo modificada por otro miembro.', characterLimit: ({limit}: CharacterLimitParams) => `Supera el límite de ${limit} caracteres`, characterLimitExceedCounter: ({length, limit}) => `Se superó el límite de caracteres (${length}/${limit})`, - dateInvalid: 'Por favor, selecciona una fecha válida', - invalidDateShouldBeFuture: 'Por favor, elige una fecha igual o posterior a hoy', - invalidTimeShouldBeFuture: 'Por favor, elige una hora al menos un minuto en el futuro', - invalidCharacter: 'Carácter invalido', - enterMerchant: 'Introduce un comerciante', - enterAmount: 'Introduce un importe', - enterDate: 'Introduce una fecha', + dateInvalid: 'Por favor, selecciona una fecha válida.', + invalidDateShouldBeFuture: 'Por favor, elige una fecha igual o posterior a hoy.', + invalidTimeShouldBeFuture: 'Por favor, elige una hora al menos un minuto en el futuro.', + invalidCharacter: 'Carácter invalido.', + enterMerchant: 'Introduce un comerciante.', + enterAmount: 'Introduce un importe.', + enterDate: 'Introduce una fecha.', }, comma: 'la coma', semicolon: 'el punto y coma', @@ -693,17 +693,17 @@ export default { invalidCategoryLength: 'El largo de la categoría escogida excede el máximo permitido (255). Por favor, escoge otra categoría o acorta la categoría primero.', invalidAmount: 'Por favor, ingresa un importe válido antes de continuar.', invalidTaxAmount: ({amount}: RequestAmountParams) => `El importe máximo del impuesto es ${amount}`, - invalidSplit: 'La suma de las partes no equivale al importe total', - other: 'Error inesperado, por favor inténtalo más tarde', - genericCreateFailureMessage: 'Error inesperado solicitando dinero. Por favor, inténtalo más tarde', - receiptFailureMessage: 'El recibo no se subió. ', - saveFileMessage: 'Guarda el archivo ', - loseFileMessage: 'o descarta este error y piérdelo', - genericDeleteFailureMessage: 'Error inesperado eliminando la solicitud de dinero. Por favor, inténtalo más tarde', - genericEditFailureMessage: 'Error inesperado al guardar la solicitud de dinero. Por favor, inténtalo más tarde', - genericSmartscanFailureMessage: 'La transacción tiene campos vacíos', - duplicateWaypointsErrorMessage: 'Por favor, elimina los puntos de ruta duplicados', - atLeastTwoDifferentWaypoints: 'Por favor, introduce al menos dos direcciones diferentes', + invalidSplit: 'La suma de las partes no equivale al importe total.', + other: 'Error inesperado, por favor inténtalo más tarde.', + genericCreateFailureMessage: 'Error inesperado solicitando dinero. Por favor, inténtalo más tarde.', + receiptFailureMessage: 'El recibo no se subió. .', + saveFileMessage: 'Guarda el archivo .', + loseFileMessage: 'o descarta este error y piérdelo.', + genericDeleteFailureMessage: 'Error inesperado eliminando la solicitud de dinero. Por favor, inténtalo más tarde.', + genericEditFailureMessage: 'Error inesperado al guardar la solicitud de dinero. Por favor, inténtalo más tarde.', + genericSmartscanFailureMessage: 'La transacción tiene campos vacíos.', + duplicateWaypointsErrorMessage: 'Por favor, elimina los puntos de ruta duplicados.', + atLeastTwoDifferentWaypoints: 'Por favor, introduce al menos dos direcciones diferentes.', splitBillMultipleParticipantsErrorMessage: 'Solo puedes dividir una cuenta entre un único espacio de trabajo o con usuarios individuales. Por favor, actualiza tu selección.', invalidMerchant: 'Por favor, introduce un comerciante correcto.', }, @@ -940,9 +940,9 @@ export default { currentPassword: 'Contraseña actual', newPassword: 'Nueva contraseña', newPasswordPrompt: 'La nueva contraseña debe ser diferente de la antigua, tener al menos 8 caracteres, 1 letra mayúscula, 1 letra minúscula y 1 número.', - errors: { - currentPassword: 'Contraseña actual es requerido', - newPasswordSameAsOld: 'La nueva contraseña tiene que ser diferente de la antigua', + error: { + currentPassword: 'Contraseña actual es requerido.', + newPasswordSameAsOld: 'La nueva contraseña tiene que ser diferente de la antigua.', newPassword: 'Su contraseña debe tener al menos 8 caracteres, 1 letra mayúscula, 1 letra minúscula y 1 número.', }, }, @@ -973,8 +973,8 @@ export default { }, recoveryCodeForm: { error: { - pleaseFillRecoveryCode: 'Por favor, introduce tu código de recuperación', - incorrectRecoveryCode: 'Código de recuperación incorrecto. Por favor, inténtalo de nuevo', + pleaseFillRecoveryCode: 'Por favor, introduce tu código de recuperación.', + incorrectRecoveryCode: 'Código de recuperación incorrecto. Por favor, inténtalo de nuevo.', }, useRecoveryCode: 'Usar código de recuperación', recoveryCode: 'Código de recuperación', @@ -982,8 +982,8 @@ export default { }, twoFactorAuthForm: { error: { - pleaseFillTwoFactorAuth: 'Por favor, introduce tu código de autenticación de dos factores', - incorrect2fa: 'Código de autenticación de dos factores incorrecto. Por favor, inténtalo de nuevo', + pleaseFillTwoFactorAuth: 'Por favor, introduce tu código de autenticación de dos factores.', + incorrect2fa: 'Código de autenticación de dos factores incorrecto. Por favor, inténtalo de nuevo.', }, }, passwordConfirmationScreen: { @@ -997,7 +997,7 @@ export default { composerLabel: 'Notas', myNote: 'Mi nota', error: { - genericFailureMessage: 'Las notas privadas no han podido ser guardadas', + genericFailureMessage: 'Las notas privadas no han podido ser guardadas.', }, }, addDebitCardPage: { @@ -1012,15 +1012,15 @@ export default { expensifyPassword: 'Contraseña de Expensify', error: { invalidName: 'El nombre sólo puede incluir letras.', - addressZipCode: 'Por favor, introduce un código postal válido', - debitCardNumber: 'Por favor, introduce un número de tarjeta de débito válido', - expirationDate: 'Por favor, selecciona una fecha de vencimiento válida', - securityCode: 'Por favor, introduce un código de seguridad válido', - addressStreet: 'Por favor, introduce una dirección de facturación válida que no sea un apartado postal', - addressState: 'Por favor, selecciona un estado', - addressCity: 'Por favor, introduce una ciudad', - genericFailureMessage: 'Se produjo un error al añadir tu tarjeta. Vuelva a intentarlo', - password: 'Por favor, introduce tu contraseña de Expensify', + addressZipCode: 'Por favor, introduce un código postal válido.', + debitCardNumber: 'Por favor, introduce un número de tarjeta de débito válido.', + expirationDate: 'Por favor, selecciona una fecha de vencimiento válida.', + securityCode: 'Por favor, introduce un código de seguridad válido.', + addressStreet: 'Por favor, introduce una dirección de facturación válida que no sea un apartado postal.', + addressState: 'Por favor, selecciona un estado.', + addressCity: 'Por favor, introduce una ciudad.', + genericFailureMessage: 'Se produjo un error al añadir tu tarjeta. Vuelva a intentarlo.', + password: 'Por favor, introduce tu contraseña de Expensify.', }, }, walletPage: { @@ -1283,9 +1283,9 @@ export default { requestNewCode: 'Pedir un código nuevo en ', requestNewCodeAfterErrorOccurred: 'Solicitar un nuevo código', error: { - pleaseFillMagicCode: 'Por favor, introduce el código mágico', + pleaseFillMagicCode: 'Por favor, introduce el código mágico.', incorrectMagicCode: 'Código mágico incorrecto.', - pleaseFillTwoFactorAuth: 'Por favor, introduce tu código de autenticación de dos factores', + pleaseFillTwoFactorAuth: 'Por favor, introduce tu código de autenticación de dos factores.', }, }, passwordForm: { @@ -1297,15 +1297,15 @@ export default { requiredWhen2FAEnabled: 'Obligatorio cuando A2F está habilitado', error: { incorrectPassword: 'Contraseña incorrecta. Por favor, inténtalo de nuevo.', - incorrectLoginOrPassword: 'Usuario o contraseña incorrectos. Por favor, inténtalo de nuevo', - incorrect2fa: 'Código de autenticación de dos factores incorrecto. Por favor, inténtalo de nuevo', - twoFactorAuthenticationEnabled: 'Tienes autenticación de 2 factores activada en esta cuenta. Por favor, conéctate usando tu email o número de teléfono', - invalidLoginOrPassword: 'Usuario o clave incorrectos. Por favor, inténtalo de nuevo o restablece la contraseña', + incorrectLoginOrPassword: 'Usuario o contraseña incorrectos. Por favor, inténtalo de nuevo.', + incorrect2fa: 'Código de autenticación de dos factores incorrecto. Por favor, inténtalo de nuevo.', + twoFactorAuthenticationEnabled: 'Tienes autenticación de 2 factores activada en esta cuenta. Por favor, conéctate usando tu email o número de teléfono.', + invalidLoginOrPassword: 'Usuario o clave incorrectos. Por favor, inténtalo de nuevo o restablece la contraseña.', unableToResetPassword: - 'No se pudo cambiar tu clave. Probablemente porque el enlace para restablecer la contrasenña ha expirado. Te hemos enviado un nuevo enlace. Comprueba tu bandeja de entrada y carpeta de Spam', - noAccess: 'No tienes acceso a esta aplicación. Por favor, añade tu usuario de GitHub para acceder', - accountLocked: 'Tu cuenta ha sido bloqueada tras varios intentos fallidos. Por favor, inténtalo de nuevo dentro de una hora', - fallback: 'Ha ocurrido un error. Por favor, inténtalo mas tarde', + 'No se pudo cambiar tu clave. Probablemente porque el enlace para restablecer la contrasenña ha expirado. Te hemos enviado un nuevo enlace. Comprueba tu bandeja de entrada y carpeta de Spam.', + noAccess: 'No tienes acceso a esta aplicación. Por favor, añade tu usuario de GitHub para acceder.', + accountLocked: 'Tu cuenta ha sido bloqueada tras varios intentos fallidos. Por favor, inténtalo de nuevo dentro de una hora.', + fallback: 'Ha ocurrido un error. Por favor, inténtalo mas tarde.', }, }, loginForm: { @@ -1336,14 +1336,14 @@ export default { [CONST.ONBOARDING_CHOICES.LOOKING_AROUND]: 'Sólo estoy mirando', }, error: { - requiredFirstName: 'Introduce tu nombre para continuar', - requiredLastName: 'Introduce tu apellido para continuar', + requiredFirstName: 'Introduce tu nombre para continuar.', + requiredLastName: 'Introduce tu apellido para continuar.', }, }, personalDetails: { error: { - containsReservedWord: 'El nombre no puede contener las palabras Expensify o Concierge', - hasInvalidCharacter: 'El nombre no puede contener una coma o un punto y coma', + containsReservedWord: 'El nombre no puede contener las palabras Expensify o Concierge.', + hasInvalidCharacter: 'El nombre no puede contener una coma o un punto y coma.', }, }, privatePersonalDetails: { @@ -1500,33 +1500,33 @@ export default { '¡Ups! Parece que la moneda de tu espacio de trabajo está configurada en una moneda diferente a USD. Para continuar, por favor configúrala en USD e inténtalo nuevamente.', error: { youNeedToSelectAnOption: 'Debes seleccionar una opción para continuar.', - noBankAccountAvailable: 'Lo sentimos, no hay ninguna cuenta bancaria disponible', - noBankAccountSelected: 'Por favor, elige una cuenta bancaria', - taxID: 'Por favor, introduce un número de identificación fiscal válido', + noBankAccountAvailable: 'Lo sentimos, no hay ninguna cuenta bancaria disponible.', + noBankAccountSelected: 'Por favor, elige una cuenta bancaria.', + taxID: 'Por favor, introduce un número de identificación fiscal válido.', website: 'Por favor, introduce un sitio web válido. El sitio web debe estar en minúsculas.', zipCode: `Formato de código postal incorrecto. Formato aceptable: ${CONST.COUNTRY_ZIP_REGEX_DATA.US.samples}`, - phoneNumber: 'Por favor, introduce un teléfono válido', - companyName: 'Por favor, introduce un nombre comercial legal válido', - addressCity: 'Por favor, introduce una ciudad válida', - addressStreet: 'Por favor, introduce una calle de dirección válida que no sea un apartado postal', - addressState: 'Por favor, selecciona un estado', - incorporationDateFuture: 'La fecha de incorporación no puede ser futura', - incorporationState: 'Por favor, selecciona una estado válido', - industryCode: 'Por favor, introduce un código de clasificación de industria válido', - restrictedBusiness: 'Por favor, confirma que la empresa no está en la lista de negocios restringidos', - routingNumber: 'Por favor, introduce un número de ruta válido', - accountNumber: 'Por favor, introduce un número de cuenta válido', - routingAndAccountNumberCannotBeSame: 'El número de ruta y el número de cuenta no pueden ser iguales', - companyType: 'Por favor, selecciona un tipo de compañía válido', + phoneNumber: 'Por favor, introduce un teléfono válido.', + companyName: 'Por favor, introduce un nombre comercial legal válido.', + addressCity: 'Por favor, introduce una ciudad válida.', + addressStreet: 'Por favor, introduce una calle de dirección válida que no sea un apartado postal.', + addressState: 'Por favor, selecciona un estado.', + incorporationDateFuture: 'La fecha de incorporación no puede ser futura.', + incorporationState: 'Por favor, selecciona una estado válido.', + industryCode: 'Por favor, introduce un código de clasificación de industria válido.', + restrictedBusiness: 'Por favor, confirma que la empresa no está en la lista de negocios restringidos.', + routingNumber: 'Por favor, introduce un número de ruta válido.', + accountNumber: 'Por favor, introduce un número de cuenta válido.', + routingAndAccountNumberCannotBeSame: 'El número de ruta y el número de cuenta no pueden ser iguales.', + companyType: 'Por favor, selecciona un tipo de compañía válido.', tooManyAttempts: 'Debido a la gran cantidad de intentos de inicio de sesión, esta opción ha sido desactivada temporalmente durante 24 horas. Por favor, inténtalo de nuevo más tarde.', - address: 'Por favor, introduce una dirección válida', - dob: 'Por favor, selecciona una fecha de nacimiento válida', - age: 'Debe ser mayor de 18 años', - ssnLast4: 'Por favor, introduce los últimos 4 dígitos del número de seguridad social', - firstName: 'Por favor, introduce el nombre', - lastName: 'Por favor, introduce los apellidos', - noDefaultDepositAccountOrDebitCardAvailable: 'Por favor, añade una cuenta bancaria para depósitos o una tarjeta de débito', + address: 'Por favor, introduce una dirección válida.', + dob: 'Por favor, selecciona una fecha de nacimiento válida.', + age: 'Debe ser mayor de 18 años.', + ssnLast4: 'Por favor, introduce los últimos 4 dígitos del número de seguridad social.', + firstName: 'Por favor, introduce el nombre.', + lastName: 'Por favor, introduce los apellidos.', + noDefaultDepositAccountOrDebitCardAvailable: 'Por favor, añade una cuenta bancaria para depósitos o una tarjeta de débito.', validationAmounts: 'Los importes de validación que introduciste son incorrectos. Por favor, comprueba tu cuenta bancaria e inténtalo de nuevo.', }, }, @@ -1793,7 +1793,7 @@ export default { termsAndConditions: 'Términos y condiciones', certifyTrueAndAccurate: 'Certifico que la información dada es correcta', error: { - certify: 'Debe certificar que la información es verdadera y precisa', + certify: 'Debe certificar que la información es verdadera y precisa.', }, }, completeVerificationStep: { @@ -2007,10 +2007,10 @@ export default { foreignDefault: 'Moneda extranjera por defecto', customTaxName: 'Nombre del impuesto', value: 'Valor', - errors: { - taxRateAlreadyExists: 'Ya existe un impuesto con este nombre', + error: { + taxRateAlreadyExists: 'Ya existe un impuesto con este nombre.', customNameRequired: 'El nombre del impuesto es obligatorio.', - valuePercentageRange: 'Por favor, introduce un porcentaje entre 0 y 100', + valuePercentageRange: 'Por favor, introduce un porcentaje entre 0 y 100.', deleteFailureMessage: 'Se ha producido un error al intentar eliminar la tasa de impuesto. Por favor, inténtalo más tarde.', updateFailureMessage: 'Se ha producido un error al intentar modificar la tasa de impuesto. Por favor, inténtalo más tarde.', createFailureMessage: 'Se ha producido un error al intentar crear la tasa de impuesto. Por favor, inténtalo más tarde.', @@ -2481,8 +2481,8 @@ export default { okay: 'Vale', }, error: { - title: 'Comprobación fallida', - message: 'No hemos podido comprobar si existe una actualización. ¡Inténtalo de nuevo más tarde!', + title: 'Comprobación fallida.', + message: 'No hemos podido comprobar si existe una actualización. ¡Inténtalo de nuevo más tarde!.', }, }, report: { @@ -3069,10 +3069,10 @@ export default { 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', + 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.', }, }, cardTransactions: { @@ -3094,7 +3094,7 @@ export default { subtitle: 'El mapa se generará cuando vuelvas a estar en línea', onlineSubtitle: 'Un momento mientras configuramos el mapa', }, - errors: { + error: { selectSuggestedAddress: 'Por favor, selecciona una dirección sugerida o usa la ubicación actual.', }, }, From 4a3822ed03119b14a79fb125f00d5248618cbe7b Mon Sep 17 00:00:00 2001 From: ShridharGoel <35566748+ShridharGoel@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:15:22 +0530 Subject: [PATCH 04/59] Use periods at the end of error messages --- src/libs/actions/TaxRate.ts | 14 +++++++------- .../iou/request/step/IOURequestStepWaypoint.tsx | 4 ++-- .../taxes/WorkspaceTaxesSettingsCustomTaxName.tsx | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libs/actions/TaxRate.ts b/src/libs/actions/TaxRate.ts index ec69ea79b7ee..f8425cd0c40c 100644 --- a/src/libs/actions/TaxRate.ts +++ b/src/libs/actions/TaxRate.ts @@ -39,7 +39,7 @@ const validateTaxName = (policy: Policy, values: FormOnyxValues((acc, taxID) => { acc[taxID] = { pendingAction: null, - errors: ErrorUtils.getMicroSecondOnyxError('workspace.taxes.errors.deleteFailureMessage'), + errors: ErrorUtils.getMicroSecondOnyxError('workspace.taxes.error.deleteFailureMessage'), }; return acc; }, {}), @@ -376,7 +376,7 @@ function updatePolicyTaxValue(policyID: string, taxID: string, taxValue: number) [taxID]: { value: originalTaxRate.value, pendingFields: {value: null}, - errorFields: {value: ErrorUtils.getMicroSecondOnyxError('workspace.taxes.errors.updateFailureMessage')}, + errorFields: {value: ErrorUtils.getMicroSecondOnyxError('workspace.taxes.error.updateFailureMessage')}, }, }, }, @@ -438,7 +438,7 @@ function renamePolicyTax(policyID: string, taxID: string, newName: string) { [taxID]: { name: originalTaxRate.name, pendingFields: {name: null}, - errorFields: {name: ErrorUtils.getMicroSecondOnyxError('workspace.taxes.errors.updateFailureMessage')}, + errorFields: {name: ErrorUtils.getMicroSecondOnyxError('workspace.taxes.error.updateFailureMessage')}, }, }, }, diff --git a/src/pages/iou/request/step/IOURequestStepWaypoint.tsx b/src/pages/iou/request/step/IOURequestStepWaypoint.tsx index 93f9e03a7494..59cc794c2406 100644 --- a/src/pages/iou/request/step/IOURequestStepWaypoint.tsx +++ b/src/pages/iou/request/step/IOURequestStepWaypoint.tsx @@ -96,7 +96,7 @@ function IOURequestStepWaypoint({ // If the user is online, and they are trying to save a value without using the autocomplete, show an error message instructing them to use a selected address instead. // That enables us to save the address with coordinates when it is selected if (!isOffline && waypointValue !== '' && waypointAddress !== waypointValue) { - ErrorUtils.addErrorMessage(errors, `waypoint${pageIndex}`, 'distance.errors.selectSuggestedAddress'); + ErrorUtils.addErrorMessage(errors, `waypoint${pageIndex}`, 'distance.error.selectSuggestedAddress'); } return errors; @@ -204,7 +204,7 @@ function IOURequestStepWaypoint({ ref={(e: HTMLElement | null) => { textInput.current = e as unknown as TextInput; }} - hint={!isOffline ? 'distance.errors.selectSuggestedAddress' : ''} + hint={!isOffline ? 'distance.error.selectSuggestedAddress' : ''} containerStyles={[styles.mt4]} label={translate('distance.address')} defaultValue={waypointAddress} diff --git a/src/pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName.tsx b/src/pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName.tsx index e9e359d9d059..4054e789af27 100644 --- a/src/pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName.tsx +++ b/src/pages/workspace/taxes/WorkspaceTaxesSettingsCustomTaxName.tsx @@ -43,7 +43,7 @@ function WorkspaceTaxesSettingsCustomTaxName({ const customTaxName = values[INPUT_IDS.NAME]; if (!ValidationUtils.isRequiredFulfilled(customTaxName)) { - errors.name = 'workspace.taxes.errors.customNameRequired'; + errors.name = 'workspace.taxes.error.customNameRequired'; } return errors; From f76a57dd1e20a69ba54f17685826029ae25c4434 Mon Sep 17 00:00:00 2001 From: Shridhar Goel <35566748+ShridharGoel@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:32:10 +0530 Subject: [PATCH 05/59] Update package-lock.json --- package-lock.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 834f3a225ac7..220b072a03ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26606,9 +26606,7 @@ } }, "node_modules/eslint-config-expensify": { - "version": "2.0.46", - "resolved": "https://js-registry.sharechat.com/eslint-config-expensify/-/eslint-config-expensify-2.0.46.tgz", - "integrity": "sha512-yRJ1GmIKTN0e0x1bCHbefzvLVlQJeM1Xv7zXuRfY1nll1s0F4f6HI6vs/kMpveWn/KzcKhBmrNqASGslhRUb3A==", + "version": "2.0.45", "dev": true, "license": "ISC", "dependencies": { From b11176ee988c051952a5cc21c91856222956407a Mon Sep 17 00:00:00 2001 From: Shridhar Goel <35566748+ShridharGoel@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:32:36 +0530 Subject: [PATCH 06/59] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 13f4c394d2d7..336254dddf7a 100644 --- a/package.json +++ b/package.json @@ -257,7 +257,7 @@ "electron-builder": "24.13.2", "eslint": "^7.6.0", "eslint-config-airbnb-typescript": "^17.1.0", - "eslint-config-expensify": "^2.0.46", + "eslint-config-expensify": "^2.0.45", "eslint-config-prettier": "^8.8.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-jest": "^24.1.0", From fa80eac51c7356e9c87a7464c69e52441ad91387 Mon Sep 17 00:00:00 2001 From: Shridhar Goel <35566748+ShridharGoel@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:33:34 +0530 Subject: [PATCH 07/59] Update to use 2.0.45 --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 220b072a03ce..f8ec2ca523a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -206,7 +206,7 @@ "electron-builder": "24.13.2", "eslint": "^7.6.0", "eslint-config-airbnb-typescript": "^17.1.0", - "eslint-config-expensify": "^2.0.46", + "eslint-config-expensify": "^2.0.45", "eslint-config-prettier": "^8.8.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-jest": "^24.1.0", From 981c45306e5029735bd9aa13ea2f4796fbcbdc2b Mon Sep 17 00:00:00 2001 From: Shridhar Goel <35566748+ShridharGoel@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:35:35 +0530 Subject: [PATCH 08/59] Update en.ts --- src/languages/en.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 15fa4b9df13e..99126e5fd8d3 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -942,11 +942,6 @@ export default { currentPassword: 'Current password', newPassword: 'New password', newPasswordPrompt: 'New password must be different than your old password, have at least 8 characters, 1 capital letter, 1 lowercase letter, and 1 number.', - error: { - currentPassword: 'Current password is required.', - newPasswordSameAsOld: 'New password must be different than your old password.', - newPassword: 'Your password must have at least 8 characters, 1 capital letter, 1 lowercase letter, and 1 number.', - }, }, twoFactorAuth: { headerTitle: 'Two-factor authentication', From 36d3036fb8176cf561505d1ed1d2a849cbdcc39e Mon Sep 17 00:00:00 2001 From: Shridhar Goel <35566748+ShridharGoel@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:36:08 +0530 Subject: [PATCH 09/59] Update es.ts --- src/languages/es.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index d9ca5932aeff..cb9d9fbc8224 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -940,11 +940,6 @@ export default { currentPassword: 'Contraseña actual', newPassword: 'Nueva contraseña', newPasswordPrompt: 'La nueva contraseña debe ser diferente de la antigua, tener al menos 8 caracteres, 1 letra mayúscula, 1 letra minúscula y 1 número.', - error: { - currentPassword: 'Contraseña actual es requerido.', - newPasswordSameAsOld: 'La nueva contraseña tiene que ser diferente de la antigua.', - newPassword: 'Su contraseña debe tener al menos 8 caracteres, 1 letra mayúscula, 1 letra minúscula y 1 número.', - }, }, twoFactorAuth: { headerTitle: 'Autenticación de dos factores', From f7d00db630e528c677e22972c5e839c004a037f2 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Mon, 15 Apr 2024 23:10:57 +0700 Subject: [PATCH 10/59] fix: workspace icon color in workspace switcher --- .../UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx | 1 + src/components/UserDetailsTooltip/types.tsx | 3 +++ src/pages/WorkspaceSwitcherPage.tsx | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx b/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx index 592cec3beca5..fa301167a230 100644 --- a/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx +++ b/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx @@ -59,6 +59,7 @@ function BaseUserDetailsTooltip({accountID, fallbackUserDetails, icon, delegateA type={icon?.type ?? CONST.ICON_TYPE_AVATAR} name={icon?.name ?? userLogin} fallbackIcon={icon?.fallbackIcon} + iconID={icon?.id} /> {title} diff --git a/src/components/UserDetailsTooltip/types.tsx b/src/components/UserDetailsTooltip/types.tsx index b362c44877a9..7a072d4aa8a9 100644 --- a/src/components/UserDetailsTooltip/types.tsx +++ b/src/components/UserDetailsTooltip/types.tsx @@ -30,6 +30,9 @@ type Icon = { /** Owner of the avatar. If user, displayName. If workspace, policy name */ name?: string; + + /** ID of the Icon */ + id?: string; }; type UserDetailsTooltipProps = ChildrenProps & { diff --git a/src/pages/WorkspaceSwitcherPage.tsx b/src/pages/WorkspaceSwitcherPage.tsx index 2c947af3c2d8..2bd1ebec2a3c 100644 --- a/src/pages/WorkspaceSwitcherPage.tsx +++ b/src/pages/WorkspaceSwitcherPage.tsx @@ -131,8 +131,9 @@ function WorkspaceSwitcherPage({policies}: WorkspaceSwitcherPageProps) { { source: policy?.avatar ? policy.avatar : ReportUtils.getDefaultWorkspaceAvatar(policy?.name), fallbackIcon: Expensicons.FallbackWorkspaceAvatar, - name: policy?.id, + name: policy?.name, type: CONST.ICON_TYPE_WORKSPACE, + id: policy?.id, }, ], boldStyle: hasUnreadData(policy?.id), From 9b2fa9420aa9e3359eb4b4207a2f368f250d7b00 Mon Sep 17 00:00:00 2001 From: ShridharGoel <35566748+ShridharGoel@users.noreply.github.com> Date: Mon, 15 Apr 2024 22:17:00 +0530 Subject: [PATCH 11/59] Update --- .eslintrc.js | 1 + package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index c2198da60c52..21467e061433 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -123,6 +123,7 @@ module.exports = { }, }, ], + 'rulesdir/avoid-anonymous-functions': 'off', }, }, // This helps disable the `prefer-alias` rule to be enabled for specific directories diff --git a/package-lock.json b/package-lock.json index 6013fb5e4dc7..83e1859c889f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -207,7 +207,7 @@ "electron-builder": "24.13.2", "eslint": "^7.6.0", "eslint-config-airbnb-typescript": "^17.1.0", - "eslint-config-expensify": "^2.0.45", + "eslint-config-expensify": "^2.0.46", "eslint-config-prettier": "^8.8.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-jest": "^24.1.0", @@ -19245,7 +19245,7 @@ } }, "node_modules/eslint-config-expensify": { - "version": "2.0.45", + "version": "2.0.46", "dev": true, "license": "ISC", "dependencies": { diff --git a/package.json b/package.json index ab699b006a35..cb27f981084c 100644 --- a/package.json +++ b/package.json @@ -258,7 +258,7 @@ "electron-builder": "24.13.2", "eslint": "^7.6.0", "eslint-config-airbnb-typescript": "^17.1.0", - "eslint-config-expensify": "^2.0.45", + "eslint-config-expensify": "^2.0.46", "eslint-config-prettier": "^8.8.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-jest": "^24.1.0", From c4ec0f7db21d5747caaa622305654bf5148d906f Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Tue, 16 Apr 2024 10:20:20 +0700 Subject: [PATCH 12/59] fix typescript --- src/components/UserDetailsTooltip/types.tsx | 23 ++----------------- .../home/report/ReportActionItemFragment.tsx | 3 +-- src/types/onyx/OnyxCommon.ts | 4 ++-- 3 files changed, 5 insertions(+), 25 deletions(-) diff --git a/src/components/UserDetailsTooltip/types.tsx b/src/components/UserDetailsTooltip/types.tsx index 7a072d4aa8a9..07c9310810be 100644 --- a/src/components/UserDetailsTooltip/types.tsx +++ b/src/components/UserDetailsTooltip/types.tsx @@ -1,5 +1,5 @@ import type {AvatarSource} from '@libs/UserUtils'; -import type {AvatarType} from '@src/types/onyx/OnyxCommon'; +import type {AvatarType, Icon as IconType} from '@src/types/onyx/OnyxCommon'; import type ChildrenProps from '@src/types/utils/ChildrenProps'; type FallbackUserDetails = { @@ -16,25 +16,6 @@ type FallbackUserDetails = { type?: AvatarType; }; -type Icon = { - /** Source for the avatar. Can be a URL or an icon. */ - source?: AvatarSource; - - /** A fallback avatar icon to display when there is an error on loading avatar from remote URL. - * If the avatar is type === workspace, this fallback icon will be ignored and decided based on the name prop. - */ - fallbackIcon?: AvatarSource; - - /** Denotes whether it is an avatar or a workspace avatar */ - type?: AvatarType; - - /** Owner of the avatar. If user, displayName. If workspace, policy name */ - name?: string; - - /** ID of the Icon */ - id?: string; -}; - type UserDetailsTooltipProps = ChildrenProps & { /** User's Account ID */ accountID: number; @@ -43,7 +24,7 @@ type UserDetailsTooltipProps = ChildrenProps & { fallbackUserDetails?: FallbackUserDetails; /** Optionally, pass in the icon instead of calculating it. If defined, will take precedence. */ - icon?: Icon; + icon?: IconType; /** The accountID of the copilot who took this action on behalf of the user */ delegateAccountID?: number; diff --git a/src/pages/home/report/ReportActionItemFragment.tsx b/src/pages/home/report/ReportActionItemFragment.tsx index 07fca587ea24..3091d93858c4 100644 --- a/src/pages/home/report/ReportActionItemFragment.tsx +++ b/src/pages/home/report/ReportActionItemFragment.tsx @@ -1,6 +1,5 @@ import React, {memo} from 'react'; import type {StyleProp, TextStyle} from 'react-native'; -import type {AvatarProps} from '@components/Avatar'; import RenderHTML from '@components/RenderHTML'; import Text from '@components/Text'; import UserDetailsTooltip from '@components/UserDetailsTooltip'; @@ -39,7 +38,7 @@ type ReportActionItemFragmentProps = { delegateAccountID?: number; /** icon */ - actorIcon?: AvatarProps; + actorIcon?: OnyxCommon.Icon; /** Whether the comment is a thread parent message/the first message in a thread */ isThreadParentMessage?: boolean; diff --git a/src/types/onyx/OnyxCommon.ts b/src/types/onyx/OnyxCommon.ts index 8b96a89a2a1b..c4a3afc3e0b9 100644 --- a/src/types/onyx/OnyxCommon.ts +++ b/src/types/onyx/OnyxCommon.ts @@ -25,10 +25,10 @@ type AvatarType = typeof CONST.ICON_TYPE_AVATAR | typeof CONST.ICON_TYPE_WORKSPA type Icon = { /** Avatar source to display */ - source: AvatarSource; + source?: AvatarSource; /** Denotes whether it is an avatar or a workspace avatar */ - type: AvatarType; + type?: AvatarType; /** Owner of the avatar. If user, displayName. If workspace, policy name */ name?: string; From 1044bad394543fde51d2e89b6f935444b5fd3779 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 17 Apr 2024 11:49:42 +0700 Subject: [PATCH 13/59] rename props Avatar --- src/components/Avatar.tsx | 6 +++--- src/components/HeaderWithBackButton/index.tsx | 2 +- src/components/MentionSuggestions.tsx | 2 +- src/components/MultipleAvatars.tsx | 8 ++++---- src/components/RoomHeaderAvatars.tsx | 4 ++-- src/components/SubscriptAvatar.tsx | 4 ++-- .../UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx | 2 +- src/pages/home/report/ReportActionItemSingle.tsx | 2 +- src/pages/workspace/WorkspaceProfilePage.tsx | 2 +- src/pages/workspace/WorkspacesListRow.tsx | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/components/Avatar.tsx b/src/components/Avatar.tsx index dfcf2cc675b9..09d22132b44e 100644 --- a/src/components/Avatar.tsx +++ b/src/components/Avatar.tsx @@ -51,7 +51,7 @@ type AvatarProps = { name?: string; /** ID of the Icon */ - iconID?: number | string; + accountID?: number | string; }; function Avatar({ @@ -65,7 +65,7 @@ function Avatar({ fallbackIconTestID = '', type = CONST.ICON_TYPE_AVATAR, name = '', - iconID, + accountID, }: AvatarProps) { const theme = useTheme(); const styles = useThemeStyles(); @@ -92,7 +92,7 @@ function Avatar({ let iconColors; if (isWorkspace) { - iconColors = StyleUtils.getDefaultWorkspaceAvatarColor(iconID?.toString() ?? ''); + iconColors = StyleUtils.getDefaultWorkspaceAvatarColor(accountID?.toString() ?? ''); } else if (useFallBackAvatar) { iconColors = StyleUtils.getBackgroundColorAndFill(theme.border, theme.icon); } else { diff --git a/src/components/HeaderWithBackButton/index.tsx b/src/components/HeaderWithBackButton/index.tsx index 6e649955880a..29d010d9c803 100755 --- a/src/components/HeaderWithBackButton/index.tsx +++ b/src/components/HeaderWithBackButton/index.tsx @@ -182,7 +182,7 @@ function HeaderWithBackButton({ containerStyles={[StyleUtils.getWidthAndHeightStyle(StyleUtils.getAvatarSize(CONST.AVATAR_SIZE.DEFAULT)), styles.mr3]} source={policyAvatar?.source} name={policyAvatar?.name} - iconID={policyAvatar?.id} + accountID={policyAvatar?.id} type={policyAvatar?.type} /> )} diff --git a/src/components/MentionSuggestions.tsx b/src/components/MentionSuggestions.tsx index e69484eacadd..b11ae4f5ecd8 100644 --- a/src/components/MentionSuggestions.tsx +++ b/src/components/MentionSuggestions.tsx @@ -83,7 +83,7 @@ function MentionSuggestions({prefix, mentions, highlightedMentionIndex = 0, onSe source={item.icons[0].source} size={isIcon ? CONST.AVATAR_SIZE.MENTION_ICON : CONST.AVATAR_SIZE.SMALLER} name={item.icons[0].name} - iconID={item.icons[0].id} + accountID={item.icons[0].id} type={item.icons[0].type} fill={isIcon ? theme.success : undefined} fallbackIcon={item.icons[0].fallbackIcon} diff --git a/src/components/MultipleAvatars.tsx b/src/components/MultipleAvatars.tsx index cbceace6df16..d5fcf6607179 100644 --- a/src/components/MultipleAvatars.tsx +++ b/src/components/MultipleAvatars.tsx @@ -156,7 +156,7 @@ function MultipleAvatars({ size={size} fill={icons[0].fill} name={icons[0].name} - iconID={icons[0].id} + accountID={icons[0].id} type={icons[0].type} fallbackIcon={icons[0].fallbackIcon} /> @@ -206,7 +206,7 @@ function MultipleAvatars({ source={icon.source ?? fallbackIcon} size={size} name={icon.name} - iconID={icon.id} + accountID={icon.id} type={icon.type} fallbackIcon={icon.fallbackIcon} /> @@ -265,7 +265,7 @@ function MultipleAvatars({ imageStyles={[singleAvatarStyle]} name={icons[0].name} type={icons[0].type} - iconID={icons[0].id} + accountID={icons[0].id} fallbackIcon={icons[0].fallbackIcon} /> @@ -285,7 +285,7 @@ function MultipleAvatars({ size={avatarSize} imageStyles={[singleAvatarStyle]} name={icons[1].name} - iconID={icons[1].id} + accountID={icons[1].id} type={icons[1].type} fallbackIcon={icons[1].fallbackIcon} /> diff --git a/src/components/RoomHeaderAvatars.tsx b/src/components/RoomHeaderAvatars.tsx index 341398e44b06..bdb4a0ac78ab 100644 --- a/src/components/RoomHeaderAvatars.tsx +++ b/src/components/RoomHeaderAvatars.tsx @@ -47,7 +47,7 @@ function RoomHeaderAvatars({icons, reportID}: RoomHeaderAvatarsProps) { imageStyles={styles.avatarLarge} size={CONST.AVATAR_SIZE.LARGE} name={icons[0].name} - iconID={icons[0].id} + accountID={icons[0].id} type={icons[0].type} fallbackIcon={icons[0].fallbackIcon} /> @@ -83,7 +83,7 @@ function RoomHeaderAvatars({icons, reportID}: RoomHeaderAvatarsProps) { size={CONST.AVATAR_SIZE.LARGE} containerStyles={[...iconStyle, StyleUtils.getAvatarBorderRadius(CONST.AVATAR_SIZE.LARGE_BORDERED, icon.type)]} name={icon.name} - iconID={icon.id} + accountID={icon.id} type={icon.type} fallbackIcon={icon.fallbackIcon} /> diff --git a/src/components/SubscriptAvatar.tsx b/src/components/SubscriptAvatar.tsx index d7ddb9ddf9b0..cc36657826f6 100644 --- a/src/components/SubscriptAvatar.tsx +++ b/src/components/SubscriptAvatar.tsx @@ -82,7 +82,7 @@ function SubscriptAvatar({ source={mainAvatar?.source} size={size} name={mainAvatar?.name} - iconID={mainAvatar?.id} + accountID={mainAvatar?.id} type={mainAvatar?.type} fallbackIcon={mainAvatar?.fallbackIcon} /> @@ -109,7 +109,7 @@ function SubscriptAvatar({ size={isSmall ? CONST.AVATAR_SIZE.SMALL_SUBSCRIPT : CONST.AVATAR_SIZE.SUBSCRIPT} fill={secondaryAvatar.fill} name={secondaryAvatar.name} - iconID={secondaryAvatar.id} + accountID={secondaryAvatar.id} type={secondaryAvatar.type} fallbackIcon={secondaryAvatar.fallbackIcon} /> diff --git a/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx b/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx index fa301167a230..a530bcfddc46 100644 --- a/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx +++ b/src/components/UserDetailsTooltip/BaseUserDetailsTooltip/index.tsx @@ -59,7 +59,7 @@ function BaseUserDetailsTooltip({accountID, fallbackUserDetails, icon, delegateA type={icon?.type ?? CONST.ICON_TYPE_AVATAR} name={icon?.name ?? userLogin} fallbackIcon={icon?.fallbackIcon} - iconID={icon?.id} + accountID={icon?.id} /> {title} diff --git a/src/pages/home/report/ReportActionItemSingle.tsx b/src/pages/home/report/ReportActionItemSingle.tsx index 59c5b0e240ad..ce8d116a0b2d 100644 --- a/src/pages/home/report/ReportActionItemSingle.tsx +++ b/src/pages/home/report/ReportActionItemSingle.tsx @@ -200,7 +200,7 @@ function ReportActionItemSingle({ source={icon.source} type={icon.type} name={icon.name} - iconID={icon.id} + accountID={icon.id} fallbackIcon={fallbackIcon} /> diff --git a/src/pages/workspace/WorkspaceProfilePage.tsx b/src/pages/workspace/WorkspaceProfilePage.tsx index c328bea9bb96..d872cb0275f1 100644 --- a/src/pages/workspace/WorkspaceProfilePage.tsx +++ b/src/pages/workspace/WorkspaceProfilePage.tsx @@ -83,7 +83,7 @@ function WorkspaceProfilePage({policy, currencyList = {}, route}: WorkSpaceProfi fallbackIcon={Expensicons.FallbackWorkspaceAvatar} size={CONST.AVATAR_SIZE.XLARGE} name={policyName} - iconID={policy?.id ?? ''} + accountID={policy?.id ?? ''} type={CONST.ICON_TYPE_WORKSPACE} /> ), diff --git a/src/pages/workspace/WorkspacesListRow.tsx b/src/pages/workspace/WorkspacesListRow.tsx index 21c14ff8cda4..c9473914eaae 100644 --- a/src/pages/workspace/WorkspacesListRow.tsx +++ b/src/pages/workspace/WorkspacesListRow.tsx @@ -151,7 +151,7 @@ function WorkspacesListRow({ source={workspaceIcon} fallbackIcon={fallbackWorkspaceIcon} name={title} - iconID={policyID} + accountID={policyID} type={CONST.ICON_TYPE_WORKSPACE} /> Date: Thu, 18 Apr 2024 15:09:15 +0700 Subject: [PATCH 14/59] set onfido web full height --- src/components/Onfido/index.css | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/Onfido/index.css b/src/components/Onfido/index.css index 53f7888fc385..66fe571af9cc 100644 --- a/src/components/Onfido/index.css +++ b/src/components/Onfido/index.css @@ -56,10 +56,13 @@ height: 92% !important; } - /* - * Solves issue with height not working for `onfido-sdk-ui-Modal-inner` container when device width is in between 490 - 600pixels. - */ - #onfido-mount { - height: 100%; - } +} + +#onfido-mount { + height: 100%; +} + +#onfido-sdk { + min-height: initial !important; + max-height: initial !important; } \ No newline at end of file From 4a8ff63629644cbbaec2b172498a957e63327fc8 Mon Sep 17 00:00:00 2001 From: Shridhar Goel <35566748+ShridharGoel@users.noreply.github.com> Date: Fri, 19 Apr 2024 16:27:43 +0530 Subject: [PATCH 15/59] Update en.ts --- src/languages/en.ts | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 761399940d1a..0a8d2357f7a5 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -336,8 +336,8 @@ export default { cameraPermissionRequired: 'Camera access', expensifyDoesntHaveAccessToCamera: "Expensify can't take photos without access to your camera. Tap Settings to update permissions.", attachmentError: 'Attachment error', - errorWhileSelectingAttachment: 'An error occurred while selecting an attachment, please try again', - errorWhileSelectingCorruptedImage: 'An error occurred while selecting a corrupted attachment, please try another file', + errorWhileSelectingAttachment: 'An error occurred while selecting an attachment, please try again.', + errorWhileSelectingCorruptedImage: 'An error occurred while selecting a corrupted attachment, please try another file.', takePhoto: 'Take photo', chooseFromGallery: 'Choose from gallery', chooseDocument: 'Choose document', @@ -582,7 +582,7 @@ export default { takePhoto: 'Take a photo', cameraAccess: 'Camera access is required to take pictures of receipts.', cameraErrorTitle: 'Camera Error', - cameraErrorMessage: 'An error occurred while taking a photo, please try again', + cameraErrorMessage: 'An error occurred while taking a photo, please try again.', dropTitle: 'Let it go', dropMessage: 'Drop your file here', flash: 'flash', @@ -1325,7 +1325,7 @@ export default { whatsYourName: "What's your name?", purpose: { title: 'What do you want to do today?', - error: 'Please make a selection before continuing', + error: 'Please make a selection before continuing.', [CONST.ONBOARDING_CHOICES.TRACK]: 'Track business spend for taxes', [CONST.ONBOARDING_CHOICES.EMPLOYER]: 'Get paid back by my employer', [CONST.ONBOARDING_CHOICES.MANAGE_TEAM]: "Manage my team's expenses", @@ -1476,7 +1476,7 @@ export default { }, hasPhoneLoginError: 'To add a verified bank account please ensure your primary login is a valid email and try again. You can add your phone number as a secondary login.', hasBeenThrottledError: 'There was an error adding your bank account. Please wait a few minutes and try again.', - hasCurrencyError: 'Oops! It appears that your workspace currency is set to a different currency than USD. To proceed, please set it to USD and try again', + hasCurrencyError: 'Oops! It appears that your workspace currency is set to a different currency than USD. To proceed, please set it to USD and try again.', error: { youNeedToSelectAnOption: 'You need to select an option to proceed.', noBankAccountAvailable: 'Sorry, no bank account is available.', @@ -1560,7 +1560,7 @@ export default { legalMiddleNameLabel: 'Legal middle name', legalLastNameLabel: 'Legal last name', selectAnswer: 'You need to select a response to proceed.', - ssnFull9Error: 'Please enter a valid 9 digit SSN', + ssnFull9Error: 'Please enter a valid 9 digit SSN.', needSSNFull9: "We're having trouble verifying your SSN. Please enter the full 9 digits of your SSN.", weCouldNotVerify: 'We could not verify', pleaseFixIt: 'Please fix this information before continuing.', @@ -2070,8 +2070,8 @@ export default { unlockNoVBACopy: 'Connect a bank account to reimburse your workspace members online.', fastReimbursementsVBACopy: "You're all set to reimburse receipts from your bank account!", updateCustomUnitError: "Your changes couldn't be saved. The workspace was modified while you were offline, please try again.", - invalidRateError: 'Please enter a valid rate', - lowRateError: 'Rate must be greater than 0', + invalidRateError: 'Please enter a valid rate.', + lowRateError: 'Rate must be greater than 0.', }, accounting: { title: 'Connections', @@ -2155,7 +2155,7 @@ export default { inviteMessagePrompt: 'Make your invitation extra special by adding a message below', personalMessagePrompt: 'Message', genericFailureMessage: 'An error occurred inviting the user to the workspace, please try again.', - inviteNoMembersError: 'Please select at least one member to invite', + inviteNoMembersError: 'Please select at least one member to invite.', }, distanceRates: { oopsNotSoFast: 'Oops! Not so fast...', @@ -2290,11 +2290,11 @@ export default { // eslint-disable-next-line @typescript-eslint/naming-convention public_announceDescription: 'Anyone can find this room', createRoom: 'Create room', - roomAlreadyExistsError: 'A room with this name already exists', + roomAlreadyExistsError: 'A room with this name already exists.', roomNameReservedError: ({reservedName}: RoomNameReservedErrorParams) => `${reservedName} is a default room on all workspaces. Please choose another name.`, - roomNameInvalidError: 'Room names can only include lowercase letters, numbers and hyphens', - pleaseEnterRoomName: 'Please enter a room name', - pleaseSelectWorkspace: 'Please select a workspace', + roomNameInvalidError: 'Room names can only include lowercase letters, numbers and hyphens.', + pleaseEnterRoomName: 'Please enter a room name.', + pleaseSelectWorkspace: 'Please select a workspace.', renamedRoomAction: ({oldName, newName}: RenamedRoomActionParams) => ` renamed this room from ${oldName} to ${newName}`, roomRenamedTo: ({newName}: RoomRenamedToParams) => `Room renamed to ${newName}`, social: 'social', @@ -2382,7 +2382,7 @@ export default { }, generalError: { title: 'Attachment Error', - message: 'Attachment cannot be downloaded', + message: 'Attachment cannot be downloaded.', }, permissionError: { title: 'Storage access', @@ -2457,10 +2457,10 @@ export default { }, }, report: { - genericCreateReportFailureMessage: 'Unexpected error creating this chat, please try again later', - genericAddCommentFailureMessage: 'Unexpected error while posting the comment, please try again later', - genericUpdateReportFieldFailureMessage: 'Unexpected error while updating the field, please try again later', - genericUpdateReporNameEditFailureMessage: 'Unexpected error while renaming the report, please try again later', + genericCreateReportFailureMessage: 'Unexpected error creating this chat, please try again later.', + genericAddCommentFailureMessage: 'Unexpected error while posting the comment, please try again later.', + genericUpdateReportFieldFailureMessage: 'Unexpected error while updating the field, please try again later.', + genericUpdateReporNameEditFailureMessage: 'Unexpected error while renaming the report, please try again later.', noActivityYet: 'No activity yet', }, chronos: { From 36549a848d8a848d6646ff0210a0deab73f6ce94 Mon Sep 17 00:00:00 2001 From: Shridhar Goel <35566748+ShridharGoel@users.noreply.github.com> Date: Fri, 19 Apr 2024 16:36:33 +0530 Subject: [PATCH 16/59] Update es.ts --- src/languages/es.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/languages/es.ts b/src/languages/es.ts index 114577c9aea7..a00eed18b787 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -326,8 +326,8 @@ export default { cameraPermissionRequired: 'Permiso para acceder a la cámara', expensifyDoesntHaveAccessToCamera: 'Expensify no puede tomar fotos sin acceso a la cámara. Haz click en Configuración para actualizar los permisos.', attachmentError: 'Error al adjuntar archivo', - errorWhileSelectingAttachment: 'Ha ocurrido un error al seleccionar un archivo adjunto. Por favor, inténtalo de nuevo', - errorWhileSelectingCorruptedImage: 'Ha ocurrido un error al seleccionar un archivo adjunto corrupto. Por favor, inténtalo con otro archivo', + errorWhileSelectingAttachment: 'Ha ocurrido un error al seleccionar un archivo adjunto. Por favor, inténtalo de nuevo.', + errorWhileSelectingCorruptedImage: 'Ha ocurrido un error al seleccionar un archivo adjunto corrupto. Por favor, inténtalo con otro archivo.', takePhoto: 'Hacer una foto', chooseFromGallery: 'Elegir de la galería', chooseDocument: 'Elegir documento', @@ -1584,7 +1584,7 @@ export default { legalMiddleNameLabel: 'Segundo nombre legal', legalLastNameLabel: 'Apellidos legales', selectAnswer: 'Selecciona una respuesta.', - ssnFull9Error: 'Por favor, introduce los 9 dígitos de un número de seguridad social válido', + ssnFull9Error: 'Por favor, introduce los 9 dígitos de un número de seguridad social válido.', needSSNFull9: 'Estamos teniendo problemas para verificar tu número de seguridad social. Introduce los 9 dígitos del número de seguridad social.', weCouldNotVerify: 'No se pudo verificar', pleaseFixIt: 'Corrige esta información antes de continuar.', @@ -2133,8 +2133,8 @@ export default { unlockNoVBACopy: 'Conecta una cuenta bancaria para reembolsar online a los miembros de tu espacio de trabajo.', fastReimbursementsVBACopy: '¡Todo listo para reembolsar recibos desde tu cuenta bancaria!', updateCustomUnitError: 'Los cambios no han podido ser guardados. El espacio de trabajo ha sido modificado mientras estabas desconectado. Por favor, inténtalo de nuevo.', - invalidRateError: 'Por favor, introduce una tarifa válida', - lowRateError: 'La tarifa debe ser mayor que 0', + invalidRateError: 'Por favor, introduce una tarifa válida.', + lowRateError: 'La tarifa debe ser mayor que 0.', }, bills: { manageYourBills: 'Gestiona tus facturas', @@ -2182,7 +2182,7 @@ export default { inviteMessageTitle: 'Añadir un mensaje', inviteMessagePrompt: 'Añadir un mensaje para hacer tu invitación destacar', personalMessagePrompt: 'Mensaje', - inviteNoMembersError: 'Por favor, selecciona al menos un miembro a invitar', + inviteNoMembersError: 'Por favor, selecciona al menos un miembro a invitar.', genericFailureMessage: 'Se produjo un error al invitar al usuario al espacio de trabajo. Vuelva a intentarlo..', }, distanceRates: { @@ -2320,12 +2320,12 @@ export default { // eslint-disable-next-line @typescript-eslint/naming-convention public_announceDescription: 'Cualquier persona puede unirse a esta sala', createRoom: 'Crea una sala de chat', - roomAlreadyExistsError: 'Ya existe una sala con este nombre', + roomAlreadyExistsError: 'Ya existe una sala con este nombre.', roomNameReservedError: ({reservedName}: RoomNameReservedErrorParams) => `${reservedName} es el nombre una sala por defecto de todos los espacios de trabajo. Por favor, elige otro nombre.`, - roomNameInvalidError: 'Los nombres de las salas solo pueden contener minúsculas, números y guiones', - pleaseEnterRoomName: 'Por favor, escribe el nombre de una sala', - pleaseSelectWorkspace: 'Por favor, selecciona un espacio de trabajo', + roomNameInvalidError: 'Los nombres de las salas solo pueden contener minúsculas, números y guiones.', + pleaseEnterRoomName: 'Por favor, escribe el nombre de una sala.', + pleaseSelectWorkspace: 'Por favor, selecciona un espacio de trabajo.', renamedRoomAction: ({oldName, newName}: RenamedRoomActionParams) => ` cambió el nombre de la sala de ${oldName} a ${newName}`, roomRenamedTo: ({newName}: RoomRenamedToParams) => `Sala renombrada a ${newName}`, social: 'social', @@ -2414,7 +2414,7 @@ export default { }, generalError: { title: 'Error en la descarga', - message: 'No se puede descargar el archivo adjunto', + message: 'No se puede descargar el archivo adjunto.', }, permissionError: { title: 'Permiso para acceder al almacenamiento', @@ -2489,9 +2489,9 @@ export default { }, }, report: { - genericCreateReportFailureMessage: 'Error inesperado al crear el chat. Por favor, inténtalo más tarde', - genericAddCommentFailureMessage: 'Error inesperado al añadir el comentario. Por favor, inténtalo más tarde', - genericUpdateReportFieldFailureMessage: 'Error inesperado al actualizar el campo. Por favor, inténtalo más tarde', + genericCreateReportFailureMessage: 'Error inesperado al crear el chat. Por favor, inténtalo más tarde.', + genericAddCommentFailureMessage: 'Error inesperado al añadir el comentario. Por favor, inténtalo más tarde.', + genericUpdateReportFieldFailureMessage: 'Error inesperado al actualizar el campo. Por favor, inténtalo más tarde.', genericUpdateReporNameEditFailureMessage: 'Error inesperado al cambiar el nombre del informe. Vuelva a intentarlo más tarde.', noActivityYet: 'Sin actividad todavía', }, From eac61eed3efbf58cb46f25dc512a364cd3e8176c Mon Sep 17 00:00:00 2001 From: ShridharGoel <35566748+ShridharGoel@users.noreply.github.com> Date: Fri, 19 Apr 2024 16:50:58 +0530 Subject: [PATCH 17/59] Enable --- .eslintrc.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index 23e522c679aa..0cecabdc9cdd 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -283,5 +283,11 @@ module.exports = { 'no-restricted-syntax': ['error', 'ForInStatement', 'LabeledStatement', 'WithStatement'], }, }, + { + files: ['en.ts', 'es.ts'], + rules: { + 'rulesdir/use-periods-for-error-messages': 'error', + } + } ], }; From 4852a4e9cd0963b37ac2099ec7f29a42827ff74e Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Fri, 19 Apr 2024 22:26:59 +0700 Subject: [PATCH 18/59] Fix workspace avatar in workspace switcher --- src/components/WorkspaceSwitcherButton.tsx | 7 ++++--- src/pages/WorkspaceSwitcherPage/index.tsx | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/WorkspaceSwitcherButton.tsx b/src/components/WorkspaceSwitcherButton.tsx index 0e2465b09995..118fcd0f10a9 100644 --- a/src/components/WorkspaceSwitcherButton.tsx +++ b/src/components/WorkspaceSwitcherButton.tsx @@ -26,7 +26,7 @@ function WorkspaceSwitcherButton({policy}: WorkspaceSwitcherButtonProps) { const pressableRef = useRef(null); - const {source, name, type} = useMemo(() => { + const {source, name, type, id} = useMemo(() => { if (!policy) { return {source: Expensicons.ExpensifyAppIcon, name: CONST.WORKSPACE_SWITCHER.NAME, type: CONST.ICON_TYPE_AVATAR}; } @@ -34,8 +34,9 @@ function WorkspaceSwitcherButton({policy}: WorkspaceSwitcherButtonProps) { const avatar = policy?.avatar ? policy.avatar : getDefaultWorkspaceAvatar(policy?.name); return { source: avatar, - name: policy?.id ?? '', + name: policy?.name ?? '', type: CONST.ICON_TYPE_WORKSPACE, + id: policy?.id ?? '', }; }, [policy]); @@ -55,7 +56,7 @@ function WorkspaceSwitcherButton({policy}: WorkspaceSwitcherButtonProps) { > {({hovered}) => ( Date: Sat, 20 Apr 2024 01:23:14 +0530 Subject: [PATCH 19/59] Update --- .eslintrc.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 0cecabdc9cdd..809576f3de76 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -287,7 +287,7 @@ module.exports = { files: ['en.ts', 'es.ts'], rules: { 'rulesdir/use-periods-for-error-messages': 'error', - } - } + }, + }, ], }; From 9da12c42f15050a60b7b4cb15f28a97dd7f69d42 Mon Sep 17 00:00:00 2001 From: war-in Date: Mon, 22 Apr 2024 13:06:38 +0200 Subject: [PATCH 20/59] mvp --- package-lock.json | 6 ++--- package.json | 2 +- src/libs/ReportUtils.ts | 27 ++++++++++++++++---- src/libs/actions/Policy.ts | 2 +- src/libs/actions/Report.ts | 8 +++--- src/pages/workspace/WorkspaceNewRoomPage.tsx | 2 +- 6 files changed, 32 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8caa0401d28f..8cab4c43db4f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,7 +56,7 @@ "date-fns-tz": "^2.0.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#c0f7f3b6558fbeda0527c80d68460d418afef219", + "expensify-common": "git+ssh://git@github.com:software-mansion-labs/expensify-common.git#7596ae07c9cd5a6b5265897034898b4526d681dc", "expo": "^50.0.3", "expo-av": "~13.10.4", "expo-image": "1.11.0", @@ -20209,8 +20209,8 @@ }, "node_modules/expensify-common": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/Expensify/expensify-common.git#c0f7f3b6558fbeda0527c80d68460d418afef219", - "integrity": "sha512-zz0/y0apISP1orxXEQOgn+Uod45O4wVypwwtaqcDPV4dH1tC3i4L98NoLSZvLn7Y17EcceSkfN6QCEsscgFTDQ==", + "resolved": "git+ssh://git@github.com/software-mansion-labs/expensify-common.git#7596ae07c9cd5a6b5265897034898b4526d681dc", + "integrity": "sha512-Ns7qkMuJ4SeLj0lrj3i+KqHBzjlym8baDlS7CUIqq2tuNXkgxwO4D+5d6U3ooLOf0CyWb56KaGy5TOTFqpJDZA==", "license": "MIT", "dependencies": { "classnames": "2.5.0", diff --git a/package.json b/package.json index 1461f0bfb77f..590bc1c9af79 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "date-fns-tz": "^2.0.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#c0f7f3b6558fbeda0527c80d68460d418afef219", + "expensify-common": "git+ssh://git@github.com:software-mansion-labs/expensify-common.git#7596ae07c9cd5a6b5265897034898b4526d681dc", "expo": "^50.0.3", "expo-av": "~13.10.4", "expo-image": "1.11.0", diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index fc677dedc96e..0d0937c09bc3 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -3161,7 +3161,17 @@ function addDomainToShortMention(mention: string): string | undefined { * For comments shorter than or equal to 10k chars, convert the comment from MD into HTML because that's how it is stored in the database * For longer comments, skip parsing, but still escape the text, and display plaintext for performance reasons. It takes over 40s to parse a 100k long string!! */ -function getParsedComment(text: string, shouldEscapeText?: boolean): string { +function getParsedComment(text: string, shouldEscapeText?: boolean, currentReportID?: string, policyID?: string): string { + let isGroupPolicyReport = false; + if (currentReportID) { + const currentReport = getReport(currentReportID); + isGroupPolicyReport = currentReport && !isEmptyObject(currentReport) ? isGroupPolicy(currentReport) : false; + } + if (policyID) { + const policyType = getPolicy(policyID).type; + isGroupPolicyReport = policyType === CONST.POLICY.TYPE.CORPORATE || policyType === CONST.POLICY.TYPE.TEAM || policyType === CONST.POLICY.TYPE.FREE; + } + const parser = new ExpensiMark(); const textWithMention = text.replace(CONST.REGEX.SHORT_MENTION, (match) => { const mention = match.substring(1); @@ -3169,7 +3179,7 @@ function getParsedComment(text: string, shouldEscapeText?: boolean): string { return mentionWithDomain ? `@${mentionWithDomain}` : match; }); - return text.length <= CONST.MAX_MARKUP_LENGTH ? parser.replace(textWithMention, {shouldEscapeText}) : lodashEscape(text); + return text.length <= CONST.MAX_MARKUP_LENGTH ? parser.replace(textWithMention, {shouldEscapeText, disabledRules: isGroupPolicyReport ? [] : ['reportMentions']}) : lodashEscape(text); } function getReportDescriptionText(report: Report): string { @@ -3190,9 +3200,16 @@ function getPolicyDescriptionText(policy: OnyxEntry): string { return parser.htmlToText(policy.description); } -function buildOptimisticAddCommentReportAction(text?: string, file?: FileObject, actorAccountID?: number, createdOffset = 0, shouldEscapeText?: boolean): OptimisticReportAction { +function buildOptimisticAddCommentReportAction( + text?: string, + file?: FileObject, + actorAccountID?: number, + createdOffset = 0, + shouldEscapeText?: boolean, + reportID?: string, +): OptimisticReportAction { const parser = new ExpensiMark(); - const commentText = getParsedComment(text ?? '', shouldEscapeText); + const commentText = getParsedComment(text ?? '', shouldEscapeText, reportID); const isAttachmentOnly = file && !text; const isTextOnly = text && !file; @@ -3314,7 +3331,7 @@ function buildOptimisticTaskCommentReportAction( childOldestFourAccountIDs?: string; }, ): OptimisticReportAction { - const reportAction = buildOptimisticAddCommentReportAction(text, undefined, undefined, createdOffset); + const reportAction = buildOptimisticAddCommentReportAction(text, undefined, undefined, createdOffset, undefined, taskReportID); if (reportAction.reportAction.message?.[0]) { reportAction.reportAction.message[0].taskReportID = taskReportID; } diff --git a/src/libs/actions/Policy.ts b/src/libs/actions/Policy.ts index cd375b580d85..f2ba65bf0717 100644 --- a/src/libs/actions/Policy.ts +++ b/src/libs/actions/Policy.ts @@ -1722,7 +1722,7 @@ function updateWorkspaceDescription(policyID: string, description: string, curre if (description === currentDescription) { return; } - const parsedDescription = ReportUtils.getParsedComment(description); + const parsedDescription = ReportUtils.getParsedComment(description, undefined, undefined, policyID); const optimisticData: OnyxUpdate[] = [ { diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 8b0dbf8a37a9..f062a4d78c68 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -446,7 +446,7 @@ function addActions(reportID: string, text = '', file?: FileObject) { let commandName: typeof WRITE_COMMANDS.ADD_COMMENT | typeof WRITE_COMMANDS.ADD_ATTACHMENT | typeof WRITE_COMMANDS.ADD_TEXT_AND_ATTACHMENT = WRITE_COMMANDS.ADD_COMMENT; if (text && !file) { - const reportComment = ReportUtils.buildOptimisticAddCommentReportAction(text); + const reportComment = ReportUtils.buildOptimisticAddCommentReportAction(text, undefined, undefined, undefined, undefined, reportID); reportCommentAction = reportComment.reportAction; reportCommentText = reportComment.commentText; } @@ -455,13 +455,13 @@ function addActions(reportID: string, text = '', file?: FileObject) { // When we are adding an attachment we will call AddAttachment. // It supports sending an attachment with an optional comment and AddComment supports adding a single text comment only. commandName = WRITE_COMMANDS.ADD_ATTACHMENT; - const attachment = ReportUtils.buildOptimisticAddCommentReportAction(text, file); + const attachment = ReportUtils.buildOptimisticAddCommentReportAction(text, file, undefined, undefined, undefined, reportID); attachmentAction = attachment.reportAction; } if (text && file) { // When there is both text and a file, the text for the report comment needs to be parsed) - reportCommentText = ReportUtils.getParsedComment(text ?? ''); + reportCommentText = ReportUtils.getParsedComment(text ?? '', undefined, reportID); // And the API command needs to go to the new API which supports combining both text and attachments in a single report action commandName = WRITE_COMMANDS.ADD_TEXT_AND_ATTACHMENT; @@ -1848,7 +1848,7 @@ function updateDescription(reportID: string, previousValue: string, newValue: st return; } - const parsedDescription = ReportUtils.getParsedComment(newValue); + const parsedDescription = ReportUtils.getParsedComment(newValue, undefined, reportID); const optimisticData: OnyxUpdate[] = [ { diff --git a/src/pages/workspace/WorkspaceNewRoomPage.tsx b/src/pages/workspace/WorkspaceNewRoomPage.tsx index 46a5b533372a..b2f9085502eb 100644 --- a/src/pages/workspace/WorkspaceNewRoomPage.tsx +++ b/src/pages/workspace/WorkspaceNewRoomPage.tsx @@ -105,7 +105,7 @@ function WorkspaceNewRoomPage({policies, reports, formState, session, activePoli */ const submit = (values: FormOnyxValues) => { const participants = [session?.accountID ?? 0]; - const parsedDescription = ReportUtils.getParsedComment(values.reportDescription ?? ''); + const parsedDescription = ReportUtils.getParsedComment(values.reportDescription ?? '', undefined, undefined, policyID); const policyReport = ReportUtils.buildOptimisticChatReport( participants, values.roomName, From 9db429655d129027e4a1defba2dc01cb95a5b307 Mon Sep 17 00:00:00 2001 From: war-in Date: Mon, 22 Apr 2024 13:16:47 +0200 Subject: [PATCH 21/59] update getCommentLength --- src/libs/ReportUtils.ts | 4 ++-- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 2 +- src/pages/home/report/ReportActionItemMessageEdit.tsx | 2 +- src/pages/workspace/WorkspaceNewRoomPage.tsx | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 0d0937c09bc3..3df0194f6e5a 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -4931,8 +4931,8 @@ function getNewMarkerReportActionID(report: OnyxEntry, sortedAndFiltered * Used for compatibility with the backend auth validator for AddComment, and to account for MD in comments * @returns The comment's total length as seen from the backend */ -function getCommentLength(textComment: string): number { - return getParsedComment(textComment) +function getCommentLength(textComment: string, reportID?: string, policyID?: string): number { + return getParsedComment(textComment, undefined, reportID, policyID) .replace(/[^ -~]/g, '\\u????') .trim().length; } diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 8f42da5a1575..4be8db304b92 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -474,7 +474,7 @@ function ComposerWithSuggestions( const prepareCommentAndResetComposer = useCallback((): string => { const trimmedComment = commentRef.current.trim(); - const commentLength = ReportUtils.getCommentLength(trimmedComment); + const commentLength = ReportUtils.getCommentLength(trimmedComment, reportID); // Don't submit empty comments or comments that exceed the character limit if (!commentLength || commentLength > CONST.MAX_COMMENT_LENGTH) { diff --git a/src/pages/home/report/ReportActionItemMessageEdit.tsx b/src/pages/home/report/ReportActionItemMessageEdit.tsx index fc3c92434fc4..79a22f61e17b 100644 --- a/src/pages/home/report/ReportActionItemMessageEdit.tsx +++ b/src/pages/home/report/ReportActionItemMessageEdit.tsx @@ -318,7 +318,7 @@ function ReportActionItemMessageEdit( */ const publishDraft = useCallback(() => { // Do nothing if draft exceed the character limit - if (ReportUtils.getCommentLength(draft) > CONST.MAX_COMMENT_LENGTH) { + if (ReportUtils.getCommentLength(draft, reportID) > CONST.MAX_COMMENT_LENGTH) { return; } diff --git a/src/pages/workspace/WorkspaceNewRoomPage.tsx b/src/pages/workspace/WorkspaceNewRoomPage.tsx index b2f9085502eb..ffd8cc478ef4 100644 --- a/src/pages/workspace/WorkspaceNewRoomPage.tsx +++ b/src/pages/workspace/WorkspaceNewRoomPage.tsx @@ -183,7 +183,7 @@ function WorkspaceNewRoomPage({policies, reports, formState, session, activePoli ErrorUtils.addErrorMessage(errors, 'roomName', ['common.error.characterLimitExceedCounter', {length: values.roomName.length, limit: CONST.TITLE_CHARACTER_LIMIT}]); } - const descriptionLength = ReportUtils.getCommentLength(values.reportDescription); + const descriptionLength = ReportUtils.getCommentLength(values.reportDescription, policyID); if (descriptionLength > CONST.REPORT_DESCRIPTION.MAX_LENGTH) { ErrorUtils.addErrorMessage(errors, 'reportDescription', [ 'common.error.characterLimitExceedCounter', From ff600c740ba8956865a69d81ba96857d437845ad Mon Sep 17 00:00:00 2001 From: war-in Date: Tue, 23 Apr 2024 13:09:25 +0200 Subject: [PATCH 22/59] update expensify-common --- package-lock.json | 6 +++--- package.json | 2 +- src/pages/workspace/WorkspaceNewRoomPage.tsx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8cab4c43db4f..cbaede5c0a48 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,7 +56,7 @@ "date-fns-tz": "^2.0.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "git+ssh://git@github.com:software-mansion-labs/expensify-common.git#7596ae07c9cd5a6b5265897034898b4526d681dc", + "expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#9a68635cdcef4c81593c0f816a007bc9c707d46a", "expo": "^50.0.3", "expo-av": "~13.10.4", "expo-image": "1.11.0", @@ -20209,8 +20209,8 @@ }, "node_modules/expensify-common": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/software-mansion-labs/expensify-common.git#7596ae07c9cd5a6b5265897034898b4526d681dc", - "integrity": "sha512-Ns7qkMuJ4SeLj0lrj3i+KqHBzjlym8baDlS7CUIqq2tuNXkgxwO4D+5d6U3ooLOf0CyWb56KaGy5TOTFqpJDZA==", + "resolved": "git+ssh://git@github.com/Expensify/expensify-common.git#9a68635cdcef4c81593c0f816a007bc9c707d46a", + "integrity": "sha512-9BHjM3kZs7/dil0oykEQFkEhXjVD5liTttmO7ZYtPZkl4j6g97mubY2p9lYpWwpkWckUfvU7nGuZQjahw9xSFA==", "license": "MIT", "dependencies": { "classnames": "2.5.0", diff --git a/package.json b/package.json index 590bc1c9af79..2d09680fb69c 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "date-fns-tz": "^2.0.0", "dom-serializer": "^0.2.2", "domhandler": "^4.3.0", - "expensify-common": "git+ssh://git@github.com:software-mansion-labs/expensify-common.git#7596ae07c9cd5a6b5265897034898b4526d681dc", + "expensify-common": "git+ssh://git@github.com/Expensify/expensify-common.git#9a68635cdcef4c81593c0f816a007bc9c707d46a", "expo": "^50.0.3", "expo-av": "~13.10.4", "expo-image": "1.11.0", diff --git a/src/pages/workspace/WorkspaceNewRoomPage.tsx b/src/pages/workspace/WorkspaceNewRoomPage.tsx index ffd8cc478ef4..9a204755a1e5 100644 --- a/src/pages/workspace/WorkspaceNewRoomPage.tsx +++ b/src/pages/workspace/WorkspaceNewRoomPage.tsx @@ -197,7 +197,7 @@ function WorkspaceNewRoomPage({policies, reports, formState, session, activePoli return errors; }, - [reports], + [reports, policyID], ); const writeCapabilityOptions = useMemo( From 3af842806d1dcf6c96af9b7d81b88960d575886f Mon Sep 17 00:00:00 2001 From: war-in Date: Tue, 23 Apr 2024 13:27:35 +0200 Subject: [PATCH 23/59] introduce ParsingDetails object --- src/libs/ReportUtils.ts | 26 ++++++++++++------- src/libs/actions/Policy.ts | 2 +- src/libs/actions/Report.ts | 4 +-- .../ComposerWithSuggestions.tsx | 2 +- .../report/ReportActionItemMessageEdit.tsx | 2 +- src/pages/workspace/WorkspaceNewRoomPage.tsx | 4 +-- 6 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 3df0194f6e5a..ac259863489b 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -467,6 +467,12 @@ type OutstandingChildRequest = { hasOutstandingChildRequest?: boolean; }; +type ParsingDetails = { + shouldEscapeText?: boolean; + reportID?: string; + policyID?: string; +}; + let currentUserEmail: string | undefined; let currentUserPrivateDomain: string | undefined; let currentUserAccountID: number | undefined; @@ -3161,14 +3167,14 @@ function addDomainToShortMention(mention: string): string | undefined { * For comments shorter than or equal to 10k chars, convert the comment from MD into HTML because that's how it is stored in the database * For longer comments, skip parsing, but still escape the text, and display plaintext for performance reasons. It takes over 40s to parse a 100k long string!! */ -function getParsedComment(text: string, shouldEscapeText?: boolean, currentReportID?: string, policyID?: string): string { +function getParsedComment(text: string, parsingDetails?: ParsingDetails): string { let isGroupPolicyReport = false; - if (currentReportID) { - const currentReport = getReport(currentReportID); + if (parsingDetails?.reportID) { + const currentReport = getReport(parsingDetails?.reportID); isGroupPolicyReport = currentReport && !isEmptyObject(currentReport) ? isGroupPolicy(currentReport) : false; } - if (policyID) { - const policyType = getPolicy(policyID).type; + if (parsingDetails?.policyID) { + const policyType = getPolicy(parsingDetails?.policyID).type; isGroupPolicyReport = policyType === CONST.POLICY.TYPE.CORPORATE || policyType === CONST.POLICY.TYPE.TEAM || policyType === CONST.POLICY.TYPE.FREE; } @@ -3179,7 +3185,9 @@ function getParsedComment(text: string, shouldEscapeText?: boolean, currentRepor return mentionWithDomain ? `@${mentionWithDomain}` : match; }); - return text.length <= CONST.MAX_MARKUP_LENGTH ? parser.replace(textWithMention, {shouldEscapeText, disabledRules: isGroupPolicyReport ? [] : ['reportMentions']}) : lodashEscape(text); + return text.length <= CONST.MAX_MARKUP_LENGTH + ? parser.replace(textWithMention, {shouldEscapeText: parsingDetails?.shouldEscapeText, disabledRules: isGroupPolicyReport ? [] : ['reportMentions']}) + : lodashEscape(text); } function getReportDescriptionText(report: Report): string { @@ -3209,7 +3217,7 @@ function buildOptimisticAddCommentReportAction( reportID?: string, ): OptimisticReportAction { const parser = new ExpensiMark(); - const commentText = getParsedComment(text ?? '', shouldEscapeText, reportID); + const commentText = getParsedComment(text ?? '', {shouldEscapeText, reportID}); const isAttachmentOnly = file && !text; const isTextOnly = text && !file; @@ -4931,8 +4939,8 @@ function getNewMarkerReportActionID(report: OnyxEntry, sortedAndFiltered * Used for compatibility with the backend auth validator for AddComment, and to account for MD in comments * @returns The comment's total length as seen from the backend */ -function getCommentLength(textComment: string, reportID?: string, policyID?: string): number { - return getParsedComment(textComment, undefined, reportID, policyID) +function getCommentLength(textComment: string, parsingDetails?: ParsingDetails): number { + return getParsedComment(textComment, parsingDetails) .replace(/[^ -~]/g, '\\u????') .trim().length; } diff --git a/src/libs/actions/Policy.ts b/src/libs/actions/Policy.ts index f2ba65bf0717..39648814b143 100644 --- a/src/libs/actions/Policy.ts +++ b/src/libs/actions/Policy.ts @@ -1722,7 +1722,7 @@ function updateWorkspaceDescription(policyID: string, description: string, curre if (description === currentDescription) { return; } - const parsedDescription = ReportUtils.getParsedComment(description, undefined, undefined, policyID); + const parsedDescription = ReportUtils.getParsedComment(description, {policyID}); const optimisticData: OnyxUpdate[] = [ { diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index f062a4d78c68..e946a1264a7d 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -461,7 +461,7 @@ function addActions(reportID: string, text = '', file?: FileObject) { if (text && file) { // When there is both text and a file, the text for the report comment needs to be parsed) - reportCommentText = ReportUtils.getParsedComment(text ?? '', undefined, reportID); + reportCommentText = ReportUtils.getParsedComment(text ?? '', {reportID}); // And the API command needs to go to the new API which supports combining both text and attachments in a single report action commandName = WRITE_COMMANDS.ADD_TEXT_AND_ATTACHMENT; @@ -1848,7 +1848,7 @@ function updateDescription(reportID: string, previousValue: string, newValue: st return; } - const parsedDescription = ReportUtils.getParsedComment(newValue, undefined, reportID); + const parsedDescription = ReportUtils.getParsedComment(newValue, {reportID}); const optimisticData: OnyxUpdate[] = [ { diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 4be8db304b92..f33e9a1a9de4 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -474,7 +474,7 @@ function ComposerWithSuggestions( const prepareCommentAndResetComposer = useCallback((): string => { const trimmedComment = commentRef.current.trim(); - const commentLength = ReportUtils.getCommentLength(trimmedComment, reportID); + const commentLength = ReportUtils.getCommentLength(trimmedComment, {reportID}); // Don't submit empty comments or comments that exceed the character limit if (!commentLength || commentLength > CONST.MAX_COMMENT_LENGTH) { diff --git a/src/pages/home/report/ReportActionItemMessageEdit.tsx b/src/pages/home/report/ReportActionItemMessageEdit.tsx index 79a22f61e17b..bfd2c8b5ca7f 100644 --- a/src/pages/home/report/ReportActionItemMessageEdit.tsx +++ b/src/pages/home/report/ReportActionItemMessageEdit.tsx @@ -318,7 +318,7 @@ function ReportActionItemMessageEdit( */ const publishDraft = useCallback(() => { // Do nothing if draft exceed the character limit - if (ReportUtils.getCommentLength(draft, reportID) > CONST.MAX_COMMENT_LENGTH) { + if (ReportUtils.getCommentLength(draft, {reportID}) > CONST.MAX_COMMENT_LENGTH) { return; } diff --git a/src/pages/workspace/WorkspaceNewRoomPage.tsx b/src/pages/workspace/WorkspaceNewRoomPage.tsx index 9a204755a1e5..c66506d4a9b1 100644 --- a/src/pages/workspace/WorkspaceNewRoomPage.tsx +++ b/src/pages/workspace/WorkspaceNewRoomPage.tsx @@ -105,7 +105,7 @@ function WorkspaceNewRoomPage({policies, reports, formState, session, activePoli */ const submit = (values: FormOnyxValues) => { const participants = [session?.accountID ?? 0]; - const parsedDescription = ReportUtils.getParsedComment(values.reportDescription ?? '', undefined, undefined, policyID); + const parsedDescription = ReportUtils.getParsedComment(values.reportDescription ?? '', {policyID}); const policyReport = ReportUtils.buildOptimisticChatReport( participants, values.roomName, @@ -183,7 +183,7 @@ function WorkspaceNewRoomPage({policies, reports, formState, session, activePoli ErrorUtils.addErrorMessage(errors, 'roomName', ['common.error.characterLimitExceedCounter', {length: values.roomName.length, limit: CONST.TITLE_CHARACTER_LIMIT}]); } - const descriptionLength = ReportUtils.getCommentLength(values.reportDescription, policyID); + const descriptionLength = ReportUtils.getCommentLength(values.reportDescription, {policyID}); if (descriptionLength > CONST.REPORT_DESCRIPTION.MAX_LENGTH) { ErrorUtils.addErrorMessage(errors, 'reportDescription', [ 'common.error.characterLimitExceedCounter', From d25bcdf9dcbd7bac51de93b8e5ee8375a5e32f42 Mon Sep 17 00:00:00 2001 From: Wojciech Boman Date: Tue, 23 Apr 2024 15:56:12 +0200 Subject: [PATCH 24/59] Add template of SearchTableHeader --- src/languages/en.ts | 3 ++ src/languages/es.ts | 1 + src/libs/ReportUtils.ts | 5 ++++ src/pages/Search/SearchPage.tsx | 27 +++++++++++++++-- src/pages/Search/SearchTableHeader.tsx | 41 ++++++++++++++++++++++++++ 5 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 src/pages/Search/SearchTableHeader.tsx diff --git a/src/languages/en.ts b/src/languages/en.ts index fcb683472215..af77628415c3 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -125,6 +125,7 @@ export default { buttonConfirm: 'Got it', name: 'Name', attachment: 'Attachment', + from: 'From', to: 'To', optional: 'Optional', new: 'New', @@ -324,6 +325,8 @@ export default { subtitleText3: 'button below.', }, businessName: 'Business name', + type: 'Type', + action: 'Action', }, location: { useCurrent: 'Use current location', diff --git a/src/languages/es.ts b/src/languages/es.ts index 57de4057e775..fcfd7ffa431a 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -115,6 +115,7 @@ export default { buttonConfirm: 'Ok, entendido', name: 'Nombre', attachment: 'Archivo adjunto', + from: 'De', to: 'A', optional: 'Opcional', new: 'Nuevo', diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index a1e63bc5f48f..d3fc83e5553b 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -6147,6 +6147,10 @@ function canReportBeMentionedWithinPolicy(report: OnyxEntry, policyID: s return isChatRoom(report) && !isThread(report); } +function shouldShowMerchantColumn(transactions: Transaction[]) { + return transactions.some((transaction) => isExpenseReport(allReports?.[transaction.reportID] ?? {})); +} + export { addDomainToShortMention, areAllRequestsBeingSmartScanned, @@ -6388,6 +6392,7 @@ export { updateOptimisticParentReportAction, updateReportPreview, temporary_getMoneyRequestOptions, + shouldShowMerchantColumn, }; export type { diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index 3f69371841ce..cdf92344d945 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -1,9 +1,17 @@ import type {StackScreenProps} from '@react-navigation/stack'; -import React from 'react'; +import React, {useEffect, useState} from 'react'; +import {ValueOf} from 'type-fest'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import * as Illustrations from '@components/Icon/Illustrations'; import ScreenWrapper from '@components/ScreenWrapper'; +import SelectionList from '@components/SelectionList'; +import UserListItem from '@components/SelectionList/UserListItem'; +import * as DeviceCapabilities from '@libs/DeviceCapabilities'; +import Navigation from '@libs/Navigation/Navigation'; import type {CentralPaneNavigatorParamList} from '@libs/Navigation/types'; +import CONST from '@src/CONST'; import type SCREENS from '@src/SCREENS'; -import SearchResults from './SearchResults'; +import SearchTableHeader from './SearchTableHeader'; import useCustomBackHandler from './useCustomBackHandler'; type SearchPageProps = StackScreenProps; @@ -13,7 +21,20 @@ function SearchPage({route}: SearchPageProps) { return ( - + + } + ListItem={UserListItem} + onSelectRow={() => {}} + sections={[]} + onCheckboxPress={() => {}} + shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} + /> ); } diff --git a/src/pages/Search/SearchTableHeader.tsx b/src/pages/Search/SearchTableHeader.tsx new file mode 100644 index 000000000000..77fd5300d6aa --- /dev/null +++ b/src/pages/Search/SearchTableHeader.tsx @@ -0,0 +1,41 @@ +import React from 'react'; +import {View} from 'react-native'; +import Text from '@components/Text'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; +import useWindowDimensions from '@hooks/useWindowDimensions'; +import * as ReportUtils from '@libs/ReportUtils'; +import type {Transaction} from '@src/types/onyx'; + +type SearchTableHeaderProps = { + data?: Transaction[]; + onSelectAll?: () => void; +}; + +function SearchTableHeader({data, onSelectAll}: SearchTableHeaderProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + const {isSmallScreenWidth} = useWindowDimensions(); + + // const showMerchantColumn = ReportUtils.shouldShowMerchantColumn(data); + const showMerchantColumn = isSmallScreenWidth && true; + + return ( + + {translate('common.receipt')} + {translate('common.date')} + {showMerchantColumn && {translate('common.merchant')}} + {translate('common.description')} + {translate('common.from')} + {translate('common.to')} + {translate('common.category')} + {translate('common.total')} + {translate('common.type')} + {translate('common.action')} + + ); +} + +SearchTableHeader.displayName = 'SearchTableHeader'; + +export default SearchTableHeader; From c423cb8b0aa248c9f792cf997d76d3ead84aa276 Mon Sep 17 00:00:00 2001 From: Wojciech Boman Date: Wed, 24 Apr 2024 16:31:37 +0200 Subject: [PATCH 25/59] Add template of ExpenseListItem --- .../SelectionList/ExpenseListItem.tsx | 218 ++++++++++++++++++ src/components/SelectionList/types.ts | 6 +- src/pages/Search/SearchPage.tsx | 43 +++- 3 files changed, 257 insertions(+), 10 deletions(-) create mode 100644 src/components/SelectionList/ExpenseListItem.tsx diff --git a/src/components/SelectionList/ExpenseListItem.tsx b/src/components/SelectionList/ExpenseListItem.tsx new file mode 100644 index 000000000000..a460bd3b3d01 --- /dev/null +++ b/src/components/SelectionList/ExpenseListItem.tsx @@ -0,0 +1,218 @@ +import {format} from 'date-fns'; +import React, {useCallback} from 'react'; +import {View} from 'react-native'; +import Icon from '@components/Icon'; +import * as Expensicons from '@components/Icon/Expensicons'; +import MultipleAvatars from '@components/MultipleAvatars'; +import PressableWithFeedback from '@components/Pressable/PressableWithFeedback'; +import TextWithTooltip from '@components/TextWithTooltip'; +import useStyleUtils from '@hooks/useStyleUtils'; +import useTheme from '@hooks/useTheme'; +import useThemeStyles from '@hooks/useThemeStyles'; +import CONST from '@src/CONST'; +import BaseListItem from './BaseListItem'; +import type {ExpenseListItemProps, ListItem} from './types'; + +function ExpenseListItem({ + item, + isFocused, + showTooltip, + isDisabled, + canSelectMultiple, + onSelectRow, + onCheckboxPress, + onDismissError, + shouldPreventDefaultFocusOnSelectRow, + rightHandSideComponent, + onFocus, + shouldSyncFocus, +}: ExpenseListItemProps) { + const styles = useThemeStyles(); + const theme = useTheme(); + const StyleUtils = useStyleUtils(); + const focusedBackgroundColor = styles.sidebarLinkActive.backgroundColor; + const hoveredBackgroundColor = styles.sidebarLinkHover?.backgroundColor ? styles.sidebarLinkHover.backgroundColor : theme.sidebar; + + const handleCheckboxPress = useCallback(() => { + if (onCheckboxPress) { + onCheckboxPress(item); + } else { + onSelectRow(item); + } + }, [item, onCheckboxPress, onSelectRow]); + + return ( + + {(hovered) => ( + <> + {canSelectMultiple && ( + + + {item.isSelected && ( + + )} + + + )} + {!!item.icons && ( + + )} + + + + + + + + + + + + + + + + + + + + + + {/* + + + + */} + {!!item.rightElement && item.rightElement} + + )} + + ); +} + +ExpenseListItem.displayName = 'ExpenseListItem'; + +export default ExpenseListItem; diff --git a/src/components/SelectionList/types.ts b/src/components/SelectionList/types.ts index 50929095dc91..f7c3697b2814 100644 --- a/src/components/SelectionList/types.ts +++ b/src/components/SelectionList/types.ts @@ -7,6 +7,7 @@ import type {Errors, Icon, PendingAction} from '@src/types/onyx/OnyxCommon'; import type {ReceiptErrors} from '@src/types/onyx/Transaction'; import type ChildrenProps from '@src/types/utils/ChildrenProps'; import type IconAsset from '@src/types/utils/IconAsset'; +import type ExpenseListItem from './ExpenseListItem'; import type InviteMemberListItem from './InviteMemberListItem'; import type RadioListItem from './RadioListItem'; import type TableListItem from './TableListItem'; @@ -180,7 +181,9 @@ type RadioListItemProps = ListItemProps; type TableListItemProps = ListItemProps; -type ValidListItem = typeof RadioListItem | typeof UserListItem | typeof TableListItem | typeof InviteMemberListItem; +type ExpenseListItemProps = ListItemProps; + +type ValidListItem = typeof RadioListItem | typeof UserListItem | typeof TableListItem | typeof InviteMemberListItem | typeof ExpenseListItem; type Section = { /** Title of the section */ @@ -373,6 +376,7 @@ export type { RadioListItemProps, TableListItemProps, InviteMemberListItemProps, + ExpenseListItemProps, ListItem, ListItemProps, FlattenedSectionsReturn, diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index cdf92344d945..4dd33b25bb15 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -1,24 +1,47 @@ import type {StackScreenProps} from '@react-navigation/stack'; -import React, {useEffect, useState} from 'react'; -import {ValueOf} from 'type-fest'; +import React from 'react'; +import {View} from 'react-native'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import * as Illustrations from '@components/Icon/Illustrations'; import ScreenWrapper from '@components/ScreenWrapper'; import SelectionList from '@components/SelectionList'; -import UserListItem from '@components/SelectionList/UserListItem'; +import ExpenseListItem from '@components/SelectionList/ExpenseListItem'; +import Text from '@components/Text'; +import useLocalize from '@hooks/useLocalize'; +import useThemeStyles from '@hooks/useThemeStyles'; +import useWindowDimensions from '@hooks/useWindowDimensions'; import * as DeviceCapabilities from '@libs/DeviceCapabilities'; -import Navigation from '@libs/Navigation/Navigation'; import type {CentralPaneNavigatorParamList} from '@libs/Navigation/types'; -import CONST from '@src/CONST'; import type SCREENS from '@src/SCREENS'; -import SearchTableHeader from './SearchTableHeader'; import useCustomBackHandler from './useCustomBackHandler'; type SearchPageProps = StackScreenProps; function SearchPage({route}: SearchPageProps) { + const {translate} = useLocalize(); + const styles = useThemeStyles(); + const {isSmallScreenWidth} = useWindowDimensions(); useCustomBackHandler(); + const getListHeader = () => { + // const showMerchantColumn = ReportUtils.shouldShowMerchantColumn(data); + const showMerchantColumn = isSmallScreenWidth && true; + + return ( + + {/* {translate('common.receipt')} */} + {translate('common.date')} + {showMerchantColumn && {translate('common.merchant')}} + {translate('common.description')} + {translate('common.from')} + {translate('common.to')} + {translate('common.category')} + {translate('common.tag')} + {translate('common.total')} + + ); + }; + return ( } - ListItem={UserListItem} + customListHeader={getListHeader()} + ListItem={ExpenseListItem} onSelectRow={() => {}} - sections={[]} + onSelectAll={() => {}} + sections={[{data: [], isDisabled: false}]} onCheckboxPress={() => {}} shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} + listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]} /> ); From db79f8ea1a1a6debe04514c2ae117aa2cbe4bb60 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Thu, 25 Apr 2024 01:48:56 +0700 Subject: [PATCH 26/59] fix lint --- src/components/Avatar.tsx | 2 +- src/components/MultipleAvatars.tsx | 2 -- src/pages/home/report/ReportActionItemSingle.tsx | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/Avatar.tsx b/src/components/Avatar.tsx index 5cccb0408f7d..ba36a172fb02 100644 --- a/src/components/Avatar.tsx +++ b/src/components/Avatar.tsx @@ -52,7 +52,7 @@ type AvatarProps = { name?: string; /** Optional account id if it's user avatar or policy id if it's workspace avatar */ - accountID?: number; + accountID?: number | string; }; function Avatar({ diff --git a/src/components/MultipleAvatars.tsx b/src/components/MultipleAvatars.tsx index 9916eea7fe22..d5fcf6607179 100644 --- a/src/components/MultipleAvatars.tsx +++ b/src/components/MultipleAvatars.tsx @@ -159,7 +159,6 @@ function MultipleAvatars({ accountID={icons[0].id} type={icons[0].type} fallbackIcon={icons[0].fallbackIcon} - accountID={icons[0].id} /> @@ -210,7 +209,6 @@ function MultipleAvatars({ accountID={icon.id} type={icon.type} fallbackIcon={icon.fallbackIcon} - accountID={icon.id} /> diff --git a/src/pages/home/report/ReportActionItemSingle.tsx b/src/pages/home/report/ReportActionItemSingle.tsx index 6293c1e69a94..707e08ef88d8 100644 --- a/src/pages/home/report/ReportActionItemSingle.tsx +++ b/src/pages/home/report/ReportActionItemSingle.tsx @@ -206,7 +206,6 @@ function ReportActionItemSingle({ name={icon.name} accountID={icon.id} fallbackIcon={fallbackIcon} - accountID={icon.id} /> From 0ea1fb2a7d091fbe300a37606fef7569808b1c06 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Thu, 25 Apr 2024 01:53:20 +0700 Subject: [PATCH 27/59] fix typescript check --- src/types/onyx/OnyxCommon.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types/onyx/OnyxCommon.ts b/src/types/onyx/OnyxCommon.ts index de2a889d27d7..c4a3afc3e0b9 100644 --- a/src/types/onyx/OnyxCommon.ts +++ b/src/types/onyx/OnyxCommon.ts @@ -34,7 +34,7 @@ type Icon = { name?: string; /** Avatar id */ - id?: number; + id?: number | string; /** A fallback avatar icon to display when there is an error on loading avatar from remote URL. */ fallbackIcon?: AvatarSource; From 59485006aaa88ca6e8b6b4e351fb31cad16f796c Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Thu, 25 Apr 2024 01:59:29 +0700 Subject: [PATCH 28/59] fix ts check --- src/components/Avatar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Avatar.tsx b/src/components/Avatar.tsx index ba36a172fb02..003196e873e2 100644 --- a/src/components/Avatar.tsx +++ b/src/components/Avatar.tsx @@ -86,7 +86,7 @@ function Avatar({ const iconStyle = imageStyles ? [StyleUtils.getAvatarStyle(size), styles.bgTransparent, imageStyles] : undefined; // We pass the color styles down to the SVG for the workspace and fallback avatar. - const source = isWorkspace ? originalSource : UserUtils.getAvatar(originalSource, accountID); + const source = isWorkspace ? originalSource : UserUtils.getAvatar(originalSource, Number(accountID)); const useFallBackAvatar = imageError || !source || source === Expensicons.FallbackAvatar; const fallbackAvatar = isWorkspace ? ReportUtils.getDefaultWorkspaceAvatar(name) : fallbackIcon || Expensicons.FallbackAvatar; const fallbackAvatarTestID = isWorkspace ? ReportUtils.getDefaultWorkspaceAvatarTestID(name) : fallbackIconTestID || 'SvgFallbackAvatar Icon'; From 50cd3687ab2b378a57db1473e5a21dc45f915b44 Mon Sep 17 00:00:00 2001 From: Robert Kozik Date: Thu, 25 Apr 2024 21:08:30 +0200 Subject: [PATCH 29/59] change line height based on composer emoji value --- .../ComposerWithSuggestions/ComposerWithSuggestions.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx index 8f42da5a1575..95e3c038dfc0 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx @@ -52,6 +52,7 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import type * as OnyxTypes from '@src/types/onyx'; import type ChildrenProps from '@src/types/utils/ChildrenProps'; +import variables from '@styles/variables'; type SyncSelection = { position: number; @@ -730,6 +731,11 @@ function ComposerWithSuggestions( // eslint-disable-next-line react-hooks/exhaustive-deps }, []); + const isOnlyEmojiLineHeight = useMemo(() => { + const isOnlyEmoji = EmojiUtils.containsOnlyEmojis(value); + return isOnlyEmoji ? {lineHeight: variables.fontSizeOnlyEmojisHeight} : {}; + }, [value]); + return ( <> @@ -743,7 +749,7 @@ function ComposerWithSuggestions( onChangeText={onChangeText} onKeyPress={triggerHotkeyActions} textAlignVertical="top" - style={[styles.textInputCompose, isComposerFullSize ? styles.textInputFullCompose : styles.textInputCollapseCompose]} + style={[styles.textInputCompose, isComposerFullSize ? styles.textInputFullCompose : styles.textInputCollapseCompose, isOnlyEmojiLineHeight]} maxLines={maxComposerLines} onFocus={onFocus} onBlur={onBlur} From 35b23f6b6247aaeef6e90a488347e6cf02811ff6 Mon Sep 17 00:00:00 2001 From: Aldo Canepa Date: Thu, 25 Apr 2024 12:16:13 -0700 Subject: [PATCH 30/59] Patch for WebView crash --- ...fy+react-native-live-markdown+0.1.62.patch | 9 ++ patches/@rnmapbox+maps+10.1.11.patch | 114 ++++++++++++++++++ ...native+0.73.4+015+fixIOSWebViewCrash.patch | 24 ++++ 3 files changed, 147 insertions(+) create mode 100644 patches/@expensify+react-native-live-markdown+0.1.62.patch create mode 100644 patches/react-native+0.73.4+015+fixIOSWebViewCrash.patch diff --git a/patches/@expensify+react-native-live-markdown+0.1.62.patch b/patches/@expensify+react-native-live-markdown+0.1.62.patch new file mode 100644 index 000000000000..0d2c962efd0f --- /dev/null +++ b/patches/@expensify+react-native-live-markdown+0.1.62.patch @@ -0,0 +1,9 @@ +diff --git a/node_modules/@expensify/react-native-live-markdown/ios/RCTBackedTextFieldDelegateAdapter+Markdown.m b/node_modules/@expensify/react-native-live-markdown/ios/RCTBackedTextFieldDelegateAdapter+Markdown.mm +similarity index 100% +rename from node_modules/@expensify/react-native-live-markdown/ios/RCTBackedTextFieldDelegateAdapter+Markdown.m +rename to node_modules/@expensify/react-native-live-markdown/ios/RCTBackedTextFieldDelegateAdapter+Markdown.mm +diff --git a/node_modules/@expensify/react-native-live-markdown/ios/RCTBaseTextInputView+Markdown.m b/node_modules/@expensify/react-native-live-markdown/ios/RCTBaseTextInputView+Markdown.mm +similarity index 100% +rename from node_modules/@expensify/react-native-live-markdown/ios/RCTBaseTextInputView+Markdown.m +rename to node_modules/@expensify/react-native-live-markdown/ios/RCTBaseTextInputView+Markdown.mm + diff --git a/patches/@rnmapbox+maps+10.1.11.patch b/patches/@rnmapbox+maps+10.1.11.patch index 9f2df5f4ee6e..5c5b8f0b69bb 100644 --- a/patches/@rnmapbox+maps+10.1.11.patch +++ b/patches/@rnmapbox+maps+10.1.11.patch @@ -11,3 +11,117 @@ index dbd6d0b..1d043f2 100644 val map = mapView.getMapboxMap() it.setDuration(0) +diff --git a/node_modules/@rnmapbox/maps/ios/RNMBX/Offline/RNMBXOfflineModule.m b/node_modules/@rnmapbox/maps/ios/RNMBX/Offline/RNMBXOfflineModule.m +index 1808393..ec00542 100644 +--- a/node_modules/@rnmapbox/maps/ios/RNMBX/Offline/RNMBXOfflineModule.m ++++ b/node_modules/@rnmapbox/maps/ios/RNMBX/Offline/RNMBXOfflineModule.m +@@ -1,4 +1,4 @@ +-#import "React/RCTBridgeModule.h" ++#import + #import + + @interface RCT_EXTERN_MODULE(RNMBXOfflineModule, RCTEventEmitter) +diff --git a/node_modules/@rnmapbox/maps/ios/RNMBX/Offline/RNMBXOfflineModuleLegacy.m b/node_modules/@rnmapbox/maps/ios/RNMBX/Offline/RNMBXOfflineModuleLegacy.m +index 550f67b..76da02d 100644 +--- a/node_modules/@rnmapbox/maps/ios/RNMBX/Offline/RNMBXOfflineModuleLegacy.m ++++ b/node_modules/@rnmapbox/maps/ios/RNMBX/Offline/RNMBXOfflineModuleLegacy.m +@@ -1,4 +1,4 @@ +-#import "React/RCTBridgeModule.h" ++#import + #import + + @interface RCT_EXTERN_MODULE(RNMBXOfflineModuleLegacy, RCTEventEmitter) +diff --git a/node_modules/@rnmapbox/maps/ios/RNMBX/Offline/RNMBXTileStoreModule.m b/node_modules/@rnmapbox/maps/ios/RNMBX/Offline/RNMBXTileStoreModule.m +index a98e102..e43be8f 100644 +--- a/node_modules/@rnmapbox/maps/ios/RNMBX/Offline/RNMBXTileStoreModule.m ++++ b/node_modules/@rnmapbox/maps/ios/RNMBX/Offline/RNMBXTileStoreModule.m +@@ -1,4 +1,4 @@ +-#import "React/RCTBridgeModule.h" ++#import + #import + + @interface RCT_EXTERN_MODULE(RNMBXTileStoreModule, NSObject) +diff --git a/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXCalloutViewManager.m b/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXCalloutViewManager.m +index 62205d5..1db2ac4 100644 +--- a/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXCalloutViewManager.m ++++ b/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXCalloutViewManager.m +@@ -1,4 +1,4 @@ +-#import "React/RCTBridgeModule.h" ++#import + #import + #import + +diff --git a/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXCameraViewManager.m b/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXCameraViewManager.m +index e23b10c..6a023fa 100644 +--- a/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXCameraViewManager.m ++++ b/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXCameraViewManager.m +@@ -1,4 +1,4 @@ +-#import "React/RCTBridgeModule.h" ++#import + #import + #import + +diff --git a/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXLocationModule.m b/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXLocationModule.m +index 8b89774..9f85c35 100644 +--- a/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXLocationModule.m ++++ b/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXLocationModule.m +@@ -1,4 +1,4 @@ +-#import "React/RCTBridgeModule.h" ++#import + #import + + @class RNMBXLocation; +diff --git a/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXLogging.m b/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXLogging.m +index d7c05de..f680b86 100644 +--- a/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXLogging.m ++++ b/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXLogging.m +@@ -1,4 +1,4 @@ +-#import "React/RCTBridgeModule.h" ++#import + + @interface RCT_EXTERN_MODULE(RNMBXLogging, NSObject) + +diff --git a/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXMarkerViewContentManager.m b/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXMarkerViewContentManager.m +index 72f9928..f4f5fe2 100644 +--- a/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXMarkerViewContentManager.m ++++ b/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXMarkerViewContentManager.m +@@ -1,4 +1,4 @@ +-#import "React/RCTBridgeModule.h" ++#import + #import + #import + +diff --git a/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXMarkerViewManager.m b/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXMarkerViewManager.m +index c0ab14d..6177811 100644 +--- a/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXMarkerViewManager.m ++++ b/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXMarkerViewManager.m +@@ -1,4 +1,4 @@ +-#import "React/RCTBridgeModule.h" ++#import + #import + #import + +diff --git a/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXModule.m b/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXModule.m +index 3b0af79..e00b508 100644 +--- a/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXModule.m ++++ b/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXModule.m +@@ -1,4 +1,4 @@ +-#import "React/RCTBridgeModule.h" ++#import + + @interface RCT_EXTERN_MODULE(RNMBXModule, NSObject) + +diff --git a/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXPointAnnotationViewManager.m b/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXPointAnnotationViewManager.m +index 6fa19e5..54d0ff9 100644 +--- a/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXPointAnnotationViewManager.m ++++ b/node_modules/@rnmapbox/maps/ios/RNMBX/RNMBXPointAnnotationViewManager.m +@@ -1,4 +1,4 @@ +-#import "React/RCTBridgeModule.h" ++#import + #import + #import + +diff --git a/node_modules/@rnmapbox/maps/ios/RNMBX/ShapeAnimators/RNMBXMovePointShapeAnimatorModule.m b/node_modules/@rnmapbox/maps/ios/RNMBX/ShapeAnimators/RNMBXMovePointShapeAnimatorModule.mm +similarity index 100% +rename from node_modules/@rnmapbox/maps/ios/RNMBX/ShapeAnimators/RNMBXMovePointShapeAnimatorModule.m +rename to node_modules/@rnmapbox/maps/ios/RNMBX/ShapeAnimators/RNMBXMovePointShapeAnimatorModule.mm diff --git a/patches/react-native+0.73.4+015+fixIOSWebViewCrash.patch b/patches/react-native+0.73.4+015+fixIOSWebViewCrash.patch new file mode 100644 index 000000000000..7c4244f3a811 --- /dev/null +++ b/patches/react-native+0.73.4+015+fixIOSWebViewCrash.patch @@ -0,0 +1,24 @@ +diff --git a/node_modules/react-native/scripts/cocoapods/new_architecture.rb b/node_modules/react-native/scripts/cocoapods/new_architecture.rb +index ba75b019a9b9b2..c9999beb82b7ea 100644 +--- a/node_modules/react-native/scripts/cocoapods/new_architecture.rb ++++ b/node_modules/react-native/scripts/cocoapods/new_architecture.rb +@@ -105,6 +105,10 @@ def self.install_modules_dependencies(spec, new_arch_enabled, folly_version) + current_headers = current_config["HEADER_SEARCH_PATHS"] != nil ? current_config["HEADER_SEARCH_PATHS"] : "" + current_cpp_flags = current_config["OTHER_CPLUSPLUSFLAGS"] != nil ? current_config["OTHER_CPLUSPLUSFLAGS"] : "" + ++ flags_to_add = new_arch_enabled ? ++ "#{@@folly_compiler_flags} -DRCT_NEW_ARCH_ENABLED=1" : ++ "#{@@folly_compiler_flags}" ++ + header_search_paths = ["\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\""] + if ENV['USE_FRAMEWORKS'] + header_search_paths << "\"$(PODS_ROOT)/DoubleConversion\"" +@@ -124,7 +128,7 @@ def self.install_modules_dependencies(spec, new_arch_enabled, folly_version) + } + end + header_search_paths_string = header_search_paths.join(" ") +- spec.compiler_flags = compiler_flags.empty? ? @@folly_compiler_flags : "#{compiler_flags} #{@@folly_compiler_flags}" ++ spec.compiler_flags = compiler_flags.empty? ? "$(inherited) #{flags_to_add}" : "$(inherited) #{compiler_flags} #{flags_to_add}" + current_config["HEADER_SEARCH_PATHS"] = current_headers.empty? ? + header_search_paths_string : + "#{current_headers} #{header_search_paths_string}" From ff30cb544dbfd8b9c044a2b3e09ea43c0d7f117f Mon Sep 17 00:00:00 2001 From: Wojciech Boman Date: Fri, 26 Apr 2024 07:44:52 +0200 Subject: [PATCH 31/59] Add test data to SearchPage --- src/pages/Search/SearchPage.tsx | 49 ++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index a48192bdd68d..2ddea460de10 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -19,6 +19,53 @@ import useCustomBackHandler from './useCustomBackHandler'; type SearchPageProps = StackScreenProps; +const data = [ + { + receipt: {source: 'http...'}, + hasEReceipt: false, + created: '2024-04-11 00:00:00', + amount: 12500, + type: 'cash', + reportID: '1', + transactionThreadReportID: '2', + transactionID: '1234', + modifiedCreated: '2024-05-06 00:00:00', + description: 'description description description description', + from: { + displayName: 'TestUser1', + avatarUrl: '', + }, + to: { + displayName: 'TestUser2', + avatarUrl: '', + }, + category: 'Bananas', + tag: 'Green', + }, + { + receipt: {source: 'http...'}, + hasEReceipt: false, + created: '2024-04-11 00:00:00', + amount: 12500, + type: 'cash', // not present in live data (data outside of snapshot_) + reportID: '1', + transactionThreadReportID: '2', + transactionID: '5555', + modifiedCreated: '2024-05-06 00:00:00', + description: 'description', + from: { + displayName: 'TestUser1', + avatarUrl: '', + }, + to: { + displayName: 'TestUser2', + avatarUrl: '', + }, + category: 'Bananas', + tag: 'Green', + }, +]; + function SearchPage({route}: SearchPageProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); @@ -57,7 +104,7 @@ function SearchPage({route}: SearchPageProps) { ListItem={ExpenseListItem} onSelectRow={() => {}} onSelectAll={() => {}} - sections={[{data: [], isDisabled: false}]} + sections={[{data, isDisabled: false}]} onCheckboxPress={() => {}} shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]} From 84a54db10fdc3b11c287186a61d43e90d7c1f1a5 Mon Sep 17 00:00:00 2001 From: war-in Date: Fri, 26 Apr 2024 10:03:37 +0200 Subject: [PATCH 32/59] review suggestions --- .../ReportActionItem/MoneyRequestView.tsx | 2 +- src/hooks/useHandleExceedMaxCommentLength.ts | 5 ++-- src/libs/ReportUtils.ts | 24 ++++++++++++------- .../ReportActionCompose.tsx | 2 +- .../report/ReportActionItemMessageEdit.tsx | 4 ++-- .../request/step/IOURequestStepCategory.tsx | 2 +- .../request/step/IOURequestStepMerchant.tsx | 2 +- .../iou/request/step/IOURequestStepTag.tsx | 2 +- 8 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/components/ReportActionItem/MoneyRequestView.tsx b/src/components/ReportActionItem/MoneyRequestView.tsx index 08bcc16cbbee..bfa34efb4f05 100644 --- a/src/components/ReportActionItem/MoneyRequestView.tsx +++ b/src/components/ReportActionItem/MoneyRequestView.tsx @@ -156,7 +156,7 @@ function MoneyRequestView({ // A flag for verifying that the current report is a sub-report of a workspace chat // if the policy of the report is either Collect or Control, then this report must be tied to workspace chat - const isPolicyExpenseChat = ReportUtils.isGroupPolicy(report); + const isPolicyExpenseChat = ReportUtils.isReportInGroupPolicy(report); const policyTagLists = useMemo(() => PolicyUtils.getTagLists(policyTagList), [policyTagList]); diff --git a/src/hooks/useHandleExceedMaxCommentLength.ts b/src/hooks/useHandleExceedMaxCommentLength.ts index fea0793c9854..69c1d7597164 100644 --- a/src/hooks/useHandleExceedMaxCommentLength.ts +++ b/src/hooks/useHandleExceedMaxCommentLength.ts @@ -1,14 +1,15 @@ import _ from 'lodash'; import {useCallback, useMemo, useState} from 'react'; import * as ReportUtils from '@libs/ReportUtils'; +import type {ParsingDetails} from '@libs/ReportUtils'; import CONST from '@src/CONST'; const useHandleExceedMaxCommentLength = () => { const [hasExceededMaxCommentLength, setHasExceededMaxCommentLength] = useState(false); const handleValueChange = useCallback( - (value: string) => { - if (ReportUtils.getCommentLength(value) <= CONST.MAX_COMMENT_LENGTH) { + (value: string, parsingDetails?: ParsingDetails) => { + if (ReportUtils.getCommentLength(value, parsingDetails) <= CONST.MAX_COMMENT_LENGTH) { if (hasExceededMaxCommentLength) { setHasExceededMaxCommentLength(false); } diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 8ee14d07f856..4713444d0088 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -874,12 +874,19 @@ function isControlPolicyExpenseChat(report: OnyxEntry): boolean { return isPolicyExpenseChat(report) && getPolicyType(report, allPolicies) === CONST.POLICY.TYPE.CORPORATE; } +/** + * Whether the provided policyType is a Free, Collect or Control policy type + */ +function isGroupPolicy(policyType: string): boolean { + return policyType === CONST.POLICY.TYPE.CORPORATE || policyType === CONST.POLICY.TYPE.TEAM || policyType === CONST.POLICY.TYPE.FREE; +} + /** * Whether the provided report belongs to a Free, Collect or Control policy */ -function isGroupPolicy(report: OnyxEntry): boolean { +function isReportInGroupPolicy(report: OnyxEntry): boolean { const policyType = getPolicyType(report, allPolicies); - return policyType === CONST.POLICY.TYPE.CORPORATE || policyType === CONST.POLICY.TYPE.TEAM || policyType === CONST.POLICY.TYPE.FREE; + return isGroupPolicy(policyType); } /** @@ -1421,7 +1428,7 @@ function canAddOrDeleteTransactions(moneyRequestReport: OnyxEntry): bool return false; } - if (isGroupPolicy(moneyRequestReport) && isProcessingReport(moneyRequestReport) && !PolicyUtils.isInstantSubmitEnabled(getPolicy(moneyRequestReport?.policyID))) { + if (isReportInGroupPolicy(moneyRequestReport) && isProcessingReport(moneyRequestReport) && !PolicyUtils.isInstantSubmitEnabled(getPolicy(moneyRequestReport?.policyID))) { return false; } @@ -3186,11 +3193,11 @@ function getParsedComment(text: string, parsingDetails?: ParsingDetails): string let isGroupPolicyReport = false; if (parsingDetails?.reportID) { const currentReport = getReport(parsingDetails?.reportID); - isGroupPolicyReport = currentReport && !isEmptyObject(currentReport) ? isGroupPolicy(currentReport) : false; + isGroupPolicyReport = isReportInGroupPolicy(currentReport); } if (parsingDetails?.policyID) { const policyType = getPolicy(parsingDetails?.policyID).type; - isGroupPolicyReport = policyType === CONST.POLICY.TYPE.CORPORATE || policyType === CONST.POLICY.TYPE.TEAM || policyType === CONST.POLICY.TYPE.FREE; + isGroupPolicyReport = isGroupPolicy(policyType); } const parser = new ExpensiMark(); @@ -5161,7 +5168,7 @@ function canRequestMoney(report: OnyxEntry, policy: OnyxEntry, o // which is tied to their workspace chat. if (isMoneyRequestReport(report)) { const canAddTransactions = canAddOrDeleteTransactions(report); - return isGroupPolicy(report) ? isOwnPolicyExpenseChat && canAddTransactions : canAddTransactions; + return isReportInGroupPolicy(report) ? isOwnPolicyExpenseChat && canAddTransactions : canAddTransactions; } // In the case of policy expense chat, users can only submit expenses from their own policy expense chat @@ -6027,7 +6034,7 @@ function canBeAutoReimbursed(report: OnyxEntry, policy: OnyxEntry= reimbursableTotal && reimbursableTotal > 0 && @@ -6385,7 +6392,7 @@ export { isExpensifyOnlyParticipantInReport, isGroupChat, isGroupChatAdmin, - isGroupPolicy, + isReportInGroupPolicy, isHoldCreator, isIOUOwnedByCurrentUser, isIOUReport, @@ -6463,4 +6470,5 @@ export type { OptimisticTaskReportAction, OptionData, TransactionDetails, + ParsingDetails, }; diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx index 75d0c703b5b1..5bfa2475ee23 100644 --- a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx +++ b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx @@ -461,7 +461,7 @@ function ReportActionCompose({ if (value.length === 0 && isComposerFullSize) { Report.setIsComposerFullSize(reportID, false); } - validateCommentMaxLength(value); + validateCommentMaxLength(value, {reportID}); }} /> { - validateCommentMaxLength(draft); - }, [draft, validateCommentMaxLength]); + validateCommentMaxLength(draft, {reportID}); + }, [draft, reportID, validateCommentMaxLength]); return ( <> diff --git a/src/pages/iou/request/step/IOURequestStepCategory.tsx b/src/pages/iou/request/step/IOURequestStepCategory.tsx index a571192f7a47..4b34a6a19600 100644 --- a/src/pages/iou/request/step/IOURequestStepCategory.tsx +++ b/src/pages/iou/request/step/IOURequestStepCategory.tsx @@ -73,7 +73,7 @@ function IOURequestStepCategory({ // The transactionCategory can be an empty string, so to maintain the logic we'd like to keep it in this shape until utils refactor // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - const shouldShowCategory = ReportUtils.isGroupPolicy(report) && (!!transactionCategory || OptionsListUtils.hasEnabledOptions(Object.values(policyCategories ?? {}))); + const shouldShowCategory = ReportUtils.isReportInGroupPolicy(report) && (!!transactionCategory || OptionsListUtils.hasEnabledOptions(Object.values(policyCategories ?? {}))); const isSplitBill = iouType === CONST.IOU.TYPE.SPLIT; const canEditSplitBill = isSplitBill && reportAction && session?.accountID === reportAction.actorAccountID && TransactionUtils.areRequiredFieldsEmpty(transaction); diff --git a/src/pages/iou/request/step/IOURequestStepMerchant.tsx b/src/pages/iou/request/step/IOURequestStepMerchant.tsx index b50495ac47bd..bc6f71b23228 100644 --- a/src/pages/iou/request/step/IOURequestStepMerchant.tsx +++ b/src/pages/iou/request/step/IOURequestStepMerchant.tsx @@ -63,7 +63,7 @@ function IOURequestStepMerchant({ const merchant = ReportUtils.getTransactionDetails(isEditingSplitBill && !isEmptyObject(splitDraftTransaction) ? splitDraftTransaction : transaction)?.merchant; const isEmptyMerchant = merchant === '' || merchant === CONST.TRANSACTION.PARTIAL_TRANSACTION_MERCHANT; - const isMerchantRequired = ReportUtils.isGroupPolicy(report) || transaction?.participants?.some((participant) => Boolean(participant.isPolicyExpenseChat)); + const isMerchantRequired = ReportUtils.isReportInGroupPolicy(report) || transaction?.participants?.some((participant) => Boolean(participant.isPolicyExpenseChat)); const navigateBack = () => { Navigation.goBack(backTo); }; diff --git a/src/pages/iou/request/step/IOURequestStepTag.tsx b/src/pages/iou/request/step/IOURequestStepTag.tsx index a62720cbd13a..ff1a1c01600d 100644 --- a/src/pages/iou/request/step/IOURequestStepTag.tsx +++ b/src/pages/iou/request/step/IOURequestStepTag.tsx @@ -77,7 +77,7 @@ function IOURequestStepTag({ const canEditSplitBill = isSplitBill && reportAction && session?.accountID === reportAction.actorAccountID && TransactionUtils.areRequiredFieldsEmpty(transaction); const policyTagLists = useMemo(() => PolicyUtils.getTagLists(policyTags), [policyTags]); - const shouldShowTag = ReportUtils.isGroupPolicy(report) && (transactionTag || OptionsListUtils.hasEnabledTags(policyTagLists)); + const shouldShowTag = ReportUtils.isReportInGroupPolicy(report) && (transactionTag || OptionsListUtils.hasEnabledTags(policyTagLists)); // eslint-disable-next-line rulesdir/no-negated-variables const shouldShowNotFoundPage = !shouldShowTag || (isEditing && (isSplitBill ? !canEditSplitBill : reportAction && !canEditMoneyRequest(reportAction))); From 13273b626c35105006d9c4c3d2cd26451111417f Mon Sep 17 00:00:00 2001 From: Wojciech Boman Date: Fri, 26 Apr 2024 14:11:09 +0200 Subject: [PATCH 33/59] Rename ExpenseListItem to TransactionListItem --- .../SelectionList/TemporaryExpenseListItem.tsx | 4 ++-- .../{ExpenseListItem.tsx => TransactionListItem.tsx} | 10 +++++----- src/components/SelectionList/types.ts | 8 ++++---- src/libs/SearchUtils.ts | 7 ++++--- src/pages/Search/SearchPage.tsx | 4 ++-- 5 files changed, 17 insertions(+), 16 deletions(-) rename src/components/SelectionList/{ExpenseListItem.tsx => TransactionListItem.tsx} (97%) diff --git a/src/components/SelectionList/TemporaryExpenseListItem.tsx b/src/components/SelectionList/TemporaryExpenseListItem.tsx index 011a6d73ac4f..49544c4f5557 100644 --- a/src/components/SelectionList/TemporaryExpenseListItem.tsx +++ b/src/components/SelectionList/TemporaryExpenseListItem.tsx @@ -6,7 +6,7 @@ import type {SearchTransaction} from '@src/types/onyx/SearchResults'; // NOTE: This is a completely temporary mock item so that something can be displayed in SearchWidget // This should be removed and implement properly in: https://github.com/Expensify/App/issues/39877 -function ExpenseListItem({item}: {item: SearchTransaction}) { +function TransactionListItem({item}: {item: SearchTransaction}) { const styles = useThemeStyles(); return ( @@ -15,4 +15,4 @@ function ExpenseListItem({item}: {item: SearchTransaction}) { ); } -export default ExpenseListItem; +export default TransactionListItem; diff --git a/src/components/SelectionList/ExpenseListItem.tsx b/src/components/SelectionList/TransactionListItem.tsx similarity index 97% rename from src/components/SelectionList/ExpenseListItem.tsx rename to src/components/SelectionList/TransactionListItem.tsx index a460bd3b3d01..00d80c6ce11b 100644 --- a/src/components/SelectionList/ExpenseListItem.tsx +++ b/src/components/SelectionList/TransactionListItem.tsx @@ -11,9 +11,9 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import CONST from '@src/CONST'; import BaseListItem from './BaseListItem'; -import type {ExpenseListItemProps, ListItem} from './types'; +import type {TransactionListItemProps, ListItem} from './types'; -function ExpenseListItem({ +function TransactionListItem({ item, isFocused, showTooltip, @@ -26,7 +26,7 @@ function ExpenseListItem({ rightHandSideComponent, onFocus, shouldSyncFocus, -}: ExpenseListItemProps) { +}: TransactionListItemProps) { const styles = useThemeStyles(); const theme = useTheme(); const StyleUtils = useStyleUtils(); @@ -213,6 +213,6 @@ function ExpenseListItem({ ); } -ExpenseListItem.displayName = 'ExpenseListItem'; +TransactionListItem.displayName = 'TransactionListItem'; -export default ExpenseListItem; +export default TransactionListItem; diff --git a/src/components/SelectionList/types.ts b/src/components/SelectionList/types.ts index f7c3697b2814..b72bba02ee19 100644 --- a/src/components/SelectionList/types.ts +++ b/src/components/SelectionList/types.ts @@ -7,7 +7,7 @@ import type {Errors, Icon, PendingAction} from '@src/types/onyx/OnyxCommon'; import type {ReceiptErrors} from '@src/types/onyx/Transaction'; import type ChildrenProps from '@src/types/utils/ChildrenProps'; import type IconAsset from '@src/types/utils/IconAsset'; -import type ExpenseListItem from './ExpenseListItem'; +import type TransactionListItem from './TransactionListItem'; import type InviteMemberListItem from './InviteMemberListItem'; import type RadioListItem from './RadioListItem'; import type TableListItem from './TableListItem'; @@ -181,9 +181,9 @@ type RadioListItemProps = ListItemProps; type TableListItemProps = ListItemProps; -type ExpenseListItemProps = ListItemProps; +type TransactionListItemProps = ListItemProps; -type ValidListItem = typeof RadioListItem | typeof UserListItem | typeof TableListItem | typeof InviteMemberListItem | typeof ExpenseListItem; +type ValidListItem = typeof RadioListItem | typeof UserListItem | typeof TableListItem | typeof InviteMemberListItem | typeof TransactionListItem; type Section = { /** Title of the section */ @@ -376,7 +376,7 @@ export type { RadioListItemProps, TableListItemProps, InviteMemberListItemProps, - ExpenseListItemProps, + TransactionListItemProps, ListItem, ListItemProps, FlattenedSectionsReturn, diff --git a/src/libs/SearchUtils.ts b/src/libs/SearchUtils.ts index ccced12a0bc4..c78a7a48c297 100644 --- a/src/libs/SearchUtils.ts +++ b/src/libs/SearchUtils.ts @@ -1,10 +1,11 @@ -import ExpenseListItem from '@components/SelectionList/TemporaryExpenseListItem'; + +import TransactionListItem from '@components/SelectionList/TransactionListItem'; import type * as OnyxTypes from '@src/types/onyx'; import type {SearchTransaction} from '@src/types/onyx/SearchResults'; const searchTypeToItemMap = { transaction: { - listItem: ExpenseListItem, + listItem: TransactionListItem, }, }; @@ -17,7 +18,7 @@ const getTransactionsSections = (data: OnyxTypes.SearchResults['data']): SearchT * TODO: in future make this function generic and return specific item component based on type * For now only 1 search item type exists in the app so this function is simplified */ -function getListItem(): typeof ExpenseListItem { +function getListItem(): typeof TransactionListItem { return searchTypeToItemMap.transaction.listItem; } diff --git a/src/pages/Search/SearchPage.tsx b/src/pages/Search/SearchPage.tsx index 2ddea460de10..22482e33ab4e 100644 --- a/src/pages/Search/SearchPage.tsx +++ b/src/pages/Search/SearchPage.tsx @@ -6,7 +6,7 @@ import * as Illustrations from '@components/Icon/Illustrations'; import ScreenWrapper from '@components/ScreenWrapper'; import Search from '@components/Search'; import SelectionList from '@components/SelectionList'; -import ExpenseListItem from '@components/SelectionList/ExpenseListItem'; +import TransactionListItem from '@components/SelectionList/TransactionListItem'; import Text from '@components/Text'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; @@ -101,7 +101,7 @@ function SearchPage({route}: SearchPageProps) { {}} onSelectAll={() => {}} sections={[{data, isDisabled: false}]} From 0ec7b8a4ddea409a375c01d19dbbb02e1de80f09 Mon Sep 17 00:00:00 2001 From: Wojciech Boman Date: Fri, 26 Apr 2024 17:16:55 +0200 Subject: [PATCH 34/59] Modify TransactionListItem --- .../TemporaryExpenseListItem.tsx | 18 -- .../SelectionList/TransactionListItem.tsx | 203 ++++++++---------- src/pages/Search/SearchPage.tsx | 28 +-- src/styles/index.ts | 5 + 4 files changed, 110 insertions(+), 144 deletions(-) delete mode 100644 src/components/SelectionList/TemporaryExpenseListItem.tsx diff --git a/src/components/SelectionList/TemporaryExpenseListItem.tsx b/src/components/SelectionList/TemporaryExpenseListItem.tsx deleted file mode 100644 index 49544c4f5557..000000000000 --- a/src/components/SelectionList/TemporaryExpenseListItem.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import {View} from 'react-native'; -import Text from '@components/Text'; -import useThemeStyles from '@hooks/useThemeStyles'; -import type {SearchTransaction} from '@src/types/onyx/SearchResults'; - -// NOTE: This is a completely temporary mock item so that something can be displayed in SearchWidget -// This should be removed and implement properly in: https://github.com/Expensify/App/issues/39877 -function TransactionListItem({item}: {item: SearchTransaction}) { - const styles = useThemeStyles(); - return ( - - Item: {item.transactionID} - - ); -} - -export default TransactionListItem; diff --git a/src/components/SelectionList/TransactionListItem.tsx b/src/components/SelectionList/TransactionListItem.tsx index 00d80c6ce11b..9bd2e21bc011 100644 --- a/src/components/SelectionList/TransactionListItem.tsx +++ b/src/components/SelectionList/TransactionListItem.tsx @@ -1,17 +1,22 @@ import {format} from 'date-fns'; import React, {useCallback} from 'react'; import {View} from 'react-native'; +import Avatar from '@components/Avatar'; +import Button from '@components/Button'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; import MultipleAvatars from '@components/MultipleAvatars'; +import {usePersonalDetails} from '@components/OnyxProvider'; import PressableWithFeedback from '@components/Pressable/PressableWithFeedback'; +import Text from '@components/Text'; import TextWithTooltip from '@components/TextWithTooltip'; import useStyleUtils from '@hooks/useStyleUtils'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; +import * as CurrencyUtils from '@libs/CurrencyUtils'; import CONST from '@src/CONST'; import BaseListItem from './BaseListItem'; -import type {TransactionListItemProps, ListItem} from './types'; +import type {ListItem, TransactionListItemProps} from './types'; function TransactionListItem({ item, @@ -30,6 +35,7 @@ function TransactionListItem({ const styles = useThemeStyles(); const theme = useTheme(); const StyleUtils = useStyleUtils(); + const personalDetails = usePersonalDetails() ?? CONST.EMPTY_OBJECT; const focusedBackgroundColor = styles.sidebarLinkActive.backgroundColor; const hoveredBackgroundColor = styles.sidebarLinkHover?.backgroundColor ? styles.sidebarLinkHover.backgroundColor : theme.sidebar; @@ -41,6 +47,8 @@ function TransactionListItem({ } }, [item, onCheckboxPress, onSelectRow]); + console.log('personalDetails', personalDetails); + return ( ({ ]} /> )} - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + {personalDetails[item.managerID]?.displayName} + + + + + + + + {personalDetails[item.accountID]?.displayName} + + + + + + + + + + + + + + + - styles.justifyContentCenter, - ]} - /> + +