diff --git a/src/front/Components/Layouts/Rib/classes.module.scss b/src/front/Components/Layouts/Rib/classes.module.scss index 13f423ce..0f56bc8b 100644 --- a/src/front/Components/Layouts/Rib/classes.module.scss +++ b/src/front/Components/Layouts/Rib/classes.module.scss @@ -5,6 +5,16 @@ margin-top: 24px; } + .loader-container { + display: flex; + justify-content: center; + margin-top: 150px; + .loader { + width: 32px; + height: 32px; + } + } + .title { margin-top: 24px; } diff --git a/src/front/Components/Layouts/Rib/index.tsx b/src/front/Components/Layouts/Rib/index.tsx index 0555dd0e..0e4507b7 100644 --- a/src/front/Components/Layouts/Rib/index.tsx +++ b/src/front/Components/Layouts/Rib/index.tsx @@ -8,6 +8,7 @@ import { useRouter } from "next/router"; import OfficeRib from "@Front/Api/LeCoffreApi/Notary/OfficeRib/OfficeRib"; import DepositRib from "@Front/Components/DesignSystem/DepositRib"; import Confirm from "@Front/Components/DesignSystem/Modal/Confirm"; +import Loader from "@Front/Components/DesignSystem/Loader"; export default function Rib() { const [documentList, setDocumentList] = useState([]); @@ -18,13 +19,12 @@ export default function Rib() { const [key, setKey] = useState(""); const [isRibModalOpen, setIsRibModalOpen] = useState(false); const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false); - + const [isLoading, setIsLoading] = useState(true); //Put fetch data in a useCallback const fetchData = useCallback(async () => { try { const blob = await OfficeRib.getInstance().getRibStream(); - setFileBlob(blob.blob); setKey(key); setFileName(blob.fileName); @@ -33,6 +33,7 @@ export default function Rib() { setFileName(""); setKey(""); } + setIsLoading(false); }, [key]); useEffect(() => { @@ -96,44 +97,49 @@ export default function Rib() { RIB de l'office - - {!fileBlob && ( -
-
- - Aucun RIB n'a été déposé pour cet office - + {isLoading && ( +
+
+
)} - - {!fileBlob && ( -
-
- + {!isLoading && !fileBlob && ( + <> +
+
+ + Aucun RIB n'a été déposé pour cet office + +
-
+
+
+ +
+
+ )} - {fileBlob && ( -
-
- {fileBlob && } + {!isLoading && fileBlob && ( + <> +
+
+ {fileBlob && } +
-
- )} - {fileBlob && ( -
-
- - - +
+
+ + + +
-
+ )}