update 9 files and delete 10 files

master
Reza_ashrafi 2 years ago
parent d54b8a9037
commit 3d0862e6c0
  1. 0
      public/assets/icons/bag-primary.svg
  2. 7
      public/assets/icons/bag-white.svg
  3. 0
      public/assets/icons/book-primary.svg
  4. 7
      public/assets/icons/book-white.svg
  5. 0
      public/assets/icons/bookmark-primary.svg
  6. 6
      public/assets/icons/bookmark-white.svg
  7. 0
      public/assets/icons/dark-primary.svg
  8. 6
      public/assets/icons/dropdown-primary.svg
  9. 0
      public/assets/icons/exit-primary.svg
  10. 0
      public/assets/icons/packet-primary.svg
  11. 5
      public/assets/icons/packet-white.svg
  12. 0
      public/assets/icons/route-primary.svg
  13. 10
      public/assets/icons/route-white.svg
  14. 0
      public/assets/icons/userEdit-primary.svg
  15. 9
      public/assets/icons/userEdit-white.svg
  16. 0
      public/assets/icons/video-primary.svg
  17. 10
      public/assets/icons/video-white.svg
  18. 10
      src/App.scss
  19. 2
      src/components/Navbar/index.js
  20. 5
      src/redux/actions/dashboard.js
  21. 1
      src/redux/actions/index.js
  22. 76
      src/redux/reducers/dashboard.js
  23. 1
      src/redux/reducers/index.js
  24. 4
      src/views/Contact/layouts/Ticket.js
  25. 5
      src/views/Dashboard/index.js
  26. 14
      src/views/Dashboard/layouts/Main/index.js
  27. 278
      src/views/Dashboard/layouts/SidebarMenu/index.js
  28. 9
      src/views/Dashboard/layouts/SidebarMenu/index.scss

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1,7 @@
<svg id="bag-2" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path id="Vector" d="M0,5.662v-.97A4.773,4.773,0,0,1,4.06.022,4.5,4.5,0,0,1,9,4.5v1.38" transform="translate(7.5 2.008)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
<path id="Vector-2" data-name="Vector" d="M5.751,14h6c4.02,0,4.74-1.61,4.95-3.57l.75-6c.27-2.44-.43-4.43-4.7-4.43h-8C.481,0-.219,1.99.051,4.43l.75,6C1.011,12.39,1.731,14,5.751,14Z" transform="translate(3.249 8)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
<path id="Vector-3" data-name="Vector" d="M.495.5H.5" transform="translate(15.001 11.5)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
<path id="Vector-4" data-name="Vector" d="M.495.5H.5" transform="translate(8 11.5)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
<path id="Vector-5" data-name="Vector" d="M0,0H24V24H0Z" fill="none" opacity="0"/>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -0,0 +1,7 @@
<svg id="book" xmlns="http://www.w3.org/2000/svg" width="24" height="23.746" viewBox="0 0 24 23.746">
<path id="Vector" d="M20,13.886V1.98A1.959,1.959,0,0,0,17.83.017h-.06A19.029,19.029,0,0,0,10.7,2.355l-.17.109a1.121,1.121,0,0,1-1.06,0l-.25-.148A18.935,18.935,0,0,0,2.16.007,1.957,1.957,0,0,0,0,1.97V13.886a2.036,2.036,0,0,0,1.74,1.953l.29.039a25.941,25.941,0,0,1,7.44,2.407l.04.02a1.094,1.094,0,0,0,.96,0,25.705,25.705,0,0,1,7.46-2.427l.33-.039A2.036,2.036,0,0,0,20,13.886Z" transform="translate(2 2.662)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
<path id="Vector-2" data-name="Vector" d="M0,0V15" transform="translate(12 5.236)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
<path id="Vector-3" data-name="Vector" d="M2.25,0H0" transform="translate(17.705 8.4)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
<path id="Vector-4" data-name="Vector" d="M3,0H0" transform="translate(16.918 11.369)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
<path id="Vector-5" data-name="Vector" d="M0,0H24V23.746H0Z" transform="translate(24 23.746) rotate(180)" fill="none" opacity="0"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 925 B

After

Width:  |  Height:  |  Size: 925 B

