From 79bc99c8aab73f7f1f85438ec8db31fca66dfbd7 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Mon, 2 Oct 2023 15:50:43 +0200 Subject: [PATCH] :sparkles: New anchoring --- .../Folder/FolderInformation/index.tsx | 69 +++++++++++-------- 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx index 4afac6fa..e07138ca 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx @@ -13,7 +13,7 @@ import { OfficeFolder } from "le-coffre-resources/dist/Notary"; import { EDocumentStatus } from "le-coffre-resources/dist/Notary/Document"; import Link from "next/link"; import { NextRouter, useRouter } from "next/router"; -import { ChangeEvent } from "react"; +import { ChangeEvent, useCallback, useEffect, useState } from "react"; import Image from "next/image"; import ValidateAnchoringGif from "@Front/Assets/images/validate_anchoring.gif"; @@ -21,12 +21,21 @@ import BasePage from "../../Base"; import classes from "./classes.module.scss"; import ClientSection from "./ClientSection"; import CheckBox from "@Front/Components/DesignSystem/CheckBox"; +import Loader from "@Front/Components/DesignSystem/Loader"; + +enum AnchorStatus { + "VERIFIED_ON_CHAIN" = "VERIFIED_ON_CHAIN", + "ANCHORING" = "ANCHORING", + "NOT_ANCHORED" = "NOT_ANCHORED", + "FETCHING" = "FETCHING", +} type IProps = {}; type IPropsClass = IProps & { router: NextRouter; selectedFolderUid: string; + isAnchored: AnchorStatus; }; type IState = { @@ -36,7 +45,6 @@ type IState = { isValidateModalVisible: boolean; hasValidateAnchoring: boolean; isVerifDeleteModalVisible: boolean; - isAnchored: boolean | null; isPreventArchiveModalOpen: boolean; }; class FolderInformationClass extends BasePage { @@ -49,7 +57,6 @@ class FolderInformationClass extends BasePage { isValidateModalVisible: false, hasValidateAnchoring: false, isVerifDeleteModalVisible: false, - isAnchored: null, isPreventArchiveModalOpen: false, }; this.onSelectedFolder = this.onSelectedFolder.bind(this); @@ -64,7 +71,6 @@ class FolderInformationClass extends BasePage { this.openValidateModal = this.openValidateModal.bind(this); this.openVerifDeleteFolder = this.openVerifDeleteFolder.bind(this); this.closeVerifDeleteFolder = this.closeVerifDeleteFolder.bind(this); - this.verifyAnchorStatus = this.verifyAnchorStatus.bind(this); this.closePreventArchiveModal = this.closePreventArchiveModal.bind(this); } @@ -116,12 +122,18 @@ class FolderInformationClass extends BasePage { {this.everyDocumentValidated() && ( <> - {this.state.isAnchored === null && ( + {this.props.isAnchored === AnchorStatus.NOT_ANCHORED && ( )} - {this.state.isAnchored === true && ( + {this.props.isAnchored === AnchorStatus.ANCHORING && ( + + )} + {this.props.isAnchored === AnchorStatus.VERIFIED_ON_CHAIN && (