diff --git a/src/front/Components/DesignSystem/DepositDocument/classes.module.scss b/src/front/Components/DesignSystem/DepositDocument/classes.module.scss index 9a4268f2..9bba001b 100644 --- a/src/front/Components/DesignSystem/DepositDocument/classes.module.scss +++ b/src/front/Components/DesignSystem/DepositDocument/classes.module.scss @@ -66,6 +66,10 @@ display: flex; align-items: center; gap: 8px; + .loader { + width: 32px; + height: 32px; + } } .cross { diff --git a/src/front/Components/DesignSystem/DepositDocument/index.tsx b/src/front/Components/DesignSystem/DepositDocument/index.tsx index 1c5a43be..2a85bbfa 100644 --- a/src/front/Components/DesignSystem/DepositDocument/index.tsx +++ b/src/front/Components/DesignSystem/DepositDocument/index.tsx @@ -16,6 +16,7 @@ import classNames from "classnames"; import Confirm from "../Modal/Confirm"; import InputField from "../Form/Elements/InputField"; import GreenCheckIcon from "@Assets/Icons/green-check.svg"; +import Loader from "../Loader"; type IProps = { defaultFiles?: FileCustomer[]; @@ -28,6 +29,7 @@ type IFile = { file: File; uid: string; archived: Date | null; + fileName: string; }; type IState = { @@ -36,6 +38,7 @@ type IState = { currentFiles?: FileCustomer[]; refusedReason?: string; isShowRefusedReasonModalVisible: boolean; + loading: boolean; }; export default class DepositDocument extends React.Component { @@ -51,6 +54,7 @@ export default class DepositDocument extends React.Component { currentFiles: this.props.defaultFiles, refusedReason: "", isShowRefusedReasonModalVisible: false, + loading: false, }; this.addDocument = this.addDocument.bind(this); @@ -118,7 +122,7 @@ export default class DepositDocument extends React.Component {
Document check - {this.shortName(fileObj.name)} + {this.shortName(file.fileName || fileObj.name)}
{ ); })} + {this.state.loading && ( +
+
+
+ +
+ + Chargement... + +
+
+
+ )}
)} {this.props.document.document_status !== EDocumentStatus.VALIDATED && ( @@ -174,6 +191,7 @@ export default class DepositDocument extends React.Component { index: this.index++, file: new File([""], file.file_path ?? "", {}), uid: file.uid!, + fileName: file.file_name, archived: file.archived_at ? new Date(file.archived_at) : null, })), }); @@ -276,12 +294,15 @@ export default class DepositDocument extends React.Component { formData.append("file", file, file.name); const query = JSON.stringify({ document: { uid: this.props.document.uid } }); formData.append("q", query); - + this.setState({ + loading: true, + }); const newFile = await Files.getInstance().post(formData); const files = this.state.currentFiles ? [...this.state.currentFiles, newFile] : [newFile]; this.setState({ currentFiles: files, + loading: false, files: [ ...this.state.files, { @@ -289,6 +310,7 @@ export default class DepositDocument extends React.Component { file: file, uid: newFile.uid!, archived: null, + fileName: newFile?.file_name ?? "", }, ], }); diff --git a/src/front/Components/DesignSystem/Loader/classes.module.scss b/src/front/Components/DesignSystem/Loader/classes.module.scss index 37403d86..e2169b11 100644 --- a/src/front/Components/DesignSystem/Loader/classes.module.scss +++ b/src/front/Components/DesignSystem/Loader/classes.module.scss @@ -1,16 +1,15 @@ -@import "@Themes/constants.scss"; - -.loader { - animation: spin 2s linear infinite; - width: 100%; - height: 100%; - - @keyframes spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } +@keyframes s2 { + to { + transform: rotate(1turn); } } + +.root { + width: 100%; + height: 100%; + border-radius: 50%; + border: 8px solid; + border-color: var(--grey-soft); + border-right-color: var(--blue-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 09b63940..e2e13e26 100644 --- a/src/front/Components/DesignSystem/Loader/index.tsx +++ b/src/front/Components/DesignSystem/Loader/index.tsx @@ -1,14 +1,11 @@ import React from "react"; -import LoaderIcon from "@Assets/Icons/loader.svg"; import classes from "./classes.module.scss"; -import Image from "next/image"; interface IProps { className?: string; } export default class Loader extends React.Component { public override render(): JSX.Element { - return {"Loader"}; - // ; + return
; } }