@ -0,0 +1,6 @@
<svg id="archive-add" xmlns="http://www.w3.org/2000/svg" width="25.5" height="25.5" viewBox="0 0 25.5 25.5">
<path id="Vector" d="M5.313,0H0" transform="translate(10.094 11.316)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
<path id="Vector-2" data-name="Vector" d="M0,0V5.313" transform="translate(12.75 8.723)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
<path id="Vector-3" data-name="Vector" d="M14.344,0H4.1A4.111,4.111,0,0,0,0,4.1V19.072c0,1.912,1.371,2.72,3.049,1.8l5.185-2.879a2.251,2.251,0,0,1,1.987,0l5.185,2.879c1.679.935,3.049.128,3.049-1.8V4.1A4.127,4.127,0,0,0,14.344,0Z" transform="translate(3.528 2.125)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
<path id="Vector-4" data-name="Vector" d="M0,0H25.5V25.5H0Z" fill="none" opacity="0"/>
</svg>

After

Width:  |  Height:  |  Size: 916 B

Before

Width:  |  Height:  |  Size: 606 B

After

Width:  |  Height:  |  Size: 606 B

@ -0,0 +1,6 @@
<svg id="vuesax_linear_arrow-down" data-name="vuesax/linear/arrow-down" xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24">
<g id="arrow-down">
<path id="Vector" d="M15.84,0,9.32,6.52a1.986,1.986,0,0,1-2.8,0L0,0" transform="translate(4.08 8.95)" fill="none" stroke="rgb(19, 123, 79)" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
<path id="Vector-2" data-name="Vector" d="M0,0H24V24H0Z" transform="translate(24 24) rotate(180)" fill="none" opacity="0"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 525 B

Before

Width:  |  Height:  |  Size: 970 B

After

Width:  |  Height:  |  Size: 970 B

Before

Width:  |  Height:  |  Size: 773 B

After

Width:  |  Height:  |  Size: 773 B

@ -0,0 +1,5 @@
<svg id="sms" xmlns="http://www.w3.org/2000/svg" width="21.904" height="21.904" viewBox="0 0 21.904 21.904">
<path id="Vector" d="M13.69,15.516H4.563C1.825,15.516,0,14.147,0,10.952V4.563C0,1.369,1.825,0,4.563,0H13.69c2.738,0,4.563,1.369,4.563,4.563v6.389C18.254,14.147,16.428,15.516,13.69,15.516Z" transform="translate(1.825 3.194)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.3"/>
<path id="Vector-2" data-name="Vector" d="M9.127,0,6.27,2.282a2.889,2.889,0,0,1-3.423,0L0,0" transform="translate(6.389 8.214)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.3"/>
<path id="Vector-3" data-name="Vector" d="M0,0H21.9V21.9H0Z" fill="none" opacity="0"/>
</svg>

After

Width:  |  Height:  |  Size: 749 B

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -0,0 +1,10 @@
<svg id="arrow-square" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<g id="Group" transform="translate(5.34 6.75)">
<path id="Vector" d="M0,6.53V4.57A4.569,4.569,0,0,1,4.57,0H6.53" transform="translate(6.8 1.79)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
<path id="Vector-2" data-name="Vector" d="M0,0H1.96A4.569,4.569,0,0,1,6.53,4.57V8.7" transform="translate(0.28 1.8)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
<path id="Vector-3" data-name="Vector" d="M1.8,0,0,1.8,1.8,3.6" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
<path id="Vector-4" data-name="Vector" d="M0,0,1.8,1.8,0,3.6" transform="translate(11.52)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
</g>
<path id="Vector-5" data-name="Vector" d="M7,20h6c5,0,7-2,7-7V7c0-5-2-7-7-7H7C2,0,0,2,0,7v6C0,18,2,20,7,20Z" transform="translate(2 2)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
<path id="Vector-6" data-name="Vector" d="M0,0H24V24H0Z" fill="none" opacity="0"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -0,0 +1,9 @@
<svg id="user-edit" xmlns="http://www.w3.org/2000/svg" width="20.478" height="20.478" viewBox="0 0 20.478 20.478">
<path id="Vector" d="M8.533,4.266A4.266,4.266,0,1,1,4.266,0,4.266,4.266,0,0,1,8.533,4.266Z" transform="translate(5.973 1.707)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.3"/>
<g id="Group" transform="translate(12.945 12.941)">
<path id="Vector-2" data-name="Vector" d="M3.446.489.426,3.509a1.051,1.051,0,0,0-.256.5L.008,5.165a.542.542,0,0,0,.648.648l1.152-.162a1.015,1.015,0,0,0,.5-.256L5.332,2.375a1.165,1.165,0,0,0,0-1.894A1.161,1.161,0,0,0,3.446.489Z" transform="translate(0 0)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.3"/>
<path id="Vector-3" data-name="Vector" d="M0,0A2.718,2.718,0,0,0,1.894,1.894" transform="translate(3.011 0.924)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.3"/>
</g>
<path id="Vector-4" data-name="Vector" d="M0,5.973C0,2.671,3.285,0,7.329,0A8.79,8.79,0,0,1,9.864.367" transform="translate(2.91 12.799)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.3"/>
<path id="Vector-5" data-name="Vector" d="M0,0H20.478V20.478H0Z" fill="none" opacity="0"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 961 B

