From 314657af49a8fb6af9856ff79f931180fe1f0a56 Mon Sep 17 00:00:00 2001 From: daledah Date: Wed, 27 Nov 2024 01:38:04 +0700 Subject: [PATCH 1/2] fix: use display create instead of submit expense --- src/components/ReportWelcomeText.tsx | 8 +++++++- src/languages/en.ts | 1 + src/languages/es.ts | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/ReportWelcomeText.tsx b/src/components/ReportWelcomeText.tsx index 1e3ce6119315..08c172c86c9c 100644 --- a/src/components/ReportWelcomeText.tsx +++ b/src/components/ReportWelcomeText.tsx @@ -6,6 +6,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; import * as OptionsListUtils from '@libs/OptionsListUtils'; +import Permissions from '@libs/Permissions'; import {getPolicy} from '@libs/PolicyUtils'; import * as ReportUtils from '@libs/ReportUtils'; import SidebarUtils from '@libs/SidebarUtils'; @@ -51,7 +52,12 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) { item !== CONST.IOU.TYPE.INVOICE, ); const additionalText = filteredOptions - .map((item, index) => `${index === filteredOptions.length - 1 && index > 0 ? `${translate('common.or')} ` : ''}${translate(`reportActionsView.iouTypes.${item}`)}`) + .map( + (item, index) => + `${index === filteredOptions.length - 1 && index > 0 ? `${translate('common.or')} ` : ''}${translate( + Permissions.canUseCombinedTrackSubmit() && item === 'submit' ? `reportActionsView.create` : `reportActionsView.iouTypes.${item}`, + )}`, + ) .join(', '); const canEditPolicyDescription = ReportUtils.canEditPolicyDescription(policy); const reportName = ReportUtils.getReportName(report); diff --git a/src/languages/en.ts b/src/languages/en.ts index c1067e195985..75d7bb388a9a 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -689,6 +689,7 @@ const translations = { welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `Welcome to ${roomName}!`, usePlusButton: ({additionalText}: UsePlusButtonParams) => `\nUse the + button to ${additionalText} an expense.`, askConcierge: '\nAsk questions and get 24/7 realtime support.', + create: 'create', iouTypes: { pay: 'pay', split: 'split', diff --git a/src/languages/es.ts b/src/languages/es.ts index f7af1be45139..bb26ca2d95a3 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -684,6 +684,7 @@ const translations = { welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `¡Bienvenido a ${roomName}!`, usePlusButton: ({additionalText}: UsePlusButtonParams) => `\nUsa el botón + para ${additionalText} un gasto`, askConcierge: 'Haz preguntas y obtén soporte en tiempo real las 24/7.', + create: 'crear', iouTypes: { pay: 'pagar', split: 'dividir', From e8dd2bd3496a313f378678028c2a7b62c0acf30b Mon Sep 17 00:00:00 2001 From: daledah Date: Wed, 27 Nov 2024 01:41:06 +0700 Subject: [PATCH 2/2] fix: use usePermission hook --- src/components/ReportWelcomeText.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/ReportWelcomeText.tsx b/src/components/ReportWelcomeText.tsx index 08c172c86c9c..cc7dbed1f6e9 100644 --- a/src/components/ReportWelcomeText.tsx +++ b/src/components/ReportWelcomeText.tsx @@ -3,10 +3,10 @@ import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import {useOnyx} from 'react-native-onyx'; import useLocalize from '@hooks/useLocalize'; +import usePermissions from '@hooks/usePermissions'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; import * as OptionsListUtils from '@libs/OptionsListUtils'; -import Permissions from '@libs/Permissions'; import {getPolicy} from '@libs/PolicyUtils'; import * as ReportUtils from '@libs/ReportUtils'; import SidebarUtils from '@libs/SidebarUtils'; @@ -47,6 +47,7 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) { const welcomeMessage = SidebarUtils.getWelcomeMessage(report, policy); const moneyRequestOptions = ReportUtils.temporary_getMoneyRequestOptions(report, policy, participantAccountIDs); const canEditReportDescription = ReportUtils.canEditReportDescription(report, policy); + const {canUseCombinedTrackSubmit} = usePermissions(); const filteredOptions = moneyRequestOptions.filter( (item): item is Exclude => item !== CONST.IOU.TYPE.INVOICE, @@ -55,7 +56,7 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) { .map( (item, index) => `${index === filteredOptions.length - 1 && index > 0 ? `${translate('common.or')} ` : ''}${translate( - Permissions.canUseCombinedTrackSubmit() && item === 'submit' ? `reportActionsView.create` : `reportActionsView.iouTypes.${item}`, + canUseCombinedTrackSubmit && item === 'submit' ? `reportActionsView.create` : `reportActionsView.iouTypes.${item}`, )}`, ) .join(', ');