Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix image and routing #92

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions public/icons/AddPeople.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/icons/DiscIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/icons/ExportIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/icons/OrderIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/icons/SalesIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions public/icons/farmer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/app/Dashboard/buyerSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface Buyer {
picture: string;
provider: string | null;
isVerified: boolean;
status: 'active';
status: string;
twoFactorCode: string | null;
}

Expand Down
14 changes: 6 additions & 8 deletions src/components/dashBoard/HomeDash.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -25,7 +24,6 @@ function HomeDash() {
const greetings = getGreeting();
const dispatch: AppDispatch = useDispatch();
useEffect(() => {
dispatch(fetchProducts());
dispatch(fetchBuyers());
dispatch(fetchOrders());
}, [dispatch]);
Expand Down Expand Up @@ -66,7 +64,7 @@ function HomeDash() {
</div>
</div>
<div>
<img src="/src/assets/farmer.svg" alt="farmer" />
<img src="/icons/farmer.svg" alt="farmer" />
</div>
</div>

Expand All @@ -77,7 +75,7 @@ function HomeDash() {
className="border flex items-center px-2 py-1 rounded-md"
type="submit"
>
<img src="/src/assets/ExportIcon.svg" alt="Export" />
<img src="/icons/ExportIcon.svg" alt="Export" />
Export
</button>
</div>
Expand All @@ -86,7 +84,7 @@ function HomeDash() {
<div className="mx-4 bg-salesbg p-4 rounded-xl">
<div className="flex items-center gap-2 text-xl font-semibold py-4">
<div className="bg-iconsales p-1 rounded-full w-8">
<img src="/src/assets/SalesIcon.svg" alt="Sales" />
<img src="/icons/SalesIcon.svg" alt="Sales" />
</div>
<div>
<div>{sum}$</div>
Expand All @@ -100,7 +98,7 @@ function HomeDash() {
<div className="mx-4 bg-orderbg p-4 rounded-xl">
<div className="flex items-center gap-2 text-xl font-semibold py-4">
<div className="bg-iconorder p-1 rounded-full w-8">
<img src="/src/assets/OrderIcon.svg" alt="Order" />
<img src="/icons/OrderIcon.svg" alt="Order" />
</div>
<div>{order.length}</div>
</div>
Expand All @@ -112,7 +110,7 @@ function HomeDash() {
<div className="mx-4 bg-psoldbg p-4 rounded-xl">
<div className="flex items-center gap-2 text-xl font-semibold py-4">
<div className="bg-psoldicon p-1 rounded-full w-8">
<img src="/src/assets/DiscIcon.svg" alt="Product Sold" />
<img src="/icons/DiscIcon.svg" alt="Product Sold" />
</div>
<div>{tproduct}</div>
</div>
Expand All @@ -124,7 +122,7 @@ function HomeDash() {
<div className="mx-4 bg-customerbg p-4 rounded-xl">
<div className="flex items-center gap-2 text-xl font-semibold py-4">
<div className="bg-customericon p-1 rounded-full">
<img src="/src/assets/AddPeople.svg" alt="New Customers" />
<img src="/icons/AddPeople.svg" alt="New Customers" />
</div>
<div>
{buyers &&
Expand Down
5 changes: 2 additions & 3 deletions src/layout/DashbordLayout.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div className="bg-dashgrey flex flex-col min-h-screen">
<ToastContainer {...ToastProps} />
{/* <ToastContainer /> */}
<div className="fixed bg-white top-0 left-0 right-0 z-50">
<Navbar />
</div>
Expand Down
3 changes: 0 additions & 3 deletions src/layout/HomeLayout.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div>
<ToastContainer {...ToastProps} />
<div>
<Navbar />
</div>
Expand Down
1 change: 1 addition & 0 deletions src/pages/SignIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 2 additions & 0 deletions src/pages/TwoFactorAuthForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -88,6 +89,7 @@ function TwoFactorAuthForm() {

useEffect(() => {
if (token && user?.userType.name === 'Vendor') {
showSuccessToast('Vendor Logged In Sucessfully');
navigate('/');
}
}, [token, user, navigate]);
Expand Down
Loading