From d8c5deeb7528694d81216107e2b3590823acd6b9 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Mon, 2 Oct 2023 16:23:01 +0200 Subject: [PATCH 1/3] :sparkles: Add a loader to folders --- .../FolderInformation/classes.module.scss | 12 + .../Folder/FolderInformation/index.tsx | 230 +++++++++--------- 2 files changed, 133 insertions(+), 109 deletions(-) diff --git a/src/front/Components/Layouts/Folder/FolderInformation/classes.module.scss b/src/front/Components/Layouts/Folder/FolderInformation/classes.module.scss index ce30f22f..f84b215e 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/classes.module.scss +++ b/src/front/Components/Layouts/Folder/FolderInformation/classes.module.scss @@ -99,3 +99,15 @@ } } } + +.loader-container { + display: flex; + flex: 1; + align-items: center; + justify-content: center; + height: 100%; + .loader { + width: 40px; + height: 40px; + } +} diff --git a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx index 828443ae..61548236 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx @@ -80,109 +80,124 @@ class FolderInformationClass extends BasePage { .modules.pages.Folder.pages.EditCollaborators.props.path.replace("[folderUid]", this.props.selectedFolderUid); return ( -
- {this.props.selectedFolder ? ( -
-
-
-
- Informations du dossier + {!this.props.isLoading && ( +
+ {this.props.selectedFolder ? ( +
+
+
+
+ Informations du dossier +
+ + +
- - - -
- -
- -
-
- +
+ +
+
+ +
+ {this.doesFolderHaveCustomer() && }
- {this.doesFolderHaveCustomer() && } -
- {!this.doesFolderHaveCustomer() && } + {!this.doesFolderHaveCustomer() && } -
- - {this.everyDocumentValidated() && !this.props.isLoading && ( - <> - {this.props.isAnchored === AnchorStatus.NOT_ANCHORED && ( - - )} - {this.props.isAnchored === AnchorStatus.ANCHORING && ( - - )} - {this.props.isAnchored === AnchorStatus.VERIFIED_ON_CHAIN && ( - - )} - - )} - {!this.doesFolderHaveCustomer() && ( - - - - )} -
- -
- Souhaitez-vous vraiment archiver le dossier ? +
+ + {this.everyDocumentValidated() && !this.props.isLoading && ( + <> + {this.props.isAnchored === AnchorStatus.NOT_ANCHORED && ( + + )} + {this.props.isAnchored === AnchorStatus.ANCHORING && ( + + )} + {this.props.isAnchored === AnchorStatus.VERIFIED_ON_CHAIN && ( + + )} + + )} + {!this.doesFolderHaveCustomer() && ( + + + + )}
- - - -
- Cette action sera irréversible. -
-
-
- ) : ( -
- Informations du dossier -
- - Sélectionnez un dossier - + +
+ Souhaitez-vous vraiment archiver le dossier ? +
+ +
+ +
+ Cette action sera irréversible. +
+
+ ) : ( +
+ Informations du dossier +
+ + Sélectionnez un dossier + +
+
+ )} +
+ )} + {this.props.isLoading && ( +
+
+
- )} -
+
+ )} { - if (!folderUid) return; - setIsLoading(true); - try { - const anchorStatus = await OfficeFolderAnchors.getInstance().get(folderUid as string); - setIsAnchored(anchorStatus.status === "VERIFIED_ON_CHAIN" ? AnchorStatus.VERIFIED_ON_CHAIN : AnchorStatus.ANCHORING); - } catch (e) { - setIsAnchored(AnchorStatus.NOT_ANCHORED); - } - setIsLoading(false); - }, [folderUid]); - const getFolder = useCallback(async () => { if (!folderUid) return; + setIsLoading(true); const query = { q: { deed: { include: { deed_type: true } }, @@ -435,13 +439,21 @@ export default function FolderInformation(props: IProps) { const folder = await Folders.getInstance().getByUid(folderUid as string, query); if (folder) { setSelectedFolder(folder); + + try { + const anchorStatus = await OfficeFolderAnchors.getInstance().get(folderUid as string); + setIsAnchored(anchorStatus.status === "VERIFIED_ON_CHAIN" ? AnchorStatus.VERIFIED_ON_CHAIN : AnchorStatus.ANCHORING); + } catch (e) { + setIsAnchored(AnchorStatus.NOT_ANCHORED); + } } + + setIsLoading(false); }, [folderUid]); useEffect(() => { - verifyAnchorStatus(); getFolder(); - }, [verifyAnchorStatus, getFolder]); + }, [getFolder]); useEffect(() => { setIsLoading(true); From e741db098d0e3ec4fa0fb809437d52fb334b356c Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Mon, 2 Oct 2023 16:25:01 +0200 Subject: [PATCH 2/3] :bug: Fixing useEffect --- .../Components/Layouts/Folder/FolderInformation/index.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx index 61548236..f2d0100c 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx @@ -452,12 +452,10 @@ export default function FolderInformation(props: IProps) { }, [folderUid]); useEffect(() => { + setIsLoading(true); getFolder(); }, [getFolder]); - useEffect(() => { - setIsLoading(true); - }, [folderUid]); return ( Date: Mon, 2 Oct 2023 16:30:47 +0200 Subject: [PATCH 3/3] refacto app host url --- src/pages/_app.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index b5ff011d..31e20063 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -47,7 +47,7 @@ const MyApp = (({ instance.BACK_API_HOST = backApiHost ?? "api.stg.lecoffre.smart-chain.fr"; instance.BACK_API_ROOT_URL = backApiRootUrl ?? "/api"; instance.BACK_API_VERSION = backApiVersion ?? "/v1"; - instance.FRONT_APP_HOST = frontAppHost ?? "app.stg.lecoffre.smart-chain.fr"; + instance.FRONT_APP_HOST = frontAppHost ?? "https://app.stg.lecoffre.smart-chain.fr"; instance.IDNOT_BASE_URL = idNotBaseUrl ?? "https://qual-connexion.idnot.fr"; instance.IDNOT_AUTHORIZE_ENDPOINT = idNotAuthorizeEndpoint ?? "/IdPOAuth2/authorize/idnot_idp_v1"; instance.IDNOT_CLIENT_ID = idNotClientId ?? "4501646203F3EF67";