diff --git a/package-lock.json b/package-lock.json index 53cc4aca..e463010a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,7 @@ "react": "18.2.0", "react-dom": "18.2.0", "react-select": "^5.7.2", + "react-toastify": "^9.1.3", "sass": "^1.59.2", "sharp": "^0.32.1", "typescript": "4.9.5", @@ -4085,6 +4086,26 @@ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" } }, + "node_modules/react-toastify": { + "version": "9.1.3", + "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-9.1.3.tgz", + "integrity": "sha512-fPfb8ghtn/XMxw3LkxQBk3IyagNpF/LIKjOBflbexr2AWxAH1MJgvnESwEwBn9liLFXgTKWgBSdZpw9m4OTHTg==", + "dependencies": { + "clsx": "^1.1.1" + }, + "peerDependencies": { + "react": ">=16", + "react-dom": ">=16" + } + }, + "node_modules/react-toastify/node_modules/clsx": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz", + "integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==", + "engines": { + "node": ">=6" + } + }, "node_modules/react-transition-group": { "version": "4.4.5", "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz", diff --git a/package.json b/package.json index f0f72fa7..9b32d4d6 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "react": "18.2.0", "react-dom": "18.2.0", "react-select": "^5.7.2", + "react-toastify": "^9.1.3", "sass": "^1.59.2", "sharp": "^0.32.1", "typescript": "4.9.5", diff --git a/src/front/Components/DesignSystem/DepositDocument/index.tsx b/src/front/Components/DesignSystem/DepositDocument/index.tsx index 14f55123..b7cf8644 100644 --- a/src/front/Components/DesignSystem/DepositDocument/index.tsx +++ b/src/front/Components/DesignSystem/DepositDocument/index.tsx @@ -18,6 +18,7 @@ import Alert from "../Modal/Alert"; import GreenCheckIcon from "@Assets/Icons/green-check.svg"; import Loader from "../Loader"; import TextAreaField from "../Form/TextareaField"; +import { toast } from "react-toastify"; type IProps = { defaultFiles?: FileCustomer[]; @@ -86,6 +87,7 @@ export default class DepositDocument extends React.Component { this.addDocument = this.addDocument.bind(this); this.onFileChange = this.onFileChange.bind(this); + this.addFile = this.addFile.bind(this); this.removeFile = this.removeFile.bind(this); this.onDragOver = this.onDragOver.bind(this); this.onDragDrop = this.onDragDrop.bind(this); @@ -147,44 +149,42 @@ export default class DepositDocument extends React.Component { ))} - {this.props.document.document_status !== EDocumentStatus.VALIDATED && this.state.files.length > 0 && ( -
- {this.state.files.map((file) => { - const fileObj = file.file; - if (file.archived) return; - return ( -
-
- Document check - - {this.shortName(file.fileName || fileObj.name)} - -
- Cross icon -
- ); - })} - {this.state.loading && ( -
+
+ {this.state.files.map((file) => { + const fileObj = file.file; + if (file.archived) return; + return ( +
-
- -
- - Chargement... + Document check + + {this.shortName(file.fileName || fileObj.name)}
-
+ Cross icon
- )} -
- )} + ); + })} + {this.state.loading && ( +
+
+
+ +
+ + Chargement... + +
+
+
+ )} +
{this.props.document.document_status !== EDocumentStatus.VALIDATED && (
+ {this.props.isAnchored === AnchorStatus.VERIFIED_ON_CHAIN && ( + + )}
) : ( @@ -171,6 +178,25 @@ class FolderInformationClass extends BasePage { this.setState({ isArchivedModalOpen: false }); } + private async downloadAnchoringProof(uid?: string) { + if (!uid) return; + + try { + const file: Blob = await OfficeFolderAnchors.getInstance().download(uid); + const url = window.URL.createObjectURL(file); + const a = document.createElement("a"); + a.style.display = "none"; + a.href = url; + // the filename you want + a.download = `anchoring_proof_${this.props.selectedFolder?.folder_number}_${this.props.selectedFolder?.name}.zip`; + document.body.appendChild(a); + a.click(); + window.URL.revokeObjectURL(url); + } catch (e) { + console.error(e); + } + } + private async getFolder(): Promise { const query = { q: { diff --git a/src/front/index.scss b/src/front/index.scss index a398cb89..e3442de1 100644 --- a/src/front/index.scss +++ b/src/front/index.scss @@ -63,4 +63,9 @@ a:hover { .react-select__menu-notice { font-size: 18px; font-family: Inter; -} \ No newline at end of file +} + +.Toastify__toast-body { + font-size: 14px; + font-family: Inter; +}