diff --git a/package.json b/package.json index 0290200..8c05f3c 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "next": "^14.2.3", "react": "^18", "react-dom": "^18", + "react-toastify": "^10.0.5", "sass": "^1.75.0", "stylis": "^4.3.1", "stylis-plugin-rtl": "^2.1.1", diff --git a/src/app/(withAuth)/dashboard/layout.js b/src/app/(withAuth)/dashboard/layout.js index 877f900..213bb0a 100644 --- a/src/app/(withAuth)/dashboard/layout.js +++ b/src/app/(withAuth)/dashboard/layout.js @@ -1,6 +1,10 @@ +import 'react-toastify/dist/ReactToastify.css'; + const Layout = ({children}) => { return ( - <>{children} + <> + {children} + ) } diff --git a/src/app/(withAuth)/dashboard/template.js b/src/app/(withAuth)/dashboard/template.js index c44d626..9b2fea8 100644 --- a/src/app/(withAuth)/dashboard/template.js +++ b/src/app/(withAuth)/dashboard/template.js @@ -1,6 +1,8 @@ import {Box, Stack} from "@mui/material"; import HeaderWithLogo from "@/components/layouts/dashboard/headerWithLogo"; import HeaderWithSidebar from "@/components/layouts/dashboard/headerWithSidebar"; +import 'react-toastify/dist/ReactToastify.css'; +import {ToastContainer} from "react-toastify"; const Template = ({children}) => { return ( @@ -8,6 +10,7 @@ const Template = ({children}) => { {children} + ) diff --git a/src/app/template.js b/src/app/template.js index cc8a8f2..14f15b6 100644 --- a/src/app/template.js +++ b/src/app/template.js @@ -2,7 +2,9 @@ import cacheProviderRtl from "@/core/utils/cacheRtl"; import {CssBaseline, ThemeProvider} from "@mui/material"; import theme from "@/core/utils/theme"; import {AppRouterCacheProvider} from "@mui/material-nextjs/v14-appRouter"; -import "^/global.scss" +import 'react-toastify/dist/ReactToastify.css'; +import "^/global.scss"; +import {ToastContainer} from "react-toastify"; const Template = ({children}) => { return ( @@ -10,6 +12,7 @@ const Template = ({children}) => { {children} + ) diff --git a/src/components/home/Toolbar.jsx b/src/components/home/Toolbar.jsx index 437f6ee..c528236 100644 --- a/src/components/home/Toolbar.jsx +++ b/src/components/home/Toolbar.jsx @@ -1,8 +1,16 @@ import {Button} from "@mui/material"; +import {toast} from "react-toastify"; const Toolbar = ({columns}) => { + + const notif = () => { + toast("Wow so easy!") + } + return ( - + <> + + ) } export default Toolbar diff --git a/src/core/components/DataTable/filter/FilterBody.jsx b/src/core/components/DataTable/filter/FilterBody.jsx index 40b77c1..dbfd41b 100644 --- a/src/core/components/DataTable/filter/FilterBody.jsx +++ b/src/core/components/DataTable/filter/FilterBody.jsx @@ -7,6 +7,8 @@ import {useEffect, useState} from "react"; import FilterHeader from "@/core/components/DataTable/filter/FilterHeader"; import * as Yup from "yup"; import FilterBodyField from "@/core/components/DataTable/filter/FilterBodyField"; +import {toast} from "react-toastify"; +import AskForKeep from "@/core/components/NotificationDesign/AskForKeep"; const ScrollBox = styled(Box)({ flexGrow: 1, @@ -89,10 +91,19 @@ function FilterBody({columns, drawerState, setDrawerState}) { ); const handleSubmit = (values, {setSubmitting}) => { - console.log("Form values:", values); + toast(, { + draggable: true, + containerId: "filtering", + autoClose: false, + position: "bottom-left", + }); setSubmitting(false); }; + const onSaveFilter = () => { + toast.dismiss({containerId: "filtering"}); + }; + return ( setDrawerState(false)} sx={{overflowY: "hidden", display: "flex", flexDirection: "column", height: "100%"}}> @@ -104,60 +115,62 @@ function FilterBody({columns, drawerState, setDrawerState}) { onSubmit={handleSubmit} validationSchema={validationSchema} > - {({ - values, - handleChange, - handleBlur, - setFieldValue, - errors, - touched, - isSubmitting, - isValid, - dirty, - resetForm - }) => ( -
- - { - columns.map((column) => ( - column.enableColumnFilter && ( - - ) - )) - } - - - - -
- )} + { + ({ + values, + handleChange, + handleBlur, + setFieldValue, + errors, + touched, + isSubmitting, + isValid, + dirty, + resetForm + }) => ( +
+ + { + columns.map((column) => ( + column.enableColumnFilter && ( + + ) + )) + } + + + + +
+ + )} )} diff --git a/src/core/components/NotificationDesign/AskForKeep.jsx b/src/core/components/NotificationDesign/AskForKeep.jsx new file mode 100644 index 0000000..1d688a9 --- /dev/null +++ b/src/core/components/NotificationDesign/AskForKeep.jsx @@ -0,0 +1,47 @@ +'use client' + +import BeenhereIcon from '@mui/icons-material/Beenhere'; +import {Box, Button, Typography} from "@mui/material"; +import DownloadIcon from '@mui/icons-material/Download'; +import {toast} from "react-toastify"; + +function AskForKeep({onSaveFilter}) { + + const handleDismiss = () => { + toast.dismiss({containerId: "filtering"}); + }; + + return ( + + + + ذخیره سازی اطلاعات + + + + + + آیا مایل به ذخیره فیلتر های اعمال شده برای دفعات بعد هستید؟ + + + + + + + + ); +} + +export default AskForKeep; \ No newline at end of file diff --git a/src/core/utils/theme.js b/src/core/utils/theme.js index 3abbb52..d96fc53 100644 --- a/src/core/utils/theme.js +++ b/src/core/utils/theme.js @@ -1,5 +1,5 @@ 'use client' -import { createTheme } from "@mui/material"; +import {createTheme} from "@mui/material"; const theme = createTheme({ direction: 'rtl',