From 1ebb8390e463c0401f630a2c628bae3d2a8c4d0d Mon Sep 17 00:00:00 2001 From: Anusha Date: Wed, 4 Sep 2024 22:37:58 +0500 Subject: [PATCH 1/2] Concierge placeholder --- src/languages/en.ts | 10 ---------- src/languages/es.ts | 10 ---------- .../ReportActionCompose/ReportActionCompose.tsx | 11 +---------- 3 files changed, 1 insertion(+), 30 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 66d1e7c73c90..d840fcac8f23 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -541,16 +541,6 @@ export default { sendAttachment: 'Send attachment', addAttachment: 'Add attachment', writeSomething: 'Write something...', - conciergePlaceholderOptions: [ - 'Ask for help!', - 'Ask me anything!', - 'Ask me to book travel!', - 'Ask me what I can do!', - 'Ask me how to pay people!', - 'Ask me how to send an invoice!', - 'Ask me how to scan a receipt!', - 'Ask me how to get a free corporate card!', - ], blockedFromConcierge: 'Communication is barred', fileUploadFailed: 'Upload failed. File is not supported.', localTime: ({user, time}: LocalTimeParams) => `It's ${time} for ${user}`, diff --git a/src/languages/es.ts b/src/languages/es.ts index 54402fd1d6d5..cd5705ca7373 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -532,16 +532,6 @@ export default { sendAttachment: 'Enviar adjunto', addAttachment: 'Añadir archivo adjunto', writeSomething: 'Escribe algo...', - conciergePlaceholderOptions: [ - '¡Pide ayuda!', - '¡Pregúntame lo que sea!', - '¡Pídeme que te reserve un viaje!', - '¡Pregúntame qué puedo hacer!', - '¡Pregúntame cómo pagar a la gente!', - '¡Pregúntame cómo enviar una factura!', - '¡Pregúntame cómo escanear un recibo!', - '¡Pregúntame cómo obtener una tarjeta de crédito corporativa gratis!', - ], blockedFromConcierge: 'Comunicación no permitida', fileUploadFailed: 'Subida fallida. El archivo no es compatible.', localTime: ({user, time}: LocalTimeParams) => `Son las ${time} para ${user}`, diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx index 72e89c8de013..d01f4c24e0c9 100644 --- a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx +++ b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx @@ -213,25 +213,16 @@ function ReportActionCompose({ const userBlockedFromConcierge = useMemo(() => User.isBlockedFromConcierge(blockedFromConcierge), [blockedFromConcierge]); const isBlockedFromConcierge = useMemo(() => includesConcierge && userBlockedFromConcierge, [includesConcierge, userBlockedFromConcierge]); - // If we are on a small width device then don't show last 3 items from conciergePlaceholderOptions - const conciergePlaceholderRandomIndex = useMemo( - () => Math.floor(Math.random() * (translate('reportActionCompose.conciergePlaceholderOptions').length - (shouldUseNarrowLayout ? 4 : 1) + 1)), - // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps - [], - ); - // Placeholder to display in the chat input. const inputPlaceholder = useMemo(() => { if (includesConcierge) { if (userBlockedFromConcierge) { return translate('reportActionCompose.blockedFromConcierge'); } - - return translate('reportActionCompose.conciergePlaceholderOptions')[conciergePlaceholderRandomIndex]; } return translate('reportActionCompose.writeSomething'); - }, [includesConcierge, translate, userBlockedFromConcierge, conciergePlaceholderRandomIndex]); + }, [includesConcierge, translate, userBlockedFromConcierge]); const focus = () => { if (composerRef.current === null) { From 1fe1af122d5341d373af088904a6b6783987d3a5 Mon Sep 17 00:00:00 2001 From: Anusha Date: Mon, 9 Sep 2024 03:52:42 +0500 Subject: [PATCH 2/2] use 1 if block --- .../report/ReportActionCompose/ReportActionCompose.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx index d01f4c24e0c9..3673bd2357c1 100644 --- a/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx +++ b/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx @@ -215,12 +215,9 @@ function ReportActionCompose({ // Placeholder to display in the chat input. const inputPlaceholder = useMemo(() => { - if (includesConcierge) { - if (userBlockedFromConcierge) { - return translate('reportActionCompose.blockedFromConcierge'); - } + if (includesConcierge && userBlockedFromConcierge) { + return translate('reportActionCompose.blockedFromConcierge'); } - return translate('reportActionCompose.writeSomething'); }, [includesConcierge, translate, userBlockedFromConcierge]);