From 5aafce90d71978bfdea046782063c990b92eb635 Mon Sep 17 00:00:00 2001 From: Max S Date: Mon, 29 Jul 2024 15:10:10 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Loading=20t=C3=A9l=C3=A9chargement=20preuve?= =?UTF-8?q?=20d'ancrage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DesignSystem/Button/classes.module.scss | 3 +- .../Components/DesignSystem/Button/index.tsx | 16 ++++++--- .../DesignSystem/Loader/classes.module.scss | 6 ---- .../Components/DesignSystem/Loader/index.tsx | 4 ++- .../DownloadAnchoringProofModal/index.tsx | 34 ++++++++++++++++--- 5 files changed, 46 insertions(+), 17 deletions(-) diff --git a/src/front/Components/DesignSystem/Button/classes.module.scss b/src/front/Components/DesignSystem/Button/classes.module.scss index d367db76..9beda2dd 100644 --- a/src/front/Components/DesignSystem/Button/classes.module.scss +++ b/src/front/Components/DesignSystem/Button/classes.module.scss @@ -677,7 +677,8 @@ text-transform: inherit; } - &[disabled="true"] { + &:disabled { opacity: var(--opacity-disabled, 0.3); + pointer-events: none; } } diff --git a/src/front/Components/DesignSystem/Button/index.tsx b/src/front/Components/DesignSystem/Button/index.tsx index 0bdb4974..73f6789b 100644 --- a/src/front/Components/DesignSystem/Button/index.tsx +++ b/src/front/Components/DesignSystem/Button/index.tsx @@ -2,6 +2,7 @@ import classNames from "classnames"; import React from "react"; import classes from "./classes.module.scss"; +import Loader from "../Loader"; export enum EButtonVariant { PRIMARY = "primary", @@ -57,18 +58,23 @@ export default function Button(props: IButtonProps) { } = props; const fullwidthattr = fullwidth.toString(); - const isloadingattr = isLoading.toString(); - const attributes = { ...props, variant, disabled, type, isloadingattr, fullwidthattr, sizing: size, styletype }; + const attributes = { ...props, variant, disabled, type, fullwidthattr, sizing: size, styletype }; delete attributes.fullwidth; delete attributes.leftIcon; delete attributes.rightIcon; + delete attributes.isLoading; return ( - ); } diff --git a/src/front/Components/DesignSystem/Loader/classes.module.scss b/src/front/Components/DesignSystem/Loader/classes.module.scss index 1be2f0b0..0faa120e 100644 --- a/src/front/Components/DesignSystem/Loader/classes.module.scss +++ b/src/front/Components/DesignSystem/Loader/classes.module.scss @@ -5,11 +5,5 @@ } .root { - width: 100%; - height: 100%; - border-radius: 50%; - border: 8px solid; - border-color: var(--color-neutral-50); - border-right-color: var(--color-info-500-soft); animation: s2 1s infinite linear; } diff --git a/src/front/Components/DesignSystem/Loader/index.tsx b/src/front/Components/DesignSystem/Loader/index.tsx index e2e13e26..c2152759 100644 --- a/src/front/Components/DesignSystem/Loader/index.tsx +++ b/src/front/Components/DesignSystem/Loader/index.tsx @@ -1,4 +1,6 @@ +import { ArrowPathIcon } from "@heroicons/react/24/outline"; import React from "react"; + import classes from "./classes.module.scss"; interface IProps { @@ -6,6 +8,6 @@ interface IProps { } export default class Loader extends React.Component { public override render(): JSX.Element { - return
; + return ; } } diff --git a/src/front/Components/Layouts/Folder/FolderInformation/elements/DownloadAnchoringProofModal/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/elements/DownloadAnchoringProofModal/index.tsx index e9bd477a..460c6538 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/elements/DownloadAnchoringProofModal/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/elements/DownloadAnchoringProofModal/index.tsx @@ -1,6 +1,7 @@ import OfficeFolderAnchors from "@Front/Api/LeCoffreApi/Notary/OfficeFolderAnchors/OfficeFolderAnchors"; import Modal from "@Front/Components/DesignSystem/Modal"; -import Typography, { ETypo } from "@Front/Components/DesignSystem/Typography"; +import Typography, { ETypo, ETypoColor } from "@Front/Components/DesignSystem/Typography"; +import { ArrowDownOnSquareIcon } from "@heroicons/react/24/outline"; import { OfficeFolder } from "le-coffre-resources/dist/Notary"; import React, { useCallback } from "react"; @@ -13,9 +14,15 @@ type IProps = { export default function DownloadAnchoringProofModal(props: IProps) { const { isOpen, onClose, folder } = props; + const [isLoading, setIsLoading] = React.useState(false); + const [error, setError] = React.useState(null); + const downloadAnchoringProof = useCallback(async () => { if (!folder?.uid) return; try { + debugger; + setError(null); + setIsLoading(true); const file = await OfficeFolderAnchors.getInstance().download(folder.uid); const url = window.URL.createObjectURL(file); const a = document.createElement("a"); @@ -26,22 +33,41 @@ export default function DownloadAnchoringProofModal(props: IProps) { a.click(); window.URL.revokeObjectURL(url); onClose?.(); + setIsLoading(false); } catch (e) { console.warn(e); + setIsLoading(false); + setError("Une erreur est survenue lors du téléchargement de la preuve d'ancrage"); } }, [folder?.folder_number, folder?.name, folder.uid, onClose]); + const onCloseModal = useCallback(() => { + setError(null); + setIsLoading(false); + onClose?.(); + }, [onClose]); + return ( + title={isLoading ? "Téléchargement en cours..." : "Félicitations ! Dossier ancré avec succès"} + firstButton={{ children: "Fermer", onClick: onCloseModal }} + secondButton={{ + children: "Télécharger la preuve d’ancrage", + onClick: downloadAnchoringProof, + isLoading: isLoading, + rightIcon: , + }}> Votre dossier a été validé et ancré dans la blockchain. Vous pouvez maintenant télécharger la preuve d'ancrage pour vos archives. + {error && ( + + {error} + + )} ); } From adbd0c28ae4f79679d25d99698aa59774a26314c Mon Sep 17 00:00:00 2001 From: Vins Date: Mon, 29 Jul 2024 16:27:37 +0200 Subject: [PATCH 2/2] Fixed design system --- .../DesignSystem/RadioBox/index.tsx | 3 +- .../Components/Layouts/DesignSystem/index.tsx | 96 +++++++++---------- 2 files changed, 50 insertions(+), 49 deletions(-) diff --git a/src/front/Components/DesignSystem/RadioBox/index.tsx b/src/front/Components/DesignSystem/RadioBox/index.tsx index 8653e8de..e856e346 100644 --- a/src/front/Components/DesignSystem/RadioBox/index.tsx +++ b/src/front/Components/DesignSystem/RadioBox/index.tsx @@ -3,6 +3,7 @@ import React from "react"; import Tooltip from "../ToolTip"; import Typography, { ETypo, ETypoColor } from "../Typography"; import classes from "./classes.module.scss"; +import classNames from "classnames"; type IProps = { name: string; @@ -23,7 +24,7 @@ export default class RadioBox extends React.Component { public override render(): JSX.Element { return ( -