After

Width:  |  Height:  |  Size: 961 B

@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24.613" height="21.519" viewBox="0 0 24.613 21.519">
<g id="Group_2005" data-name="Group 2005" transform="translate(0.75 0.75)">
<g id="vuesax_linear_music-playlist" data-name="vuesax/linear/music-playlist">
<g id="music-playlist" transform="translate(0)">
<path id="Vector" d="M17.335,20.019H5.778c-3.467,0-5.778-2-5.778-6.673V6.673C0,2,2.311,0,5.778,0H17.335c3.467,0,5.778,2,5.778,6.673v6.673C23.113,18.017,20.8,20.019,17.335,20.019Z" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
</g>
</g>
<path id="Vector-2" data-name="Vector" d="M0,3.572V2.108C0,.23,1.329-.538,2.951.4l1.268.732,1.268.732c1.622.939,1.622,2.476,0,3.415L4.22,6.011l-1.268.732C1.329,7.681,0,6.913,0,5.035V3.572Z" transform="translate(8.204 6.438)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 955 B

@ -130,3 +130,13 @@ iframe {
.Toastify * { .Toastify * {
font-size: 13px; font-size: 13px;
} }
.no-scrollbar::-webkit-scrollbar {
display: none;
}
/* Hide scrollbar for IE, Edge and Firefox */
.no-scrollbar {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}

@ -88,7 +88,7 @@ function Navbar({
<div <div
className="z-50 flex fixed left-0 top-0 w-full" className="z-50 flex fixed left-0 top-0 w-full"
style={{ style={{
backgroundColor: !top ? (isDark ? "#061B30" : "white") : "", backgroundColor: !top ? (isDark ? "#061B30" : "white") : "white",
}} }}
> >
<div className="w-full lg:w-11/12 lg:mx-auto relative flex items-center justify-between py-3 px-4" style={{ <div className="w-full lg:w-11/12 lg:mx-auto relative flex items-center justify-between py-3 px-4" style={{

@ -0,0 +1,5 @@
const dashboard = {
};
export default dashboard;

@ -20,3 +20,4 @@ export {default as form} from "./form";
export {default as dialog} from "./dialog"; export {default as dialog} from "./dialog";
export {default as menu} from "./menu"; export {default as menu} from "./menu";
export {default as config} from "./config"; export {default as config} from "./config";
export {default as dashboard} from "./dashboard";

@ -0,0 +1,76 @@
import { toast } from "react-toastify";
const initialState = {
loading: false,
error: null,
sidebar: {
userInfo: true,
menu: [
{
name: "ticket",
title: "پشتیبانی",
icon: "/assets/icons/packet",
menu: [
{
title: "ثبت نظر",
value: "ticket",
},
],
},
{
name: "profile",
title: "حساب کاربری",
icon: "/assets/icons/userEdit",
menu: [
{
title: "ویرایش حساب کاربری",
value: "profile",
},
],
},
{
name: "myBooks",
title: "کتابهای من",
icon: "/assets/icons/book",
menu: [],
},
{
name: "orders",
title: "سفارشات",
icon: "/assets/icons/bag",
menu: [],
},
{
name: "bookmarks",
title: "علاقهمندیها",
icon: "/assets/icons/bookmark",
menu: [],
},
{
name: "addresses",
title: "آدرسها",
icon: "/assets/icons/route",
menu: [],
},
{
name: "dark",
title: "حالت شب",
icon: "/assets/icons/dark",
menu: [],
},
{
name: "logout",
title: "خروج از حساب کاربری",
icon: "/assets/icons/exit",
menu: [],
},
],
},
};
export default function dashboard(state = initialState, action) {
let { type, data } = action;
switch (type) {
default:
return state;
}
}

@ -20,3 +20,4 @@ export {default as form} from "./form";
export {default as dialog} from "./dialog"; export {default as dialog} from "./dialog";
export {default as menu} from "./menu"; export {default as menu} from "./menu";
export {default as config} from "./config"; export {default as config} from "./config";
export {default as dashboard} from "./dashboard";

@ -87,7 +87,7 @@ export const Ticket = ({
}, []); }, []);
return ( return (
<div className="flex flex-col flex-1"> <div className="flex flex-col flex-1 gap-4">
{!status && ( {!status && (
<> <>
<Input <Input
@ -155,13 +155,11 @@ export const Ticket = ({
onChange={(name, value) => setTicket({ name, value })} onChange={(name, value) => setTicket({ name, value })}
value={ticket?.text || ""} value={ticket?.text || ""}
/> />
<br />
<Upload <Upload
onChange={(name, value) => addFile(name, value)} onChange={(name, value) => addFile(name, value)}
name="file" name="file"
value={ticket?.file} value={ticket?.file}
/> />
<br />
<Button <Button
title={window.t("ارسال پیام")} title={window.t("ارسال پیام")}
backgroundColor={isDark ? "bg-blueC0" : "bg-blueC0"} backgroundColor={isDark ? "bg-blueC0" : "bg-blueC0"}

@ -30,7 +30,10 @@ export const Dashboard = ({ isMobile, headerOptions, setHeaderOptions }) => {
</div> </div>
) : ( ) : (
<div className="w-full"> <div className="w-full">
<div className="gap-5 w-full h-screen pt-20 mx-auto flex bg-transparent justify-end"> <div
className="w-full h-screen mx-auto flex bg-transparent justify-end"
style={{ paddingTop: 71 }}
>
<Sidebar page={page} setPage={setPage} /> <Sidebar page={page} setPage={setPage} />
<Main page={page} /> <Main page={page} />
</div> </div>

@ -15,21 +15,23 @@ const views = {
orders: <Orders />, orders: <Orders />,
mybooks: <MyBooks />, mybooks: <MyBooks />,
userItems: <UserItems />, userItems: <UserItems />,
setTicket: ( ticket: (
<div className="w-1/2"> <div className="flex-1 flex flex-col justify-center items-center">
<Ticket /> <div className="lg:w-1/2 flex justify-center items-center">
<Ticket />
</div>
</div> </div>
), ),
favorites: <Favorites />, favorites: <Favorites />,
addresses: <Addresses />, addresses: <Addresses />,
profile: <Profile />, profile: <Profile />,
addressForm: <Address />,
}; };
export const Main = ({ setHeaderOptions, page }) => { export const Main = ({ page }) => {
return ( return (
<div <div
className="overflow-y-scroll overflow-x-hidden flex-1 flex-shrink-0 no-scrollbar pl-5 pb-10 pt-4" className="overflow-y-scroll overflow-x-hidden border-t-2 border-b-2 border-solid border-gray-300 flex flex-1 flex-shrink-0 no-scrollbar"
style={{ height: "calc(100vh - 80px)" }}
> >
{views[page]} {views[page]}
</div> </div>

@ -2,195 +2,137 @@ import React, { useState, useEffect } from "react";
import Avatar from "../../../../components/Avatar"; import Avatar from "../../../../components/Avatar";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { publicApi, user, dialog } from "../../../../redux/actions"; import { user, dialog } from "../../../../redux/actions";
import "./index.scss";
//assets
import logoutIcon from "./logout.svg";
import moon from "./moon.svg";
import sms from "./sms.svg";
import userEdit from "./user-edit.svg";
import dropdownIcon from "../../../../assets/icons/dropdown-blue.svg";
import myVideosIcon from "./myVideos.svg";
import myBooksIcon from "./myBooks.svg";
import ordersIcon from "./orders.svg";
import favoritesIcon from "./favorites.svg";
import addressIcon from "./address.svg";
const SidebarMenu = ({ const SidebarMenu = ({
profile,
support,
user,
dashboardOptions,
setDashboardOptions,
page, page,
setPage, setPage,
logout, logout,
setDialog, setDialog,
isLogin, user,
sidebar,
}) => { }) => {
const navigate = useNavigate(); const navigate = useNavigate();
const [toggleList, setToggleList] = useState({ const [activeDropdown, setActiveDropdown] = useState(null);
profile: false,
support: false,
});
const Dropdown = ({ list, title, name, active, icon }) => { const actions = React.useMemo(() => {
return {
page: (val) => setPage(val),
logout: () =>
setDialog({
text: window.t("میخوای تنهامون بذاری؟"),
type: "confirm",
accept: () => logout(),
open: true,
}),
};
}, [user]);
const Dropdown = React.useCallback(({item}) => {
return ( return (
<div className="flex flex-col"> <div className="flex flex-col">
<div <div
className="flex justify-between items-center py-2 my-2 cursor-pointer group hover:bg-blueC0 hover:bg-opacity-10 rounded-md px-1" className={`flex justify-between items-center py-2 my-2 cursor-pointer group ${
onClick={() => page === item?.name
setToggleList({ ...toggleList, [name]: !toggleList[name] }) ? "bg-green-600"
} : "hover:bg-blueC0 hover:bg-opacity-10"
} rounded-md px-1`}
onClick={() => {
if (item?.menu?.length <= 1) {
if (item?.name === "logout") {
actions['logout']();
return;
}
if (item?.name === "dark") {
return false;
}
actions['page'](item?.name);
} else {
setActiveDropdown(item?.name);
}
}}
> >
<div className="flex items-center"> <div className="flex items-center">
<img src={icon} alt="" className="ml-2 w-6 mb-1" /> <img
<strong className="font-semibold text-tiny text-green7B"> src={item?.icon + (item?.name === page ? "-white.svg" : "-primary.svg")}
{title} alt=""
className="ml-2 w-6 mb-1"
/>
<strong
className={`font-semibold text-tiny ${
item?.name === page ? "text-white" : "text-green7B"
}`}
>
{item?.title}
</strong> </strong>
</div> </div>
<img {item?.menu?.length > 1 ? (
src={dropdownIcon} <img
alt="" src={"/assets/icons/dropdown-primary.svg"}
className={`w-4 transform transition-all ${ alt=""
toggleList[name] ? "rotate-180" : "" className={`w-4 transform transition-all ${
}`} activeDropdown === item?.name ? "rotate-180" : ""
/> }`}
/>
) : null}
</div> </div>
<ul {item?.menu?.length > 1 ? (
className={`list-none p-0 mb-0 mt-0 mx-0 flex overflow-x-hidden flex-col transition-all`} <ul
style={{ className={`list-none p-0 mb-0 mt-0 mx-0 flex overflow-hidden flex-col transition-all ${
maxHeight: !toggleList[name] ? 0 : "calc(100vh)", item?.name === activeDropdown ? "max-h-screen" : "max-h-0"
overflowY: !toggleList[name] ? "hidden" : "", }`}
}} >
> {item?.menu.map((menuItem, index) => (
{list.map((item, index) => ( <li
<li key={index}
key={index} className={`flex items-center cursor-pointer rounded-md hover:bg-gray-100`}
className={`flex items-center cursor-pointer rounded-md hover:bg-gray-100`} onClick={() =>
onClick={() => (page !== item.value ? setPage(item.value) : {})} page !== menuItem.value ? setPage(menuItem.value) : {}
> }
<span
className={`text-tiny font-medium py-2 my-1 px-4 rounded-full ${
page === item.value
? "text-white bg-green-600"
: "text-gray70"
}`}
> >
{item.title} <span
</span> className={`text-tiny font-medium py-2 my-1 px-4 rounded-full ${
</li> page === menuItem?.value
))} ? "text-white bg-green-600"
</ul> : "text-gray70"
}`}
>
{menuItem?.title}
</span>
</li>
))}
</ul>
) : null}
</div> </div>
); );
}; },[page, activeDropdown]);
const buttons = [
{
icon: myBooksIcon,
title: window.t("کتاب های من"),
onClick: () => setPage("mybooks"),
name: "mybooks",
},
{
icon: myVideosIcon,
title: window.t("ویدئوهای من"),
onClick: () => setPage("myvideos"),
name: "myvideos",
},
{
icon: ordersIcon,
title: window.t("سفارشات"),
onClick: () => setPage("orders"),
name: "orders",
},
{
icon: favoritesIcon,
title: window.t("علاقمندی ها"),
onClick: () => setPage("favorites"),
name: "favorites",
},
{
icon: addressIcon,
title: window.t("آدرس ها"),
onClick: () => setPage("addresses"),
name: "addresses",
},
{ icon: moon, title: window.t("حالت شب"), onClick: () => {}, name: "dark" },
{
icon: logoutIcon,
title: window.t("خروج از حساب کاربری"),
// onClick: () => logout(),
onClick: () =>
setDialog({
text: window.t("میخوای تنهامون بذاری؟"),
type: "confirm",
accept: () => logout(),
open: true,
}),
name: "logout",
},
];
useEffect(() => { useEffect(() => {
if (!isLogin) { if (!user) {
navigate("/"); navigate("/");
} }
}, [isLogin]); }, [user]);
return ( return (
<div <div
className="bg-gray-50 py-5 border-l-2 pl-4 pr-2 shadow-sm border-gray-300 border-solid overflow-y-scroll no-scrollbar divide-y divide-solid divide-gray-200" className="bg-gray-50 py-5 border-l-2 border-t-2 border-b-2 pl-4 pr-2 shadow-sm border-gray-300 border-solid overflow-y-scroll no-scrollbar divide-y divide-solid divide-gray-200"
style={{ style={{
height: "calc(100vh - 80px)", height: "calc(100vh - 71px)",
minWidth: 300, minWidth: 300,
}} }}
> >
{/* profile */} {sidebar?.userInfo ? (
<div className="flex items-center mb-10"> <div className="flex items-center mb-10">
<Avatar size={60} rounded={true} /> <Avatar size={60} rounded={true} />
<p className="text-green7B font-bold text-base flex-1 mx-2"> <p className="text-green7B font-bold text-base flex-1 mx-2">
{user.firstName === null ? "" : user.firstName + " " + user.lastName} {user.firstName === null
</p> ? ""
</div> : user.firstName + " " + user.lastName}
<Dropdown </p>
list={support.list}
title={support.title}
name={support.name}
icon={support.icon}
active={dashboardOptions.support}
/>
<Dropdown
list={profile.list}
title={profile.title}
name={profile.name}
icon={profile.icon}
active={dashboardOptions.profile}
/>
{buttons.map((button, i) => (
<div
className="flex flex-col item-center mb-0"
onClick={() => button.onClick()}
key={i}
>
<div
className={`flex items-center cursor-pointer rounded-md py-0 my-3 px-1`}
>
<img src={button.icon} alt="" />
<strong
className={`${
page === button.name
? "text-white bg-green-600"
: "text-green7B hover:bg-blueC0 hover:bg-opacity-10"
} text-tiny mx-2 p-2 rounded-full`}
>
{button.title}
</strong>
</div>
</div> </div>
) : null}
{sidebar?.menu?.map((item, index) => (
<Dropdown item={item} key={index} />
))} ))}
</div> </div>
); );
@ -198,32 +140,12 @@ const SidebarMenu = ({
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
user: state.user.status, user: state.user.status,
dashboardOptions: state.publicApi.dashboardOptions, sidebar: state.dashboard.sidebar,
isLogin: state.user.status,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {
setDashboardOptions: publicApi.setDashboardOptions,
logout: user.logout, logout: user.logout,
setDialog: dialog.set, setDialog: dialog.set,
}; };
export default connect(mapStateToProps, mapDispatchToProps)(SidebarMenu); export default connect(mapStateToProps, mapDispatchToProps)(SidebarMenu);
SidebarMenu.defaultProps = {
profile: {
name: "profile",
icon: userEdit,
title: window.t("حساب کاربری"),
notification: null,
list: [{ title: window.t("ویرایش حساب کاربری"), value: "profile" }],
},
support: {
name: "support",
icon: sms,
title: window.t("پشتیبانی"),
notification: null,
list: [{ title: window.t("ثبت نظر"), value: window.t("setTicket") }],
},
};

@ -1,9 +0,0 @@
.no-scrollbar::-webkit-scrollbar {
display: none;
}
/* Hide scrollbar for IE, Edge and Firefox */
.no-scrollbar {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
Loading…
Cancel
Save