diff --git a/src/components/Navbar/index.js b/src/components/Navbar/index.js index 5a1dd0d..7df02fc 100644 --- a/src/components/Navbar/index.js +++ b/src/components/Navbar/index.js @@ -196,7 +196,7 @@ function Navbar({ ) : (
@@ -259,13 +259,20 @@ function Navbar({ {/* */}
)} - {!isLogin && ( + {!isLogin ? ( ورود یا ثبت نام + ) : ( + + حساب کاربری + )}
@@ -304,10 +311,6 @@ Navbar.defaultProps = { link: "/about-us", name: "درباره ما", }, - { - link: "/orders", - name: "پیگیری", - }, { link: "/blogs", name: "وبلاگ", diff --git a/src/redux/actions/public.js b/src/redux/actions/public.js index 443b75a..f6f6b62 100644 --- a/src/redux/actions/public.js +++ b/src/redux/actions/public.js @@ -54,8 +54,10 @@ const publicApi = { await dispatch({ type: "active/category", data }), setVideoActive: (data) => async (dispatch) => await dispatch({ type: "active/video", data }), - getArList: (data, history) => async (dispatch) => - await proxy.get("public/ar", data, { history, dispatch }), + getArList: (data) => async (dispatch) => + await proxy.get("public/ar", data, { dispatch }), + setDashboardOptions: (data) => async (dispatch) => + await dispatch({ type: "public/dashboard", data }), }; export default publicApi; diff --git a/src/redux/reducers/public.js b/src/redux/reducers/public.js index ba9a8ba..f899492 100644 --- a/src/redux/reducers/public.js +++ b/src/redux/reducers/public.js @@ -63,7 +63,11 @@ const initialState = { desktopContentTransform: false, overLayer: false, provinces: [], - cities : [] + cities : [], + dashboardOptions : { + profile : null, + support : null, + } }; const grades = [ @@ -85,6 +89,8 @@ const grades = [ export default function publicApi(state = initialState, action) { let { type, data } = action; switch (type) { + case "public/dashboard": + return {...state,error : null, loading :false, dashboardOptions : data } case "public/setOverLayer": return { ...state, overLayer: data }; case "public/setDesktopContentTransform": @@ -117,7 +123,6 @@ export default function publicApi(state = initialState, action) { error: null, selectedVideo: data.vods?.filter((item) => item.id !== videoId)[0], }; - case "public/vod/bookCourse": let allCats; allCats = Array.from( diff --git a/src/router.js b/src/router.js index 9d41026..3d1f490 100644 --- a/src/router.js +++ b/src/router.js @@ -371,7 +371,7 @@ function Router({ } /> - {headerOptions?.shown && !isMobile && } + {/* {headerOptions?.shown && !isMobile && } */} diff --git a/src/views/Auth/SignUp/index.js b/src/views/Auth/SignUp/index.js index ee5bc4d..5c02324 100644 --- a/src/views/Auth/SignUp/index.js +++ b/src/views/Auth/SignUp/index.js @@ -195,7 +195,7 @@ function SignUp({ inputMode="numeric" style={{ direction: "ltr" }} name="otp1" - className="bg-grayF9 rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1" + className="bg-grayF9 outline-none rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1" onChange={(e) => onChange( e.target.name, @@ -209,7 +209,7 @@ function SignUp({ inputMode="numeric" style={{ direction: "ltr" }} name="otp2" - className="bg-grayF9 rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1" + className="bg-grayF9 outline-none rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1" onChange={(e) => onChange( e.target.name, @@ -223,7 +223,7 @@ function SignUp({ inputMode="numeric" style={{ direction: "ltr" }} name="otp3" - className="bg-grayF9 rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1" + className="bg-grayF9 outline-none rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1" onChange={(e) => onChange( e.target.name, @@ -237,7 +237,7 @@ function SignUp({ inputMode="numeric" style={{ direction: "ltr" }} name="otp4" - className="bg-grayF9 rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1" + className="bg-grayF9 outline-none rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1" onChange={(e) => onChange( e.target.name, diff --git a/src/views/Dashboard/index.js b/src/views/Dashboard/index.js index 399b202..5817b02 100644 --- a/src/views/Dashboard/index.js +++ b/src/views/Dashboard/index.js @@ -1,16 +1,18 @@ -import React from "react"; +import React, {useState} from "react"; import { connect } from "react-redux"; import Sidebar from "./layouts/SidebarMenu"; import Main from "./layouts/Main"; export const Dashboard = ({ isMobile }) => { + const [page, setPage] = useState("userItems"); + return isMobile ? (
) : ( -
-
- {/* */} -
+
+
+ +
); diff --git a/src/views/Dashboard/layouts/Main/MyBooks/index.js b/src/views/Dashboard/layouts/Main/MyBooks/index.js new file mode 100644 index 0000000..4585d4f --- /dev/null +++ b/src/views/Dashboard/layouts/Main/MyBooks/index.js @@ -0,0 +1,27 @@ +import React from "react"; +import { connect } from "react-redux"; +import Product from "../../../../../components/Product"; +import ProductSuggestion from "../UserItems/ProductSuggestion"; + +export const MyBooks = ({ books, grades, isMobile }) => { + return ( +
+
+ {books.slice(0,5).map((product, index) => ( + + ))} +
+ +
+ ); +}; + +const mapStateToProps = (state) => ({ + books: state.book.list, + grades: state.publicApi.grades, + isMobile: state.publicApi.isMobile, +}); + +const mapDispatchToProps = {}; + +export default connect(mapStateToProps, mapDispatchToProps)(MyBooks); diff --git a/src/views/Dashboard/layouts/Main/UserItems/ProductSuggestion/index.js b/src/views/Dashboard/layouts/Main/UserItems/ProductSuggestion/index.js index ff9772b..f467e82 100644 --- a/src/views/Dashboard/layouts/Main/UserItems/ProductSuggestion/index.js +++ b/src/views/Dashboard/layouts/Main/UserItems/ProductSuggestion/index.js @@ -2,32 +2,33 @@ import React from "react"; import { Link } from "react-router-dom"; import { Carousel } from "@trendyol-js/react-carousel"; import Product from '../../../../../../components/Product'; -import arrow from "../../../../../../assets/icons/slider-arrow.svg"; +import arrow from "../../../../../../assets/icons/dropdown-blue.svg"; function Suggestion({ products, grades, isMobile }) { return ( -
- +
+ پیشنهادات ما به شما {products.length > 0 && (
} leftArrow={ diff --git a/src/views/Dashboard/layouts/Main/UserItems/index.js b/src/views/Dashboard/layouts/Main/UserItems/index.js index 8984184..f36e01f 100644 --- a/src/views/Dashboard/layouts/Main/UserItems/index.js +++ b/src/views/Dashboard/layouts/Main/UserItems/index.js @@ -13,7 +13,7 @@ export const UserItems = ({list, grades, getList, isMobile}) => { } },[]); return ( -
+

diff --git a/src/views/Dashboard/layouts/Main/index.js b/src/views/Dashboard/layouts/Main/index.js index e32dff1..4215a49 100644 --- a/src/views/Dashboard/layouts/Main/index.js +++ b/src/views/Dashboard/layouts/Main/index.js @@ -1,20 +1,28 @@ import React, { useState, useEffect } from "react"; import { connect } from "react-redux"; -import {publicApi} from '../../../../redux/actions'; +import { publicApi } from "../../../../redux/actions"; import Orders from "../../../Orders"; import UserItems from "../Main/UserItems"; +import MyBooks from './MyBooks'; -export const Main = ({setHeaderOptions}) => { +export const Main = ({ setHeaderOptions, page }) => { useEffect(() => { - setHeaderOptions({shown: true}); - },[]); + setHeaderOptions({ shown: true }); + }, []); const views = { // orders: , - userItems: + mybooks : , + userItems: , }; - const [page, setPage] = useState("userItems"); - return
{views[page]}
; + return ( +
+ {views[page]} +
+ ); }; const mapStateToProps = (state) => ({}); diff --git a/src/views/Dashboard/layouts/SidebarMenu/index.js b/src/views/Dashboard/layouts/SidebarMenu/index.js index 37b52fc..38595e9 100644 --- a/src/views/Dashboard/layouts/SidebarMenu/index.js +++ b/src/views/Dashboard/layouts/SidebarMenu/index.js @@ -1,86 +1,155 @@ -import React from "react"; -import Switch from "../../../../components/Switch"; +import React, { useState } from "react"; +import Avatar from "../../../../components/Avatar"; +import { connect } from "react-redux"; +import { publicApi, user } from "../../../../redux/actions"; import "./index.scss"; //assets -import downwardArrow from "./arrow-down.svg"; import profilePic from "./profile-pic.svg"; -import element from "./element-4.svg"; -import folderOpen from "./folder-open.svg"; -import wallet from "./wallet-money.svg"; import logout from "./logout.svg"; -import messageText from "./message-text.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"; + +const SidebarMenu = ({ + profile, + support, + user, + dashboardOptions, + setDashboardOptions, + page, + setPage, + logout +}) => { + const [toggleList, setToggleList] = useState({ + profile: false, + support: false, + }); + + const Dropdown = ({ list, title, name, active, icon }) => { + return ( +
+
+ setToggleList({ ...toggleList, [name]: !toggleList[name] }) + } + > +
+ + + {title} + +
+ +
+
    + {list.map((item, index) => ( +
  • (page !== item.value ? setPage(item.value) : {})} + > + + {item.title} + +
  • + ))} +
+
+ ); + }; + + const buttons = [ + { + icon: null, + title: "کتاب های من", + onClick: () => setPage("mybooks"), + name: "mybooks", + }, + { + icon: null, + title: "ویدئوهای من", + onClick: () => setPage("myvideos"), + name: "myvideos", + }, + { icon: moon, title: "حالت شب", onClick: () => {}, name: "dark" }, + { + icon: logout, + title: "خروج از حساب کاربری", + onClick: () => logout(), + name: "logout", + }, + ]; -const SidebarMenu = ({ items, buttons }) => { return ( -
+
{/* profile */} -
- -

- کامران کوهستانی شیرازی +

+ +

+ {user.firstName + " " + user.lastName}

-
- {/* divider */} -
-

منوی کاربری

- {/* items */} - {items.map((item, i) => ( -
- {/* menu items */} -
- -

{item.title}

- {item.notification && ( -
- - {item.notification} - -
- )} -
- {/* sub items */} - {item.subItems.map((subItem, i) => ( -
- {subItem.name && ( -

- {subItem.name} -

- )} - {subItem.num && ( -
- {subItem.num} -
- )} -
- ))} -
- ))} - {/* buttons */} + + {buttons.map((button, i) => ( -
- {/* divider */} -
+
button.onClick()} + >
-

{button.title}

- {/*
- {button.leftIcon && } -
*/} + + {button.title} +
))} @@ -88,68 +157,34 @@ const SidebarMenu = ({ items, buttons }) => { ); }; -export default SidebarMenu; +const mapStateToProps = (state) => ({ + user: state.user.status, + dashboardOptions: state.publicApi.dashboardOptions, +}); + +const mapDispatchToProps = { + setDashboardOptions: publicApi.setDashboardOptions, + logout : user.logout +}; + +export default connect(mapStateToProps, mapDispatchToProps)(SidebarMenu); SidebarMenu.defaultProps = { - items: [ - { - icon: element, - title: "داشبورد مدیریت", - notification: null, - subItems: [], - }, - { - icon: folderOpen, - title: "پروژه ها", - notification: null, - subItems: [ - { name: "افزدون پروژه", num: null }, - { name: "مدیریت پروژه ها", num: null }, - { name: "پروژه های حذف شده", num: null }, - ], - }, - { - icon: wallet, - title: "مالی و حسابداری", - notification: null, - subItems: [ - { name: "تمدید سرویس", num: null }, - { name: "بسته های اشتراکی", num: null }, - { name: "فاکتور ها", num: 1 }, - { name: "درخواست تسویه حساب", num: null }, - ], - }, - { - icon: userEdit, - title: "دیدگاه ها", - notification: null, - subItems: [], - }, - { - icon: userEdit, - title: "حساب کاربری", - notification: null, - subItems: [{ name: "ویرایش حساب کاربری", num: null }], - }, - { - icon: sms, - title: "پشتیبانی", - notification: 7, - subItems: [ - { name: "تیکت ها", num: null }, - { name: "ارسال تیکت جدید", num: null }, - { name: "ویکی", num: null }, - ], - }, - { - icon: messageText, - title: "متستندات", - notification: null, - subItems: [{ name: "API توسعه دهندگان", num: null }], - }, - ], - buttons: [ - { icon: moon, title: "حالت شب", leftIcon: moon }, - { icon: logout, title: "خروج از حساب کاربری", leftIcon: null }, - ], + profile: { + name: "profile", + icon: userEdit, + title: "حساب کاربری", + notification: null, + list: [{ title: "ویرایش حساب کاربری", value: "edit" }], + }, + support: { + name: "support", + icon: sms, + title: "پشتیبانی", + notification: null, + list: [ + { title: "تیکت ها", value: "tickets" }, + { title: "ارسال تیکت جدید", value: "send" }, + ], + }, }; diff --git a/src/views/Dashboard/layouts/SidebarMenu/logout.svg b/src/views/Dashboard/layouts/SidebarMenu/logout.svg index 94c72a1..1dd174b 100644 --- a/src/views/Dashboard/layouts/SidebarMenu/logout.svg +++ b/src/views/Dashboard/layouts/SidebarMenu/logout.svg @@ -1,6 +1,6 @@ - - - + + + diff --git a/src/views/Dashboard/layouts/SidebarMenu/moon.svg b/src/views/Dashboard/layouts/SidebarMenu/moon.svg index ca740b6..b02d19f 100644 --- a/src/views/Dashboard/layouts/SidebarMenu/moon.svg +++ b/src/views/Dashboard/layouts/SidebarMenu/moon.svg @@ -1,4 +1,4 @@ - + diff --git a/src/views/Dashboard/layouts/SidebarMenu/sms.svg b/src/views/Dashboard/layouts/SidebarMenu/sms.svg index 642cf99..5fbdf35 100644 --- a/src/views/Dashboard/layouts/SidebarMenu/sms.svg +++ b/src/views/Dashboard/layouts/SidebarMenu/sms.svg @@ -1,5 +1,5 @@ - - + + diff --git a/src/views/Dashboard/layouts/SidebarMenu/user-edit.svg b/src/views/Dashboard/layouts/SidebarMenu/user-edit.svg index 60a9d85..1be22ad 100644 --- a/src/views/Dashboard/layouts/SidebarMenu/user-edit.svg +++ b/src/views/Dashboard/layouts/SidebarMenu/user-edit.svg @@ -1,9 +1,9 @@ - + - - + + - + diff --git a/src/views/Dashboard/layouts/SidebarMenu/wallet-money.svg b/src/views/Dashboard/layouts/SidebarMenu/wallet-money.svg index 68de02d..86fba00 100644 --- a/src/views/Dashboard/layouts/SidebarMenu/wallet-money.svg +++ b/src/views/Dashboard/layouts/SidebarMenu/wallet-money.svg @@ -1,8 +1,8 @@ - - - - - + + + + + diff --git a/src/views/Home/Portrait/Private/MyBooks/index.js b/src/views/Home/Portrait/Private/MyBooks/index.js index 0995229..1e7f0df 100644 --- a/src/views/Home/Portrait/Private/MyBooks/index.js +++ b/src/views/Home/Portrait/Private/MyBooks/index.js @@ -7,7 +7,7 @@ import Progress from "../../../../../components/Progress"; function MyBooks({ books, getList, grades, isMobile }) { const Book = ({ book }) => { return ( -
  • +
  • {book.name} -

    {`پایه ${ +

    {`پایه ${ grades[book.gradeId] }`}

    @@ -33,9 +33,9 @@ function MyBooks({ books, getList, grades, isMobile }) { }; return ( -
    -
    - +
    +
    + کتابهای من {isMobile ? ( diff --git a/src/views/Home/Portrait/Private/Videos/index.js b/src/views/Home/Portrait/Private/Videos/index.js index 87f67f3..838a623 100644 --- a/src/views/Home/Portrait/Private/Videos/index.js +++ b/src/views/Home/Portrait/Private/Videos/index.js @@ -9,7 +9,7 @@ import arrowWhiteIcon from "../../../../../assets/icons/arrow-left-white.svg"; function Videos({ videos, grades, isDark, isMobile }) { const Video = ({ video }) => { return ( -
  • +
  • - {'دوره ویدئویی' + ' ' + video.name} + {"دوره ویدئویی" + " " + video.name}

    {/*

    {`پایه ${ grades[video.gradeId] @@ -34,10 +34,10 @@ function Videos({ videos, grades, isDark, isMobile }) { ); }; return ( -

    -
    +
    +
    - + دوره‌های ویدئویی شما ) : ( - + {videos?.map((video, index) => (