GenericSidebar.js
5.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import Image from "next/image";
import Link from "next/link";
import { useRouter } from "next/router";
import React from "react";
import { useSelector } from "react-redux";
export const GenericSidebar = ({ isRoute }) => {
const router = useRouter();
const { loadedUser, error } = useSelector(state => state.loadedUser);
const VenderRoutes = () => {
return (
<ul>
<li className={router.pathname === "/vendor/dashboard" ? "active" : ""}>
<Link href="/vendor/dashboard">
<span className="d-flex cursor-pointer">
<Image className="" alt="" width={22} height={15} src="/images/vendor/icon-dashboard.svg" />
<div className="mx-2">Dashboard</div>
</span>
</Link>
</li>
{loadedUser && loadedUser.approved == "approved" && (
<li className={router.pathname === "/vendor/activity-details" ? "active" : ""}>
<Link href="/vendor/activity-details">
<span className="d-flex cursor-pointer">
<Image className="" alt="" width={25} height={18} src="/images/vendor/add-activity.svg" />
<div className="mx-2">Add Activity</div>
</span>
</Link>
</li>
)}
<li className={router.pathname === "/vendor/business-details" ? "active" : ""}>
<Link href="/vendor/business-details">
<span className="d-flex cursor-pointer">
<Image className="" alt="" width={22} height={15} src="/images/vendor/icon-dashboard.svg" />
<div className="mx-2">Business Details</div>
</span>
</Link>
</li>
<li className={router.pathname === "/vendor/enquiries" ? "active" : ""}>
<Link href="/vendor/enquiries">
<span className="d-flex cursor-pointer">
<Image alt="" width={22} height={15} src="/images/vendor/icon-orders.svg" />
<div className="mx-2">Enquiries</div>
</span>
</Link>
</li>
<li className={router.pathname === "/vendor/activities" ? "active" : ""}>
<Link href="/vendor/activities">
<span className="d-flex cursor-pointer">
<Image alt="" width={22} height={15} src="/images/vendor/icon-activities.svg" />
<div className="mx-2">Activities</div>
</span>
</Link>
</li>
<li className={router.pathname === "/vendor/reviews" ? "active" : ""}>
<Link href="/vendor/reviews">
<span className="d-flex cursor-pointer">
<Image alt="" width={22} height={15} src="/images/vendor/icon-orders.svg" />
<div className="mx-2">Reviews</div>
</span>
</Link>
</li>
</ul>
);
};
const AdminRoutes = () => {
return (
<ul>
<li className={router.pathname === "/admin/activities" ? "active" : ""}>
<Link href="/admin/activities">
<span className="d-flex cursor-pointer">
<Image className="" alt="" width={22} height={15} src="/images/vendor/icon-activities.svg" />
<div className="mx-2">Activities</div>
</span>
</Link>
</li>
<li className={router.pathname === "/admin/vendors" ? "active" : ""}>
<Link href="/admin/vendors">
<span className="d-flex cursor-pointer">
<Image className="" alt="" width={25} height={18} src="/images/admin/icon-user.svg" />
<div className="mx-2">Vendor</div>
</span>
</Link>
</li>
<li className={router.pathname === "/admin/giftcards" ? "active" : ""}>
<Link href="/admin/giftcards">
<span className="d-flex cursor-pointer">
<Image className="" alt="" width={22} height={15} src="/images/admin/icon-gift.svg" />
<div className="mx-2">Gift Card</div>
</span>
</Link>
</li>
<li className={router.pathname === "/admin/reviews" ? "active" : ""}>
<Link href="/admin/reviews">
<span className="d-flex cursor-pointer">
<Image alt="" width={22} height={15} src="/images/vendor/icon-orders.svg" />
<div className="mx-2">Reviews</div>
</span>
</Link>
</li>
<li className={router.pathname === "/admin/contact-us-leads" ? "active" : ""}>
<Link href="/admin/contact-us-leads">
<span className="d-flex cursor-pointer">
<Image alt="" width={22} height={15} src="/images/vendor/icon-orders.svg" />
<div className="mx-2">Contact Us Leads</div>
</span>
</Link>
</li>
<li className={router.pathname === "/admin/enquiries" ? "active" : ""}>
<Link prefetch href="/admin/enquiries">
<span className="d-flex cursor-pointer">
<Image alt="" width={22} height={15} src="/images/admin/icon-gift.svg" />
<div className="mx-2">Enquiries</div>
</span>
</Link>
</li>
</ul>
);
};
return (
<div
className="h-100 d-flex flex-column justify-content-between bg-z-primary primary-sidebar"
style={{
width: "15%",
boxShadow: "8px 0px 16px -15px rgba(0,0,0,0.25)",
"-webkit-box-shadow": "8px 0px 16px -15px rgba(0,0,0,0.25)",
"-moz-box-shadow": "8px 0px 16px -15px rgba(0,0,0,0.25)"
}}
>
{isRoute === "vendor" && <VenderRoutes />}
{isRoute === "admin" && <AdminRoutes />}
<div
className="px-3 py-2"
style={{
borderInlineStart: "4px solid #393e49"
}}
>
<p className="text-white m-0" style={{ fontSize: 16 }}>
{isRoute === "admin" ? "Admin" : "Vendor"}
</p>
</div>
</div>
);
};