From 8e91736c774ab4321f67418d43278a36a5f346fe Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Mon, 29 Apr 2024 14:51:29 +0200 Subject: [PATCH] =?UTF-8?q?:sparkles:=20Document=20non=20trouv=C3=A9=20n'a?= =?UTF-8?q?ppara=C3=AEt=20plus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Layouts/Folder/ViewDocuments/index.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx b/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx index 9469d218..d6d36e58 100644 --- a/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx +++ b/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx @@ -34,6 +34,7 @@ type IState = { validatedPercentage: number; document: Document | null; fileBlob: Blob | null; + isLoading: boolean; }; class ViewDocumentsClass extends BasePage { @@ -49,6 +50,7 @@ class ViewDocumentsClass extends BasePage { validatedPercentage: this.getRandomPercentageForOcr(), document: null, fileBlob: null, + isLoading: true, }; this.closeModals = this.closeModals.bind(this); @@ -68,7 +70,7 @@ class ViewDocumentsClass extends BasePage { public override render(): JSX.Element | null { return ( - {this.state.document && this.state.document.files && this.state.selectedFile && ( + {this.state.document && this.state.document.files && this.state.selectedFile && !this.state.isLoading && (
{this.state.document.folder?.name} @@ -156,7 +158,7 @@ class ViewDocumentsClass extends BasePage {
)} - {(!this.state.selectedFile || !this.state.document) && ( + {(!this.state.selectedFile || !this.state.document) && !this.state.isLoading && (
Document non trouvé @@ -182,12 +184,16 @@ class ViewDocumentsClass extends BasePage { document, selectedFileIndex: 0, selectedFile: document.files![0]!, + isLoading: false, }, () => { this.getFilePreview(); }, ); } catch (e) { + this.setState({ + isLoading: false, + }); console.error(e); } }