Toasts working on success upload

This commit is contained in:
Maxime Lalo 2023-12-14 16:31:54 +01:00
parent e493d7e3a3
commit b042ca2852
5 changed files with 40 additions and 3 deletions

21
package-lock.json generated
View File

@ -28,6 +28,7 @@
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-select": "^5.7.2", "react-select": "^5.7.2",
"react-toastify": "^9.1.3",
"sass": "^1.59.2", "sass": "^1.59.2",
"sharp": "^0.32.1", "sharp": "^0.32.1",
"typescript": "4.9.5", "typescript": "4.9.5",
@ -4085,6 +4086,26 @@
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" "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": { "node_modules/react-transition-group": {
"version": "4.4.5", "version": "4.4.5",
"resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz", "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz",

View File

@ -30,6 +30,7 @@
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-select": "^5.7.2", "react-select": "^5.7.2",
"react-toastify": "^9.1.3",
"sass": "^1.59.2", "sass": "^1.59.2",
"sharp": "^0.32.1", "sharp": "^0.32.1",
"typescript": "4.9.5", "typescript": "4.9.5",

View File

@ -18,6 +18,7 @@ import Alert from "../Modal/Alert";
import GreenCheckIcon from "@Assets/Icons/green-check.svg"; import GreenCheckIcon from "@Assets/Icons/green-check.svg";
import Loader from "../Loader"; import Loader from "../Loader";
import TextAreaField from "../Form/TextareaField"; import TextAreaField from "../Form/TextareaField";
import { toast } from "react-toastify";
type IProps = { type IProps = {
defaultFiles?: FileCustomer[]; defaultFiles?: FileCustomer[];
@ -241,6 +242,10 @@ export default class DepositDocument extends React.Component<IProps, IState> {
} }
} }
private openSuccessToast() {
toast.success("Document envoyé avec succès");
}
private onCloseModalShowRefusedReason() { private onCloseModalShowRefusedReason() {
this.setState({ this.setState({
isShowRefusedReasonModalVisible: false, isShowRefusedReasonModalVisible: false,
@ -370,6 +375,7 @@ export default class DepositDocument extends React.Component<IProps, IState> {
fileName: newFile?.file_name ?? "", fileName: newFile?.file_name ?? "",
}, },
]; ];
this.openSuccessToast();
this.setState( this.setState(
{ {
currentFiles: files, currentFiles: files,

View File

@ -1,7 +1,8 @@
import Head from "next/head"; import Head from "next/head";
import { ReactNode } from "react"; import { ReactNode } from "react";
type DefaultLayoutProps = { children: ReactNode }; type DefaultLayoutProps = { children: ReactNode };
import { ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
export const DefaultLayout = ({ children }: DefaultLayoutProps) => { export const DefaultLayout = ({ children }: DefaultLayoutProps) => {
return ( return (
<> <>
@ -9,7 +10,10 @@ export const DefaultLayout = ({ children }: DefaultLayoutProps) => {
<title>LECoffre</title> <title>LECoffre</title>
{/* <link rel="shortcut icon" href="/favicon.svg" /> */} {/* <link rel="shortcut icon" href="/favicon.svg" /> */}
</Head> </Head>
<main>{children}</main> <main>
{children}
<ToastContainer />
</main>
</> </>
); );
}; };

View File

@ -63,4 +63,9 @@ a:hover {
.react-select__menu-notice { .react-select__menu-notice {
font-size: 18px; font-size: 18px;
font-family: Inter; font-family: Inter;
} }
.Toastify__toast-body {
font-size: 14px;
font-family: Inter;
}