From ebc264f29144e0027c6cd9c72099569d66c513b5 Mon Sep 17 00:00:00 2001 From: 13XAVI Date: Fri, 12 Jul 2024 15:02:04 -0400 Subject: [PATCH] Fix image and routing --- public/icons/AddPeople.svg | 3 +++ public/icons/DiscIcon.svg | 3 +++ public/icons/ExportIcon.svg | 3 +++ public/icons/OrderIcon.svg | 3 +++ public/icons/SalesIcon.svg | 3 +++ public/icons/farmer.svg | 9 +++++++++ src/app/Dashboard/buyerSlice.ts | 2 +- src/components/dashBoard/HomeDash.tsx | 14 ++++++-------- src/layout/DashbordLayout.tsx | 5 ++--- src/layout/HomeLayout.tsx | 3 --- src/pages/SignIn.tsx | 1 + src/pages/TwoFactorAuthForm.tsx | 2 ++ 12 files changed, 36 insertions(+), 15 deletions(-) create mode 100644 public/icons/AddPeople.svg create mode 100644 public/icons/DiscIcon.svg create mode 100644 public/icons/ExportIcon.svg create mode 100644 public/icons/OrderIcon.svg create mode 100644 public/icons/SalesIcon.svg create mode 100644 public/icons/farmer.svg diff --git a/public/icons/AddPeople.svg b/public/icons/AddPeople.svg new file mode 100644 index 00000000..7c146075 --- /dev/null +++ b/public/icons/AddPeople.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/icons/DiscIcon.svg b/public/icons/DiscIcon.svg new file mode 100644 index 00000000..f1c28ff7 --- /dev/null +++ b/public/icons/DiscIcon.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/icons/ExportIcon.svg b/public/icons/ExportIcon.svg new file mode 100644 index 00000000..4d10b65e --- /dev/null +++ b/public/icons/ExportIcon.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/icons/OrderIcon.svg b/public/icons/OrderIcon.svg new file mode 100644 index 00000000..30ebd32c --- /dev/null +++ b/public/icons/OrderIcon.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/icons/SalesIcon.svg b/public/icons/SalesIcon.svg new file mode 100644 index 00000000..bfe3dee2 --- /dev/null +++ b/public/icons/SalesIcon.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/icons/farmer.svg b/public/icons/farmer.svg new file mode 100644 index 00000000..0e00d14b --- /dev/null +++ b/public/icons/farmer.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/app/Dashboard/buyerSlice.ts b/src/app/Dashboard/buyerSlice.ts index 79603bb6..78a97560 100644 --- a/src/app/Dashboard/buyerSlice.ts +++ b/src/app/Dashboard/buyerSlice.ts @@ -15,7 +15,7 @@ interface Buyer { picture: string; provider: string | null; isVerified: boolean; - status: 'active'; + status: string; twoFactorCode: string | null; } diff --git a/src/components/dashBoard/HomeDash.tsx b/src/components/dashBoard/HomeDash.tsx index 97cf7c9b..c7ece1df 100644 --- a/src/components/dashBoard/HomeDash.tsx +++ b/src/components/dashBoard/HomeDash.tsx @@ -4,7 +4,6 @@ import { fetchBuyers } from '@/app/Dashboard/buyerSlice'; import { fetchOrders } from '@/app/Dashboard/orderSlice'; import { useAppSelector } from '@/app/hooks'; import { AppDispatch, RootState } from '@/app/store'; -import { fetchProducts } from '@/features/Products/ProductSlice'; import UserMetricsChart from '../Chart'; import TopCategories from '../TopCategories'; @@ -25,7 +24,6 @@ function HomeDash() { const greetings = getGreeting(); const dispatch: AppDispatch = useDispatch(); useEffect(() => { - dispatch(fetchProducts()); dispatch(fetchBuyers()); dispatch(fetchOrders()); }, [dispatch]); @@ -66,7 +64,7 @@ function HomeDash() {
- farmer + farmer
@@ -77,7 +75,7 @@ function HomeDash() { className="border flex items-center px-2 py-1 rounded-md" type="submit" > - Export + Export Export @@ -86,7 +84,7 @@ function HomeDash() {
- Sales + Sales
{sum}$
@@ -100,7 +98,7 @@ function HomeDash() {
- Order + Order
{order.length}
@@ -112,7 +110,7 @@ function HomeDash() {
- Product Sold + Product Sold
{tproduct}
@@ -124,7 +122,7 @@ function HomeDash() {
- New Customers + New Customers
{buyers && diff --git a/src/layout/DashbordLayout.tsx b/src/layout/DashbordLayout.tsx index eddfdf79..63c0859f 100644 --- a/src/layout/DashbordLayout.tsx +++ b/src/layout/DashbordLayout.tsx @@ -1,13 +1,12 @@ import { Outlet } from 'react-router-dom'; -import { ToastContainer } from 'react-toastify'; +// import { ToastContainer } from 'react-toastify'; import DashboardSideNav from '@/components/dashBoard/DashboardSideNav'; import Navbar from '@/components/dashBoard/dashBoardNav'; -import ToastProps from '@/utils/ToastConfig'; function DashboardLayout() { return (
- + {/* */}
diff --git a/src/layout/HomeLayout.tsx b/src/layout/HomeLayout.tsx index d8a3e091..0ebdccdc 100644 --- a/src/layout/HomeLayout.tsx +++ b/src/layout/HomeLayout.tsx @@ -1,13 +1,10 @@ import { Outlet } from 'react-router-dom'; -import { ToastContainer } from 'react-toastify'; import Navbar from '@/components/Navbar'; import Footer from '@/components/Footer/Footer'; -import ToastProps from '@/utils/ToastConfig'; function HomeLayout() { return (
-
diff --git a/src/pages/SignIn.tsx b/src/pages/SignIn.tsx index a80ee67b..81e76e71 100644 --- a/src/pages/SignIn.tsx +++ b/src/pages/SignIn.tsx @@ -63,6 +63,7 @@ function SignIn() { navigate(`/verify-2fa/${id}/${email}`); } else if (token) { if (role === 'Admin') { + showSuccessToast('Admin Logged in Successfully'); navigate('/adminDashboard'); } else { showSuccessToast('Buyer Logged in Successfully'); diff --git a/src/pages/TwoFactorAuthForm.tsx b/src/pages/TwoFactorAuthForm.tsx index 1ddc80e2..268fe6fa 100644 --- a/src/pages/TwoFactorAuthForm.tsx +++ b/src/pages/TwoFactorAuthForm.tsx @@ -6,6 +6,7 @@ import HSButton from '@/components/form/Button'; import otpVector from '../assets/otp.png'; import { useAppDispatch, useAppSelector } from '@/app/hooks'; import { twoFactorverify } from '@/features/Auth/SignInSlice'; +import { showSuccessToast } from '@/utils/ToastConfig'; // formik global valiables interface MyFormValues { @@ -88,6 +89,7 @@ function TwoFactorAuthForm() { useEffect(() => { if (token && user?.userType.name === 'Vendor') { + showSuccessToast('Vendor Logged In Sucessfully'); navigate('/'); } }, [token, user, navigate]);