Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concierge placeholder #48583

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down
10 changes: 0 additions & 10 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,25 +213,13 @@ 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];
if (includesConcierge && userBlockedFromConcierge) {
return translate('reportActionCompose.blockedFromConcierge');
}

return translate('reportActionCompose.writeSomething');
}, [includesConcierge, translate, userBlockedFromConcierge, conciergePlaceholderRandomIndex]);
}, [includesConcierge, translate, userBlockedFromConcierge]);

const focus = () => {
if (composerRef.current === null) {
Expand Down
Loading