Skip to content
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
1 change: 1 addition & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3248,6 +3248,7 @@ const CONST = {

ACTIVITY_INDICATOR_SIZE: {
LARGE: 'large',
SMALL: 'small',
},

QR_CODE_SIZE: {
Expand Down
50 changes: 22 additions & 28 deletions src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,10 @@ function MoneyReportHeader({
const transactionIDs = useMemo(() => transactions?.map((t) => t.transactionID) ?? [], [transactions]);

const messagePDF = useMemo(() => {
if (!reportPDFFilename) {
return translate('reportDetailsPage.waitForPDF');
}
if (reportPDFFilename === CONST.REPORT_DETAILS_MENU_ITEM.ERROR) {
return translate('reportDetailsPage.errorPDF');
}
return translate('reportDetailsPage.generatedPDF');
return translate('reportDetailsPage.waitForPDF');
}, [reportPDFFilename, translate]);

// Check if there is pending rter violation in all transactionViolations with given transactionIDs.
Expand Down Expand Up @@ -1129,6 +1126,14 @@ function MoneyReportHeader({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [transactionThreadReportID]);

useEffect(() => {
if (!isPDFModalVisible || !reportPDFFilename || reportPDFFilename === CONST.REPORT_DETAILS_MENU_ITEM.ERROR || isDownloadingPDF) {
return;
}
downloadReportPDF(reportPDFFilename, moneyRequestReport?.reportName ?? '');
setIsPDFModalVisible(false);
}, [isPDFModalVisible, reportPDFFilename, isDownloadingPDF, moneyRequestReport?.reportName]);

const shouldShowBackButton = shouldDisplayBackButton || shouldUseNarrowLayout;

const connectedIntegrationName = connectedIntegration ? translate('workspace.accounting.connectionName', {connectionName: connectedIntegration}) : '';
Expand Down Expand Up @@ -1467,37 +1472,26 @@ function MoneyReportHeader({
innerContainerStyle={styles.pv0}
>
<View style={[styles.m5]}>
<View>
<View style={[styles.flexRow, styles.mb4]}>
<Header
title={translate('reportDetailsPage.generatingPDF')}
containerStyles={[styles.alignItemsCenter]}
/>
<View style={[styles.flexRow, styles.mb4]}>
<View style={[styles.flex1]}>
<View style={[styles.flexRow]}>
<Header title={translate('reportDetailsPage.generatingPDF')} />
</View>
<Text style={[styles.mt3]}>{messagePDF}</Text>
</View>
<View>
<Text>{messagePDF}</Text>
{!reportPDFFilename && (
<ActivityIndicator
size={CONST.ACTIVITY_INDICATOR_SIZE.LARGE}
color={theme.textSupporting}
style={styles.mt3}
/>
)}
<View style={[styles.dFlex, styles.justifyContentCenter]}>
<ActivityIndicator
size={CONST.ACTIVITY_INDICATOR_SIZE.SMALL}
color={theme.textSupporting}
style={styles.ml3}
Comment on lines +1483 to +1486

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When failed to generate pdf, still shows loading indicator. Hope this would be fine.

/>
</View>
</View>
{!!reportPDFFilename && reportPDFFilename !== 'error' && (
<Button
isLoading={isDownloadingPDF}
style={[styles.mt3, styles.noSelect]}
onPress={() => downloadReportPDF(reportPDFFilename ?? '', moneyRequestReport?.reportName ?? '')}
text={translate('common.download')}
/>
)}
{(!reportPDFFilename || reportPDFFilename === 'error') && (
<Button
style={[styles.mt3, styles.noSelect]}
onPress={() => setIsPDFModalVisible(false)}
text={translate('common.close')}
text={translate('common.cancel')}
/>
)}
</View>
Expand Down
3 changes: 1 addition & 2 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2244,10 +2244,9 @@ ${amount} für ${merchant} - ${date}`,
},
reportDetailsPage: {
inWorkspace: ({policyName}: ReportPolicyNameParams) => `in ${policyName}`,
generatingPDF: 'PDF wird generiert',
generatingPDF: 'PDF wird generiert...',
waitForPDF: 'Bitte warten Sie, während wir das PDF erstellen.',
errorPDF: 'Beim Versuch, Ihr PDF zu erstellen, ist ein Fehler aufgetreten.',
generatedPDF: 'Ihr Bericht als PDF wurde erstellt!',
},
reportDescriptionPage: {
roomDescription: 'Zimmerbeschreibung',
Expand Down
3 changes: 1 addition & 2 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2205,10 +2205,9 @@ const translations = {
},
reportDetailsPage: {
inWorkspace: ({policyName}: ReportPolicyNameParams) => `in ${policyName}`,
generatingPDF: 'Generating PDF',
generatingPDF: 'Generating PDF...',
Comment thread
daledah marked this conversation as resolved.
Resolved
waitForPDF: 'Please wait while we generate the PDF',
errorPDF: 'There was an error when trying to generate your PDF',
generatedPDF: 'Your report PDF has been generated!',
},
reportDescriptionPage: {
roomDescription: 'Room description',
Expand Down
3 changes: 1 addition & 2 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2209,10 +2209,9 @@ ${amount} para ${merchant} - ${date}`,
},
reportDetailsPage: {
inWorkspace: ({policyName}: ReportPolicyNameParams) => `en ${policyName}`,
generatingPDF: 'Creando PDF',
generatingPDF: 'Creando PDF...',
waitForPDF: 'Por favor, espera mientras creamos el PDF',
errorPDF: 'Ocurrió un error al crear el PDF',
generatedPDF: 'Tu informe PDF ha sido creado!',
},
reportDescriptionPage: {
roomDescription: 'Descripción de la sala de chat',
Expand Down
3 changes: 1 addition & 2 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2240,10 +2240,9 @@ ${amount} pour ${merchant} - ${date}`,
},
reportDetailsPage: {
inWorkspace: ({policyName}: ReportPolicyNameParams) => `dans ${policyName}`,
generatingPDF: 'Génération du PDF',
generatingPDF: 'Génération du PDF...',
waitForPDF: 'Veuillez patienter pendant que nous générons le PDF',
errorPDF: "Une erreur s'est produite lors de la tentative de génération de votre PDF.",
generatedPDF: 'Votre rapport PDF a été généré !',
},
reportDescriptionPage: {
roomDescription: 'Description de la chambre',
Expand Down
3 changes: 1 addition & 2 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2231,10 +2231,9 @@ ${amount} per ${merchant} - ${date}`,
},
reportDetailsPage: {
inWorkspace: ({policyName}: ReportPolicyNameParams) => `in ${policyName}`,
generatingPDF: 'Generazione PDF',
generatingPDF: 'Generazione PDF...',
waitForPDF: 'Attendere mentre generiamo il PDF',
errorPDF: 'Si è verificato un errore durante il tentativo di generare il tuo PDF.',
generatedPDF: 'Il tuo PDF del rapporto è stato generato!',
},
reportDescriptionPage: {
roomDescription: 'Descrizione della stanza',
Expand Down
3 changes: 1 addition & 2 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2222,10 +2222,9 @@ ${date} - ${merchant}に${amount}`,
},
reportDetailsPage: {
inWorkspace: ({policyName}: ReportPolicyNameParams) => `${policyName} 内`,
generatingPDF: 'PDFを生成中',
generatingPDF: 'PDFを生成中...',
waitForPDF: 'PDFを生成するまでお待ちください',
errorPDF: 'PDFの生成中にエラーが発生しました。',
generatedPDF: 'あなたのレポートPDFが生成されました!',
},
reportDescriptionPage: {
roomDescription: '部屋の説明',
Expand Down
3 changes: 1 addition & 2 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2232,10 +2232,9 @@ ${amount} voor ${merchant} - ${date}`,
},
reportDetailsPage: {
inWorkspace: ({policyName}: ReportPolicyNameParams) => `in ${policyName}`,
generatingPDF: 'PDF genereren',
generatingPDF: 'PDF genereren...',
waitForPDF: 'Even geduld terwijl we de PDF genereren.',
errorPDF: 'Er is een fout opgetreden bij het genereren van uw PDF.',
generatedPDF: 'Je rapport-PDF is gegenereerd!',
},
reportDescriptionPage: {
roomDescription: 'Kamerbeschrijving',
Expand Down
3 changes: 1 addition & 2 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2227,10 +2227,9 @@ ${amount} dla ${merchant} - ${date}`,
},
reportDetailsPage: {
inWorkspace: ({policyName}: ReportPolicyNameParams) => `w ${policyName}`,
generatingPDF: 'Generowanie PDF',
generatingPDF: 'Generowanie PDF...',
waitForPDF: 'Proszę czekać, generujemy PDF',
errorPDF: 'Wystąpił błąd podczas próby wygenerowania Twojego PDF-a.',
generatedPDF: 'Twój raport PDF został wygenerowany!',
},
reportDescriptionPage: {
roomDescription: 'Opis pokoju',
Expand Down
3 changes: 1 addition & 2 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2224,10 +2224,9 @@ ${amount} para ${merchant} - ${date}`,
},
reportDetailsPage: {
inWorkspace: ({policyName}: ReportPolicyNameParams) => `em ${policyName}`,
generatingPDF: 'Gerando PDF',
generatingPDF: 'Gerando PDF...',
waitForPDF: 'Por favor, aguarde enquanto geramos o PDF.',
errorPDF: 'Ocorreu um erro ao tentar gerar seu PDF.',
generatedPDF: 'Seu PDF de relatório foi gerado!',
},
reportDescriptionPage: {
roomDescription: 'Descrição do quarto',
Expand Down
3 changes: 1 addition & 2 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2203,10 +2203,9 @@ ${merchant}的${amount} - ${date}`,
},
reportDetailsPage: {
inWorkspace: ({policyName}: ReportPolicyNameParams) => `在${policyName}中`,
generatingPDF: '生成PDF',
generatingPDF: '生成PDF...',
waitForPDF: '请稍候,我们正在生成 PDF。',
errorPDF: '生成PDF时出现错误。',
generatedPDF: '您的报告 PDF 已生成!',
},
reportDescriptionPage: {
roomDescription: '房间描述',
Expand Down