From a1daa0c73ff2c12e6a464419faaa644cdcd941ac Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Mon, 30 Sep 2024 18:11:53 +0700 Subject: [PATCH 1/8] update beginningOfChatHistory translation --- src/components/ReportWelcomeText.tsx | 69 +++++++++++++++++++--------- src/languages/en.ts | 43 ++++++++--------- src/languages/es.ts | 44 +++++++++--------- src/libs/ReportUtils.ts | 4 +- src/libs/SidebarUtils.ts | 19 ++++++-- 5 files changed, 110 insertions(+), 69 deletions(-) diff --git a/src/components/ReportWelcomeText.tsx b/src/components/ReportWelcomeText.tsx index 68f060d22e6c..0901fdc5846a 100644 --- a/src/components/ReportWelcomeText.tsx +++ b/src/components/ReportWelcomeText.tsx @@ -1,29 +1,25 @@ import React, {useMemo} from 'react'; import {View} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; -import {withOnyx} from 'react-native-onyx'; +import {useOnyx} from 'react-native-onyx'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; import * as OptionsListUtils from '@libs/OptionsListUtils'; +import {getPolicy} from '@libs/PolicyUtils'; import * as ReportUtils from '@libs/ReportUtils'; import SidebarUtils from '@libs/SidebarUtils'; import CONST from '@src/CONST'; import type {IOUType} from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; -import type {PersonalDetailsList, Policy, Report} from '@src/types/onyx'; +import type {Policy, Report} from '@src/types/onyx'; import {PressableWithoutFeedback} from './Pressable'; import RenderHTML from './RenderHTML'; import Text from './Text'; import UserDetailsTooltip from './UserDetailsTooltip'; -type ReportWelcomeTextOnyxProps = { - /** All of the personal details for everyone */ - personalDetails: OnyxEntry; -}; - -type ReportWelcomeTextProps = ReportWelcomeTextOnyxProps & { +type ReportWelcomeTextProps = { /** The report currently being looked at */ report: OnyxEntry; @@ -31,23 +27,26 @@ type ReportWelcomeTextProps = ReportWelcomeTextOnyxProps & { policy: OnyxEntry; }; -function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextProps) { +function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); + const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(report); const isChatRoom = ReportUtils.isChatRoom(report); const isSelfDM = ReportUtils.isSelfDM(report); const isInvoiceRoom = ReportUtils.isInvoiceRoom(report); const isSystemChat = ReportUtils.isSystemChat(report); const isDefault = !(isChatRoom || isPolicyExpenseChat || isSelfDM || isInvoiceRoom || isSystemChat); - const participantAccountIDs = ReportUtils.getParticipantsAccountIDsForDisplay(report); + const participantAccountIDs = ReportUtils.getParticipantsAccountIDsForDisplay(report, undefined, undefined, true); const isMultipleParticipant = participantAccountIDs.length > 1; const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(OptionsListUtils.getPersonalDetailsForAccountIDs(participantAccountIDs, personalDetails), isMultipleParticipant); const welcomeMessage = SidebarUtils.getWelcomeMessage(report, policy); const moneyRequestOptions = ReportUtils.temporary_getMoneyRequestOptions(report, policy, participantAccountIDs); - const additionalText = moneyRequestOptions - .filter((item): item is Exclude => item !== CONST.IOU.TYPE.INVOICE) - .map((item) => translate(`reportActionsView.iouTypes.${item}`)) + const filteredOptions = moneyRequestOptions.filter( + (item): item is Exclude => item !== CONST.IOU.TYPE.INVOICE, + ); + const additionalText = filteredOptions + .map((item, index) => `${index === filteredOptions.length - 1 ? `${translate('common.or')} ` : ''}${translate(`reportActionsView.iouTypes.${item}`)}`) .join(', '); const canEditPolicyDescription = ReportUtils.canEditPolicyDescription(policy); const reportName = ReportUtils.getReportName(report); @@ -109,7 +108,37 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP {welcomeMessage.phrase3} ))} + {isInvoiceRoom && + (welcomeMessage?.messageHtml ? ( + { + if (!canEditPolicyDescription) { + return; + } + Navigation.navigate(ROUTES.WORKSPACE_PROFILE_DESCRIPTION.getRoute(policy?.id ?? '-1')); + }} + style={[styles.renderHTML, canEditPolicyDescription ? styles.cursorPointer : styles.cursorText]} + accessibilityLabel={translate('reportDescriptionPage.roomDescription')} + > + + + ) : ( + + {welcomeMessage.phrase1} + + {report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL ? ( + {ReportUtils.getDisplayNameForParticipant(report?.invoiceReceiver?.accountID)} + ) : ( + {getPolicy(report?.invoiceReceiver?.policyID)?.name} + )} + + {` ${translate('common.and')} `} + {ReportUtils.getPolicyName(report)} + {welcomeMessage.phrase2} + + ))} {isChatRoom && + !isInvoiceRoom && (welcomeMessage?.messageHtml ? ( { @@ -176,9 +205,11 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP ))} )} - {(moneyRequestOptions.includes(CONST.IOU.TYPE.PAY) || moneyRequestOptions.includes(CONST.IOU.TYPE.SUBMIT) || moneyRequestOptions.includes(CONST.IOU.TYPE.TRACK)) && ( - {translate('reportActionsView.usePlusButton', {additionalText})} - )} + {(moneyRequestOptions.includes(CONST.IOU.TYPE.PAY) || + moneyRequestOptions.includes(CONST.IOU.TYPE.SUBMIT) || + moneyRequestOptions.includes(CONST.IOU.TYPE.TRACK) || + moneyRequestOptions.includes(CONST.IOU.TYPE.SPLIT)) && {translate('reportActionsView.usePlusButton', {additionalText})}} + {ReportUtils.isConciergeChatReport(report) && {translate('reportActionsView.askConcierge')}} ); @@ -186,8 +217,4 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP ReportWelcomeText.displayName = 'ReportWelcomeText'; -export default withOnyx({ - personalDetails: { - key: ONYXKEYS.PERSONAL_DETAILS_LIST, - }, -})(ReportWelcomeText); +export default ReportWelcomeText; diff --git a/src/languages/en.ts b/src/languages/en.ts index 6d579a2af2df..efe47c4d88a8 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -19,7 +19,6 @@ import type { BadgeFreeTrialParams, BeginningOfChatHistoryAdminRoomPartOneParams, BeginningOfChatHistoryAnnounceRoomPartOneParams, - BeginningOfChatHistoryAnnounceRoomPartTwo, BeginningOfChatHistoryDomainRoomPartOneParams, BillingBannerCardAuthenticationRequiredParams, BillingBannerCardExpiredParams, @@ -264,6 +263,7 @@ const translations = { phoneNumberPlaceholder: '(xxx) xxx-xxxx', email: 'Email', and: 'and', + or: 'or', details: 'Details', privacy: 'Privacy', privacyPolicy: 'Privacy Policy', @@ -656,33 +656,34 @@ const translations = { reportActionsView: { beginningOfArchivedRoomPartOne: 'You missed the party in ', beginningOfArchivedRoomPartTwo: ", there's nothing to see here.", - beginningOfChatHistoryDomainRoomPartOne: ({domainRoom}: BeginningOfChatHistoryDomainRoomPartOneParams) => `Collaboration with everyone at ${domainRoom} starts here! 🎉\nUse `, - beginningOfChatHistoryDomainRoomPartTwo: ' to chat with colleagues, share tips, and ask questions.', - beginningOfChatHistoryAdminRoomPartOne: ({workspaceName}: BeginningOfChatHistoryAdminRoomPartOneParams) => `Collaboration among ${workspaceName} admins starts here! 🎉\nUse `, - beginningOfChatHistoryAdminRoomPartTwo: ' to chat about topics such as workspace configurations and more.', - beginningOfChatHistoryAnnounceRoomPartOne: ({workspaceName}: BeginningOfChatHistoryAnnounceRoomPartOneParams) => - `Collaboration between all ${workspaceName} members starts here! 🎉\nUse `, - beginningOfChatHistoryAnnounceRoomPartTwo: ({workspaceName}: BeginningOfChatHistoryAnnounceRoomPartTwo) => ` to chat about anything ${workspaceName} related.`, - beginningOfChatHistoryUserRoomPartOne: 'Collaboration starts here! 🎉\nUse this space to chat about anything ', - beginningOfChatHistoryUserRoomPartTwo: ' related.', - beginningOfChatHistoryInvoiceRoom: 'Collaboration starts here! 🎉 Use this room to view, discuss, and pay invoices.', - beginningOfChatHistory: 'This is the beginning of your chat with ', - beginningOfChatHistoryPolicyExpenseChatPartOne: 'Collaboration between ', - beginningOfChatHistoryPolicyExpenseChatPartTwo: ' and ', - beginningOfChatHistoryPolicyExpenseChatPartThree: ' starts here! 🎉 This is the place to chat, submit expenses and settle up.', + beginningOfChatHistoryDomainRoomPartOne: ({domainRoom}: BeginningOfChatHistoryDomainRoomPartOneParams) => `This chat is with all Expensify members on the ${domainRoom} domain.`, + beginningOfChatHistoryDomainRoomPartTwo: ' Use it to chat with colleagues, share tips, and ask questions.', + beginningOfChatHistoryAdminRoomPartOne: ({workspaceName}: BeginningOfChatHistoryAdminRoomPartOneParams) => `This chat is with ${workspaceName} admins.`, + beginningOfChatHistoryAdminRoomPartTwo: ' Use it to chat about workspace setup and more.', + beginningOfChatHistoryAnnounceRoomPartOne: ({workspaceName}: BeginningOfChatHistoryAnnounceRoomPartOneParams) => `This chat is with everyone in ${workspaceName} workspace.`, + beginningOfChatHistoryAnnounceRoomPartTwo: ` Use it for the most important announcements.`, + beginningOfChatHistoryUserRoomPartOne: 'This chat room is for anything ', + beginningOfChatHistoryUserRoomPartTwo: ({displayName}: {displayName: string}) => ` related. It was created by ${displayName}`, + beginningOfChatHistoryInvoiceRoomPartOne: `This chat is for invoices between `, + beginningOfChatHistoryInvoiceRoomPartTwo: `. Use the + button to send an invoice.`, + beginningOfChatHistory: 'This chat is with ', + beginningOfChatHistoryPolicyExpenseChatPartOne: 'This is where ', + beginningOfChatHistoryPolicyExpenseChatPartTwo: ' will submit expenses to the ', + beginningOfChatHistoryPolicyExpenseChatPartThree: ' workspace. Just use the + button.', beginningOfChatHistorySelfDM: 'This is your personal space. Use it for notes, tasks, drafts, and reminders.', beginningOfChatHistorySystemDM: "Welcome! Let's get you set up.", chatWithAccountManager: 'Chat with your account manager here', sayHello: 'Say hello!', yourSpace: 'Your space', welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `Welcome to ${roomName}!`, - usePlusButton: ({additionalText}: UsePlusButtonParams) => `\nYou can also use the + button to ${additionalText}, or assign a task!`, + usePlusButton: ({additionalText}: UsePlusButtonParams) => `\nUse the + button to ${additionalText} an expense`, + askConcierge: '\nAsk questions and get 24/7 realtime support.', iouTypes: { - pay: 'pay expenses', - split: 'split an expense', - submit: 'submit an expense', - track: 'track an expense', - invoice: 'invoice an expense', + pay: 'pay', + split: 'split', + submit: 'submit', + track: 'track', + invoice: 'invoice', }, }, adminOnlyCanPost: 'Only admins can send messages in this room.', diff --git a/src/languages/es.ts b/src/languages/es.ts index cb19b091b058..cf077b5357bf 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -17,7 +17,6 @@ import type { BadgeFreeTrialParams, BeginningOfChatHistoryAdminRoomPartOneParams, BeginningOfChatHistoryAnnounceRoomPartOneParams, - BeginningOfChatHistoryAnnounceRoomPartTwo, BeginningOfChatHistoryDomainRoomPartOneParams, BillingBannerCardAuthenticationRequiredParams, BillingBannerCardExpiredParams, @@ -255,6 +254,7 @@ const translations = { phoneNumberPlaceholder: '(xxx) xxx-xxxx', email: 'Email', and: 'y', + or: 'o', details: 'Detalles', privacy: 'Privacidad', hidden: 'Oculto', @@ -648,34 +648,36 @@ const translations = { reportActionsView: { beginningOfArchivedRoomPartOne: 'Te perdiste la fiesta en ', beginningOfArchivedRoomPartTwo: ', no hay nada que ver aquí.', - beginningOfChatHistoryDomainRoomPartOne: ({domainRoom}: BeginningOfChatHistoryDomainRoomPartOneParams) => `¡Colabora aquí con todos los participantes de ${domainRoom}! 🎉\nUtiliza `, - beginningOfChatHistoryDomainRoomPartTwo: ' para chatear con compañeros, compartir consejos o hacer una pregunta.', + beginningOfChatHistoryDomainRoomPartOne: ({domainRoom}: BeginningOfChatHistoryDomainRoomPartOneParams) => + `Este chat es con todos los miembros de Expensify en el dominio ${domainRoom}.`, + beginningOfChatHistoryDomainRoomPartTwo: ' Úsalo para chatear con colegas, compartir consejos y hacer preguntas.', beginningOfChatHistoryAdminRoomPartOne: ({workspaceName}: BeginningOfChatHistoryAdminRoomPartOneParams) => - `¡Este es el lugar para que los administradores de ${workspaceName} colaboren! 🎉\nUsa `, - beginningOfChatHistoryAdminRoomPartTwo: ' para chatear sobre temas como la configuración del espacio de trabajo y mas.', - beginningOfChatHistoryAnnounceRoomPartOne: ({workspaceName}: BeginningOfChatHistoryAnnounceRoomPartOneParams) => - `¡Este es el lugar para que todos los miembros de ${workspaceName} colaboren! 🎉\nUsa `, - beginningOfChatHistoryAnnounceRoomPartTwo: ({workspaceName}: BeginningOfChatHistoryAnnounceRoomPartTwo) => ` para chatear sobre cualquier cosa relacionada con ${workspaceName}.`, - beginningOfChatHistoryUserRoomPartOne: '¡Este es el lugar para colaborar! 🎉\nUsa este espacio para chatear sobre cualquier cosa relacionada con ', - beginningOfChatHistoryUserRoomPartTwo: '.', - beginningOfChatHistoryInvoiceRoom: '¡Este es el lugar para colaborar! 🎉 Utilice esta sala para ver, discutir y pagar facturas.', - beginningOfChatHistory: 'Aquí comienzan tus conversaciones con ', - beginningOfChatHistoryPolicyExpenseChatPartOne: '¡La colaboración entre ', - beginningOfChatHistoryPolicyExpenseChatPartTwo: ' y ', - beginningOfChatHistoryPolicyExpenseChatPartThree: ' empieza aquí! 🎉 Este es el lugar donde chatear y presentar o pagar gastos.', + `Este chat es con los administradores del espacio de trabajo ${workspaceName}.`, + beginningOfChatHistoryAdminRoomPartTwo: ' Use it to chat about workspace setup and more.', + beginningOfChatHistoryAnnounceRoomPartOne: ({workspaceName}: BeginningOfChatHistoryAnnounceRoomPartOneParams) => `Este chat es con todos en el espacio de trabajo ${workspaceName}.`, + beginningOfChatHistoryAnnounceRoomPartTwo: ` Úsalo para hablar sobre la configuración del espacio de trabajo y más.`, + beginningOfChatHistoryUserRoomPartOne: 'ste chat es para todo lo relacionado con ', + beginningOfChatHistoryUserRoomPartTwo: ({displayName}: {displayName: string}) => ` Fue creado por ${displayName}.`, + beginningOfChatHistoryInvoiceRoomPartOne: `Este chat es para facturas entre `, + beginningOfChatHistoryInvoiceRoomPartTwo: `. Usa el botón + para enviar una factura.`, + beginningOfChatHistory: 'Este chat es con', + beginningOfChatHistoryPolicyExpenseChatPartOne: 'Aquí es donde ', + beginningOfChatHistoryPolicyExpenseChatPartTwo: ' enviará los gastos al espacio de trabajo ', + beginningOfChatHistoryPolicyExpenseChatPartThree: '. Solo usa el botón +.', beginningOfChatHistorySelfDM: 'Este es tu espacio personal. Úsalo para notas, tareas, borradores y recordatorios.', beginningOfChatHistorySystemDM: '¡Bienvenido! Vamos a configurar tu cuenta.', chatWithAccountManager: 'Chatea con tu gestor de cuenta aquí', sayHello: '¡Saluda!', yourSpace: 'Tu espacio', welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `¡Bienvenido a ${roomName}!`, - usePlusButton: ({additionalText}: UsePlusButtonParams) => `\n¡También puedes usar el botón + de abajo para ${additionalText}, o asignar una tarea!`, + usePlusButton: ({additionalText}: UsePlusButtonParams) => `\nUsa el botón + para ${additionalText} un gasto`, + askConcierge: 'Haz preguntas y obtén soporte en tiempo real las 24/7.', iouTypes: { - pay: 'pagar gastos', - split: 'dividir un gasto', - submit: 'presentar un gasto', - track: 'rastrear un gasto', - invoice: 'facturar un gasto', + pay: 'pagar', + split: 'dividir', + submit: 'presentar', + track: 'rastrear', + invoice: 'facturar', }, }, adminOnlyCanPost: 'Solo los administradores pueden enviar mensajes en esta sala.', diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index 78ebdd92751e..33f1e4c35d56 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2107,7 +2107,7 @@ function getDisplayNameForParticipant( return shouldUseShortForm ? shortName : longName; } -function getParticipantsAccountIDsForDisplay(report: OnyxEntry, shouldExcludeHidden = false, shouldExcludeDeleted = false): number[] { +function getParticipantsAccountIDsForDisplay(report: OnyxEntry, shouldExcludeHidden = false, shouldExcludeDeleted = false, shouldForceExcludeCurrentUser = false): number[] { const reportParticipants = report?.participants ?? {}; let participantsEntries = Object.entries(reportParticipants); @@ -2134,7 +2134,7 @@ function getParticipantsAccountIDsForDisplay(report: OnyxEntry, shouldEx // For 1:1 chat, we don't want to include the current user as a participant in order to not mark 1:1 chats as having multiple participants // For system chat, we want to display Expensify as the only participant - const shouldExcludeCurrentUser = isOneOnOneChat(report) || isSystemChat(report); + const shouldExcludeCurrentUser = isOneOnOneChat(report) || isSystemChat(report) || shouldForceExcludeCurrentUser; if (shouldExcludeCurrentUser || shouldExcludeHidden || shouldExcludeDeleted) { participantsIds = participantsIds.filter((accountID) => { diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index e120f7026fce..915e633bd424 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -536,7 +536,7 @@ function getWelcomeMessage(report: OnyxEntry, policy: OnyxEntry) } welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistory'); - const participantAccountIDs = ReportUtils.getParticipantsAccountIDsForDisplay(report); + const participantAccountIDs = ReportUtils.getParticipantsAccountIDsForDisplay(report, undefined, undefined, true); const isMultipleParticipant = participantAccountIDs.length > 1; const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips( OptionsListUtils.getPersonalDetailsForAccountIDs(participantAccountIDs, allPersonalDetails), @@ -581,21 +581,32 @@ function getRoomWelcomeMessage(report: OnyxEntry): WelcomeMessage { welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfArchivedRoomPartOne'); welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfArchivedRoomPartTwo'); } else if (ReportUtils.isDomainRoom(report)) { + welcomeMessage.showReportName = false; welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryDomainRoomPartOne', {domainRoom: report?.reportName ?? ''}); welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryDomainRoomPartTwo'); } else if (ReportUtils.isAdminRoom(report)) { + welcomeMessage.showReportName = false; welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAdminRoomPartOne', {workspaceName}); welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAdminRoomPartTwo'); } else if (ReportUtils.isAnnounceRoom(report)) { + welcomeMessage.showReportName = false; welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAnnounceRoomPartOne', {workspaceName}); - welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAnnounceRoomPartTwo', {workspaceName}); + welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryAnnounceRoomPartTwo'); } else if (ReportUtils.isInvoiceRoom(report)) { welcomeMessage.showReportName = false; - welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryInvoiceRoom'); + welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryInvoiceRoomPartOne'); + welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryInvoiceRoomPartTwo'); + const payer = + report?.invoiceReceiver?.type === CONST.REPORT.INVOICE_RECEIVER_TYPE.INDIVIDUAL + ? ReportUtils.getDisplayNameForParticipant(report?.invoiceReceiver?.accountID) + : PolicyUtils.getPolicy(report?.invoiceReceiver?.policyID)?.name; + const receiver = ReportUtils.getPolicyName(report); + welcomeMessage.messageText = `${welcomeMessage.phrase1}${payer} ${Localize.translateLocal('common.and')} ${receiver}${welcomeMessage.phrase2}`; + return welcomeMessage; } else { // Message for user created rooms or other room types. welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryUserRoomPartOne'); - welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryUserRoomPartTwo'); + welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryUserRoomPartTwo', {displayName: ''}); } welcomeMessage.messageText = `${welcomeMessage.phrase1} ${welcomeMessage.showReportName ? ReportUtils.getReportName(report) : ''} ${welcomeMessage.phrase2 ?? ''}`; From 555542a05a2490b1054aa588bb20fc42f8d5b208 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Tue, 1 Oct 2024 16:44:23 +0700 Subject: [PATCH 2/8] update policy name for user created room --- src/libs/SidebarUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 915e633bd424..ded66b21f897 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -606,7 +606,7 @@ function getRoomWelcomeMessage(report: OnyxEntry): WelcomeMessage { } else { // Message for user created rooms or other room types. welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryUserRoomPartOne'); - welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryUserRoomPartTwo', {displayName: ''}); + welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryUserRoomPartTwo', {displayName: ReportUtils.getPolicyName(report)}); } welcomeMessage.messageText = `${welcomeMessage.phrase1} ${welcomeMessage.showReportName ? ReportUtils.getReportName(report) : ''} ${welcomeMessage.phrase2 ?? ''}`; From cddafc3147f6a733ddfdf5910d67b7da7db0b08d Mon Sep 17 00:00:00 2001 From: nkdengineer <161821005+nkdengineer@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:47:12 +0700 Subject: [PATCH 3/8] Update src/languages/en.ts Co-authored-by: Kevin Brian Bader <56457735+ikevin127@users.noreply.github.com> --- src/languages/en.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 7a45e7e3c934..6eb60d8d19bc 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -678,7 +678,7 @@ const translations = { sayHello: 'Say hello!', yourSpace: 'Your space', welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `Welcome to ${roomName}!`, - usePlusButton: ({additionalText}: UsePlusButtonParams) => `\nUse the + button to ${additionalText} an expense`, + usePlusButton: ({additionalText}: UsePlusButtonParams) => `\nUse the + button to ${additionalText} an expense.`, askConcierge: '\nAsk questions and get 24/7 realtime support.', iouTypes: { pay: 'pay', From 7dad94e54c4388147b0256bc6091144d77369784 Mon Sep 17 00:00:00 2001 From: nkdengineer <161821005+nkdengineer@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:47:23 +0700 Subject: [PATCH 4/8] Update src/languages/en.ts Co-authored-by: Kevin Brian Bader <56457735+ikevin127@users.noreply.github.com> --- src/languages/en.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 6eb60d8d19bc..8957a908fd83 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -665,7 +665,7 @@ const translations = { beginningOfChatHistoryAnnounceRoomPartOne: ({workspaceName}: BeginningOfChatHistoryAnnounceRoomPartOneParams) => `This chat is with everyone in ${workspaceName} workspace.`, beginningOfChatHistoryAnnounceRoomPartTwo: ` Use it for the most important announcements.`, beginningOfChatHistoryUserRoomPartOne: 'This chat room is for anything ', - beginningOfChatHistoryUserRoomPartTwo: ({displayName}: {displayName: string}) => ` related. It was created by ${displayName}`, + beginningOfChatHistoryUserRoomPartTwo: ({displayName}: {displayName: string}) => ` related. It was created by ${displayName}.`, beginningOfChatHistoryInvoiceRoomPartOne: `This chat is for invoices between `, beginningOfChatHistoryInvoiceRoomPartTwo: `. Use the + button to send an invoice.`, beginningOfChatHistory: 'This chat is with ', From f993567865bacc319b73d74b496c8b3de72ecef7 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 2 Oct 2024 12:14:34 +0700 Subject: [PATCH 5/8] fix archive invoice case --- src/components/ReportWelcomeText.tsx | 18 +++++++++++++----- src/languages/en.ts | 3 ++- src/languages/es.ts | 3 ++- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/components/ReportWelcomeText.tsx b/src/components/ReportWelcomeText.tsx index 53054db2d782..d73614493ff1 100644 --- a/src/components/ReportWelcomeText.tsx +++ b/src/components/ReportWelcomeText.tsx @@ -32,6 +32,9 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) { const styles = useThemeStyles(); const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(report); + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + const [reportNameValuePairs] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${report?.reportID || -1}`); + const isArchivedRoom = ReportUtils.isArchivedRoom(report, reportNameValuePairs); const isChatRoom = ReportUtils.isChatRoom(report); const isSelfDM = ReportUtils.isSelfDM(report); const isInvoiceRoom = ReportUtils.isInvoiceRoom(report); @@ -51,6 +54,12 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) { .join(', '); const canEditPolicyDescription = ReportUtils.canEditPolicyDescription(policy); const reportName = ReportUtils.getReportName(report); + const shouldShowUsePlusButtonText = + (moneyRequestOptions.includes(CONST.IOU.TYPE.PAY) || + moneyRequestOptions.includes(CONST.IOU.TYPE.SUBMIT) || + moneyRequestOptions.includes(CONST.IOU.TYPE.TRACK) || + moneyRequestOptions.includes(CONST.IOU.TYPE.SPLIT)) && + !isPolicyExpenseChat; const navigateToReport = () => { if (!report?.reportID) { @@ -110,6 +119,7 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) { ))} {isInvoiceRoom && + !isArchivedRoom && (welcomeMessage?.messageHtml ? ( { @@ -139,7 +149,7 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) { ))} {isChatRoom && - !isInvoiceRoom && + (!isInvoiceRoom || isArchivedRoom) && (welcomeMessage?.messageHtml ? ( { @@ -206,10 +216,8 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) { ))} )} - {(moneyRequestOptions.includes(CONST.IOU.TYPE.PAY) || - moneyRequestOptions.includes(CONST.IOU.TYPE.SUBMIT) || - moneyRequestOptions.includes(CONST.IOU.TYPE.TRACK) || - moneyRequestOptions.includes(CONST.IOU.TYPE.SPLIT)) && {translate('reportActionsView.usePlusButton', {additionalText})}} + {shouldShowUsePlusButtonText && {translate('reportActionsView.usePlusButton', {additionalText})}} + {isPolicyExpenseChat && moneyRequestOptions.length && {translate('reportActionsView.justUsePlusButton')}} {ReportUtils.isConciergeChatReport(report) && {translate('reportActionsView.askConcierge')}} diff --git a/src/languages/en.ts b/src/languages/en.ts index 8957a908fd83..55fbafaf5686 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -671,7 +671,7 @@ const translations = { beginningOfChatHistory: 'This chat is with ', beginningOfChatHistoryPolicyExpenseChatPartOne: 'This is where ', beginningOfChatHistoryPolicyExpenseChatPartTwo: ' will submit expenses to the ', - beginningOfChatHistoryPolicyExpenseChatPartThree: ' workspace. Just use the + button.', + beginningOfChatHistoryPolicyExpenseChatPartThree: ' workspace.', beginningOfChatHistorySelfDM: 'This is your personal space. Use it for notes, tasks, drafts, and reminders.', beginningOfChatHistorySystemDM: "Welcome! Let's get you set up.", chatWithAccountManager: 'Chat with your account manager here', @@ -679,6 +679,7 @@ const translations = { yourSpace: 'Your space', welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `Welcome to ${roomName}!`, usePlusButton: ({additionalText}: UsePlusButtonParams) => `\nUse the + button to ${additionalText} an expense.`, + justUsePlusButton: `\nJust use the + button.`, askConcierge: '\nAsk questions and get 24/7 realtime support.', iouTypes: { pay: 'pay', diff --git a/src/languages/es.ts b/src/languages/es.ts index 9087777f3e8b..349c9cba440f 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -665,7 +665,7 @@ const translations = { beginningOfChatHistory: 'Este chat es con', beginningOfChatHistoryPolicyExpenseChatPartOne: 'Aquí es donde ', beginningOfChatHistoryPolicyExpenseChatPartTwo: ' enviará los gastos al espacio de trabajo ', - beginningOfChatHistoryPolicyExpenseChatPartThree: '. Solo usa el botón +.', + beginningOfChatHistoryPolicyExpenseChatPartThree: '.', beginningOfChatHistorySelfDM: 'Este es tu espacio personal. Úsalo para notas, tareas, borradores y recordatorios.', beginningOfChatHistorySystemDM: '¡Bienvenido! Vamos a configurar tu cuenta.', chatWithAccountManager: 'Chatea con tu gestor de cuenta aquí', @@ -673,6 +673,7 @@ const translations = { yourSpace: 'Tu espacio', welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `¡Bienvenido a ${roomName}!`, usePlusButton: ({additionalText}: UsePlusButtonParams) => `\nUsa el botón + para ${additionalText} un gasto`, + justUsePlusButton: `\nSolo usa el botón +.`, askConcierge: 'Haz preguntas y obtén soporte en tiempo real las 24/7.', iouTypes: { pay: 'pagar', From dc5d24686fa3296f5a6802e836162312821f49d8 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Wed, 2 Oct 2024 12:19:15 +0700 Subject: [PATCH 6/8] update policy expense chat welcome text --- src/components/ReportWelcomeText.tsx | 1 - src/languages/en.ts | 3 +-- src/languages/es.ts | 3 +-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/components/ReportWelcomeText.tsx b/src/components/ReportWelcomeText.tsx index d73614493ff1..12708a7acbfa 100644 --- a/src/components/ReportWelcomeText.tsx +++ b/src/components/ReportWelcomeText.tsx @@ -217,7 +217,6 @@ function ReportWelcomeText({report, policy}: ReportWelcomeTextProps) { )} {shouldShowUsePlusButtonText && {translate('reportActionsView.usePlusButton', {additionalText})}} - {isPolicyExpenseChat && moneyRequestOptions.length && {translate('reportActionsView.justUsePlusButton')}} {ReportUtils.isConciergeChatReport(report) && {translate('reportActionsView.askConcierge')}} diff --git a/src/languages/en.ts b/src/languages/en.ts index 55fbafaf5686..8957a908fd83 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -671,7 +671,7 @@ const translations = { beginningOfChatHistory: 'This chat is with ', beginningOfChatHistoryPolicyExpenseChatPartOne: 'This is where ', beginningOfChatHistoryPolicyExpenseChatPartTwo: ' will submit expenses to the ', - beginningOfChatHistoryPolicyExpenseChatPartThree: ' workspace.', + beginningOfChatHistoryPolicyExpenseChatPartThree: ' workspace. Just use the + button.', beginningOfChatHistorySelfDM: 'This is your personal space. Use it for notes, tasks, drafts, and reminders.', beginningOfChatHistorySystemDM: "Welcome! Let's get you set up.", chatWithAccountManager: 'Chat with your account manager here', @@ -679,7 +679,6 @@ const translations = { yourSpace: 'Your space', welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `Welcome to ${roomName}!`, usePlusButton: ({additionalText}: UsePlusButtonParams) => `\nUse the + button to ${additionalText} an expense.`, - justUsePlusButton: `\nJust use the + button.`, askConcierge: '\nAsk questions and get 24/7 realtime support.', iouTypes: { pay: 'pay', diff --git a/src/languages/es.ts b/src/languages/es.ts index 349c9cba440f..9087777f3e8b 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -665,7 +665,7 @@ const translations = { beginningOfChatHistory: 'Este chat es con', beginningOfChatHistoryPolicyExpenseChatPartOne: 'Aquí es donde ', beginningOfChatHistoryPolicyExpenseChatPartTwo: ' enviará los gastos al espacio de trabajo ', - beginningOfChatHistoryPolicyExpenseChatPartThree: '.', + beginningOfChatHistoryPolicyExpenseChatPartThree: '. Solo usa el botón +.', beginningOfChatHistorySelfDM: 'Este es tu espacio personal. Úsalo para notas, tareas, borradores y recordatorios.', beginningOfChatHistorySystemDM: '¡Bienvenido! Vamos a configurar tu cuenta.', chatWithAccountManager: 'Chatea con tu gestor de cuenta aquí', @@ -673,7 +673,6 @@ const translations = { yourSpace: 'Tu espacio', welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `¡Bienvenido a ${roomName}!`, usePlusButton: ({additionalText}: UsePlusButtonParams) => `\nUsa el botón + para ${additionalText} un gasto`, - justUsePlusButton: `\nSolo usa el botón +.`, askConcierge: 'Haz preguntas y obtén soporte en tiempo real las 24/7.', iouTypes: { pay: 'pagar', From 736ecb7ef6ca740d162218c11de2adbba8dae27f Mon Sep 17 00:00:00 2001 From: nkdengineer <161821005+nkdengineer@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:45:36 +0700 Subject: [PATCH 7/8] Update src/languages/en.ts Co-authored-by: Kevin Brian Bader <56457735+ikevin127@users.noreply.github.com> --- src/languages/en.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 7025fa6cd71e..170aa9c93855 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -670,7 +670,7 @@ const translations = { beginningOfChatHistoryInvoiceRoomPartTwo: `. Use the + button to send an invoice.`, beginningOfChatHistory: 'This chat is with ', beginningOfChatHistoryPolicyExpenseChatPartOne: 'This is where ', - beginningOfChatHistoryPolicyExpenseChatPartTwo: ' will submit expenses to the ', + beginningOfChatHistoryPolicyExpenseChatPartTwo: ' will submit expenses to ', beginningOfChatHistoryPolicyExpenseChatPartThree: ' workspace. Just use the + button.', beginningOfChatHistorySelfDM: 'This is your personal space. Use it for notes, tasks, drafts, and reminders.', beginningOfChatHistorySystemDM: "Welcome! Let's get you set up.", From 79dda7a7213e047fc03b0a0522932c1f6ae965c2 Mon Sep 17 00:00:00 2001 From: nkdengineer Date: Fri, 4 Oct 2024 03:39:11 +0700 Subject: [PATCH 8/8] update translation for user created room --- src/languages/en.ts | 2 +- src/languages/es.ts | 2 +- src/libs/SidebarUtils.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 4cc75d671dc3..0863b0f8db9e 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -665,7 +665,7 @@ const translations = { beginningOfChatHistoryAnnounceRoomPartOne: ({workspaceName}: BeginningOfChatHistoryAnnounceRoomPartOneParams) => `This chat is with everyone in ${workspaceName} workspace.`, beginningOfChatHistoryAnnounceRoomPartTwo: ` Use it for the most important announcements.`, beginningOfChatHistoryUserRoomPartOne: 'This chat room is for anything ', - beginningOfChatHistoryUserRoomPartTwo: ({displayName}: {displayName: string}) => ` related. It was created by ${displayName}.`, + beginningOfChatHistoryUserRoomPartTwo: ' related.', beginningOfChatHistoryInvoiceRoomPartOne: `This chat is for invoices between `, beginningOfChatHistoryInvoiceRoomPartTwo: `. Use the + button to send an invoice.`, beginningOfChatHistory: 'This chat is with ', diff --git a/src/languages/es.ts b/src/languages/es.ts index 981f684f7896..a9a904cdcc27 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -659,7 +659,7 @@ const translations = { beginningOfChatHistoryAnnounceRoomPartOne: ({workspaceName}: BeginningOfChatHistoryAnnounceRoomPartOneParams) => `Este chat es con todos en el espacio de trabajo ${workspaceName}.`, beginningOfChatHistoryAnnounceRoomPartTwo: ` Úsalo para hablar sobre la configuración del espacio de trabajo y más.`, beginningOfChatHistoryUserRoomPartOne: 'ste chat es para todo lo relacionado con ', - beginningOfChatHistoryUserRoomPartTwo: ({displayName}: {displayName: string}) => ` Fue creado por ${displayName}.`, + beginningOfChatHistoryUserRoomPartTwo: ' Fue creado por.', beginningOfChatHistoryInvoiceRoomPartOne: `Este chat es para facturas entre `, beginningOfChatHistoryInvoiceRoomPartTwo: `. Usa el botón + para enviar una factura.`, beginningOfChatHistory: 'Este chat es con', diff --git a/src/libs/SidebarUtils.ts b/src/libs/SidebarUtils.ts index 1ad23b64255a..46af583aad87 100644 --- a/src/libs/SidebarUtils.ts +++ b/src/libs/SidebarUtils.ts @@ -613,7 +613,7 @@ function getRoomWelcomeMessage(report: OnyxEntry): WelcomeMessage { } else { // Message for user created rooms or other room types. welcomeMessage.phrase1 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryUserRoomPartOne'); - welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryUserRoomPartTwo', {displayName: ReportUtils.getPolicyName(report)}); + welcomeMessage.phrase2 = Localize.translateLocal('reportActionsView.beginningOfChatHistoryUserRoomPartTwo'); } welcomeMessage.messageText = `${welcomeMessage.phrase1} ${welcomeMessage.showReportName ? ReportUtils.getReportName(report) : ''} ${welcomeMessage.phrase2 ?? ''}`;