From 3e9b2772efd3854ac01a05e9ae31af308a377e3e Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Sat, 29 Jan 2022 21:48:06 +0330 Subject: [PATCH] reza fixed some item --- .../BottomNavigation}/bottom-home-active.svg | 0 .../BottomNavigation/bottom-home-deactive.svg | 5 + .../bottom-products-active.svg | 14 + .../bottom-products-deactive.svg | 0 .../bottom-profile-active.svg | 7 + .../bottom-profile-deactive.svg | 0 .../BottomNavigation/bottom-test-active.svg | 10 + .../bottom-test-deactive.svg | 0 .../BottomNavigation/bottom-video-active.svg | 10 + .../bottom-video-deactive.svg | 0 src/components/BottomNavigation/index.js | 28 +- src/components/Input/index.js | 2 +- src/components/Navbar/cart-blue.svg | 9 + src/components/Navbar/index.js | 77 +++-- src/components/QandA/index.js | 278 +++++++++--------- src/redux/actions/public.js | 6 +- src/redux/reducers/public.js | 28 +- src/redux/reducers/user.js | 3 +- src/router.js | 21 +- src/views/AR/index.js | 31 ++ src/views/AR/layouts/Book.js | 25 ++ src/views/Activation/index.js | 1 + src/views/Auth/SignUp/index.js | 4 +- src/views/DeliveryForm/Address/index.js | 12 +- src/views/DeliveryForm/PaymentMethod/index.js | 4 +- src/views/DeliveryForm/TransportDate/index.js | 4 +- .../DeliveryForm/TransportMethod/index.js | 4 +- src/views/Faq/components/NotFound.js | 6 +- .../Home/Portrait/Private/MyBooks/index.js | 6 +- .../Home/Portrait/Private/Videos/index.js | 6 +- .../Home/Portrait/Public/Features/index.js | 4 +- .../Home/Portrait/Public/Header/index.js | 2 +- .../Home/Portrait/Public/Platforms/index.js | 2 +- .../Home/Portrait/Public/Responsive/index.js | 4 +- .../Product/Desktop/ProductOverAll/index.js | 1 + src/views/Product/index.js | 2 + src/views/QR/Scan/index.js | 2 +- src/views/ShoppingCart/Code/index.js | 4 +- src/views/ShoppingCart/Product/index.js | 6 +- src/views/ShoppingCart/index.js | 6 +- src/views/Video/components/Desktop/Table.js | 47 +++ src/views/Video/components/Season.js | 98 ++++-- src/views/Video/index.js | 23 +- src/views/VideoDisplay/components/Season.js | 18 +- .../Videos/components/MostViewedVideo.js | 16 +- src/views/Videos/components/NewestVideo.js | 8 +- 46 files changed, 567 insertions(+), 277 deletions(-) rename src/{assets/icons => components/BottomNavigation}/bottom-home-active.svg (100%) create mode 100644 src/components/BottomNavigation/bottom-home-deactive.svg create mode 100644 src/components/BottomNavigation/bottom-products-active.svg rename src/{assets/icons => components/BottomNavigation}/bottom-products-deactive.svg (100%) create mode 100644 src/components/BottomNavigation/bottom-profile-active.svg rename src/{assets/icons => components/BottomNavigation}/bottom-profile-deactive.svg (100%) create mode 100644 src/components/BottomNavigation/bottom-test-active.svg rename src/{assets/icons => components/BottomNavigation}/bottom-test-deactive.svg (100%) create mode 100644 src/components/BottomNavigation/bottom-video-active.svg rename src/{assets/icons => components/BottomNavigation}/bottom-video-deactive.svg (100%) create mode 100644 src/components/Navbar/cart-blue.svg create mode 100644 src/views/AR/index.js create mode 100644 src/views/AR/layouts/Book.js create mode 100644 src/views/Video/components/Desktop/Table.js diff --git a/src/assets/icons/bottom-home-active.svg b/src/components/BottomNavigation/bottom-home-active.svg similarity index 100% rename from src/assets/icons/bottom-home-active.svg rename to src/components/BottomNavigation/bottom-home-active.svg diff --git a/src/components/BottomNavigation/bottom-home-deactive.svg b/src/components/BottomNavigation/bottom-home-deactive.svg new file mode 100644 index 0000000..187e72a --- /dev/null +++ b/src/components/BottomNavigation/bottom-home-deactive.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/components/BottomNavigation/bottom-products-active.svg b/src/components/BottomNavigation/bottom-products-active.svg new file mode 100644 index 0000000..9a4c65e --- /dev/null +++ b/src/components/BottomNavigation/bottom-products-active.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/assets/icons/bottom-products-deactive.svg b/src/components/BottomNavigation/bottom-products-deactive.svg similarity index 100% rename from src/assets/icons/bottom-products-deactive.svg rename to src/components/BottomNavigation/bottom-products-deactive.svg diff --git a/src/components/BottomNavigation/bottom-profile-active.svg b/src/components/BottomNavigation/bottom-profile-active.svg new file mode 100644 index 0000000..19f103b --- /dev/null +++ b/src/components/BottomNavigation/bottom-profile-active.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/assets/icons/bottom-profile-deactive.svg b/src/components/BottomNavigation/bottom-profile-deactive.svg similarity index 100% rename from src/assets/icons/bottom-profile-deactive.svg rename to src/components/BottomNavigation/bottom-profile-deactive.svg diff --git a/src/components/BottomNavigation/bottom-test-active.svg b/src/components/BottomNavigation/bottom-test-active.svg new file mode 100644 index 0000000..25845a2 --- /dev/null +++ b/src/components/BottomNavigation/bottom-test-active.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/assets/icons/bottom-test-deactive.svg b/src/components/BottomNavigation/bottom-test-deactive.svg similarity index 100% rename from src/assets/icons/bottom-test-deactive.svg rename to src/components/BottomNavigation/bottom-test-deactive.svg diff --git a/src/components/BottomNavigation/bottom-video-active.svg b/src/components/BottomNavigation/bottom-video-active.svg new file mode 100644 index 0000000..6a4b5fd --- /dev/null +++ b/src/components/BottomNavigation/bottom-video-active.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/assets/icons/bottom-video-deactive.svg b/src/components/BottomNavigation/bottom-video-deactive.svg similarity index 100% rename from src/assets/icons/bottom-video-deactive.svg rename to src/components/BottomNavigation/bottom-video-deactive.svg diff --git a/src/components/BottomNavigation/index.js b/src/components/BottomNavigation/index.js index 93450c1..0048631 100644 --- a/src/components/BottomNavigation/index.js +++ b/src/components/BottomNavigation/index.js @@ -1,11 +1,19 @@ import React, { useState } from "react"; import { NavLink } from "react-router-dom"; import { connect } from "react-redux"; -import activeHomeIcon from "../../assets/icons/bottom-home-active.svg"; -import deactiveProductsIcon from "../../assets/icons/bottom-products-deactive.svg"; -import deactiveVideoIcon from "../../assets/icons/bottom-video-deactive.svg"; -import deactiveProfileIcon from "../../assets/icons/bottom-profile-deactive.svg"; -import deactiveTestIcon from "../../assets/icons/bottom-test-deactive.svg"; + +//assets +import deactiveHomeIcon from "./bottom-home-deactive.svg"; +import deactiveProductsIcon from "./bottom-products-deactive.svg"; +import deactiveVideoIcon from "./bottom-video-deactive.svg"; +import deactiveProfileIcon from "./bottom-profile-deactive.svg"; +import deactiveTestIcon from "./bottom-test-deactive.svg"; +import activeHomeIcon from "./bottom-home-active.svg"; +import activeTestIcon from "./bottom-test-active.svg"; +import activeProfileIcon from "./bottom-profile-active.svg"; +import activeProductsIcon from "./bottom-products-active.svg"; +import activeVideoIcon from "./bottom-video-active.svg" + export const BottomNavigation = ({ pages, isDark }) => { const [activeLink, setActiveLink] = useState("/"); @@ -57,34 +65,34 @@ BottomNavigation.defaultProps = { name: "صفحه اصلی", link: "/", activeIcon: activeHomeIcon, - deactiveIcon: "", + deactiveIcon: deactiveHomeIcon, }, { id: 1, name: "محصولات", link: "/products", - activeIcon: "", + activeIcon: activeProductsIcon, deactiveIcon: deactiveProductsIcon, }, { id: 2, name: "ویدئو", link: "/videos", - activeIcon: "", + activeIcon: activeVideoIcon, deactiveIcon: deactiveVideoIcon, }, { id: 3, name: "آزمون", link: "/test", - activeIcon: "", + activeIcon: activeTestIcon, deactiveIcon: deactiveTestIcon, }, { id: 4, name: "حساب کاربری", link: "/profile", - activeIcon: "", + activeIcon: activeProfileIcon, deactiveIcon: deactiveProfileIcon, }, ], diff --git a/src/components/Input/index.js b/src/components/Input/index.js index 5b11969..7c3e46e 100644 --- a/src/components/Input/index.js +++ b/src/components/Input/index.js @@ -79,7 +79,7 @@ export default function Input(props) { placeholder={label} className={_.join( [ - `flex-1 border border-gray-300 dark:bg-opacity-10 bg-transparent rounded-md outline-none py-3 px-4 text-sm ${backgroundColor} ${align}`, + `flex-1 border border-gray-300 dark:bg-opacity-10 bg-transparent rounded-md outline-none py-3 px-4 text-tiny ${backgroundColor} ${align}`, inputStatusHandler( value, focusToggle, diff --git a/src/components/Navbar/cart-blue.svg b/src/components/Navbar/cart-blue.svg new file mode 100644 index 0000000..c33a0b3 --- /dev/null +++ b/src/components/Navbar/cart-blue.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/components/Navbar/index.js b/src/components/Navbar/index.js index 2f138ff..71a1879 100644 --- a/src/components/Navbar/index.js +++ b/src/components/Navbar/index.js @@ -5,16 +5,16 @@ import _ from "lodash"; import Drawer from "../Drawer"; import Search from "../Search"; //assets -import cartIcon from "./dark-crimson-cart-icon.svg"; -import whiteCartIcon from "./white-cart-icon.svg"; -import profileIcon from "./dark-crimson-profile-icon.svg"; -import searchIcon from "./dark-crimson-search-box.svg"; -import lightGraySearchIcon from "./light-gray-search-box.svg"; +import cartIcon from "./cart-blue.svg"; +// import whiteCartIcon from "./white-cart-icon.svg"; +// import profileIcon from "./dark-crimson-profile-icon.svg"; +// import searchIcon from "./dark-crimson-search-box.svg"; +// import lightGraySearchIcon from "./light-gray-search-box.svg"; import darkCrimsonHamburgerMenu from "./dark-crimson-hamburger-menu.svg"; -import whiteHamburgerMenu from "./white-hamburger-menu-icon.svg"; +// import whiteHamburgerMenu from "./white-hamburger-menu-icon.svg"; -import grayBagIcon from "../../assets/icons/gray-bag.svg"; -import graySearchIcon from "../../assets/icons/gray-search.svg"; +// import grayBagIcon from "../../assets/icons/gray-bag.svg"; +// import graySearchIcon from "../../assets/icons/gray-search.svg"; import logoIcon from "../../assets/icons/logo.svg"; import qrIcon from "../../assets/icons/qr-white.svg"; import qrBlueIcon from "../../assets/icons/qr-blue.svg"; @@ -33,6 +33,7 @@ function Navbar({ pages, isDark, isMobile, + isLogin, headerOptions, loginBtn, menuItems, @@ -140,7 +141,7 @@ function Navbar({ {qr && ( <>
-
- +
+ {/* انتخاب کشور - - پیگیری سفارش + */} + + پیگیری سفارش +
-
- +
+ {!isLogin && ( + + ورود و ثبت نام + + )} + شکایات  - - - ورود و ثبت نام - +
-
+
- - Design System - + + + + DANOVIN + +
-
- +
+ + + {/* */} {/* */} - + {/* */}
@@ -260,9 +270,11 @@ function Navbar({ className={`flex items-center relative w-full h-10 px-4 border-b border-solid border-gray-200 transform bg-white ${ desktopEndTransform ? "" : "" }`} - style={{ - // transition: "all 0.3s", - }} + style={ + { + // transition: "all 0.3s", + } + } >
({ isDark: state.publicApi.isDark, isMobile: state.publicApi.isMobile, headerOptions: state.publicApi.headerOptions, + isLogin: state.user.status, }); export default connect(mapStateToProps, {})(Navbar); diff --git a/src/components/QandA/index.js b/src/components/QandA/index.js index 26817dd..95c4cf1 100644 --- a/src/components/QandA/index.js +++ b/src/components/QandA/index.js @@ -1,158 +1,172 @@ -import React, { useState } from 'react'; - +import React, { useState } from "react"; import moment from "jalali-moment"; import StarRating from "../StarRating"; -import Counter from '../Counter'; -import Button from '../Button'; +import Counter from "../Counter"; +import Button from "../Button"; -const QandA = ({comments}) =>{ - const Comment = ({ comment }) => { - const [open, Setopen] = useState(true); - const [viewmore, setViewMore] = useState("مشاهده باسخ های بیشتر"); - const [numberOfAnswers, setNumberOfAnswers] = useState(1); - const [isOpen, setIsOpen] = useState(false) - return ( - <> -
-
-
- -
- {comment.username} - {comment.isCostumer ?

خریدار محصول

: null} -
-
-
- - {moment(comment.data).locale("fa").format("YYYY/MM/DD")} - - - {comment.date.getHours()} : {comment.date.getMinutes()} - +const QandA = ({ comments }) => { + const Comment = ({ comment }) => { + const [open, Setopen] = useState(true); + const [viewmore, setViewMore] = useState("مشاهده باسخ های بیشتر"); + const [numberOfAnswers, setNumberOfAnswers] = useState(1); + const [isOpen, setIsOpen] = useState(false); + return ( + <> +
+
+
+
+ {comment.username} + {comment.isCostumer ? ( +

خریدار محصول

+ ) : null}
-
-
-
-
+
+
+ + {moment(comment.data).locale("fa").format("YYYY/MM/DD")} + + + {comment.date.getHours()} :  + {comment.date.getMinutes()} + +
+
+
+
+
-
-

برسش

+
+
+

برسش

-
-
+
+ +

{comment.text}

-
-
- -
- +
- - {comment.answers.length > 0 ? comment.answers.slice(0 , numberOfAnswers).map(e => ( -
-
-
-
-
-

باسخ

+
+ + {comment.answers.length > 0 ? ( + comment.answers.slice(0, numberOfAnswers).map((e) => ( +
+
+
+
+
+
+

باسخ

-
-
+
+
+

{e.text}

- -
-
-
- +
-
- +
- )) :
+
+ )) + ) : ( +
-

ارسال باسخ

+
+

ارسال باسخ

+
-
} - {comment.answers.length > 1 ?
- {open ?
: null} - -
- - - ); - }; - return ( -
- {comments.map((comment, index) => ( - - ))} + + )} + {comment.answers.length > 1 ? ( +
+ {open ? ( +
+ ) : null}
- ); + + ); + }; + return ( +
+ {comments.map((comment, index) => ( + + ))} +
+ ); }; export default QandA; QandA.defaultProps = { - comments: [ - { - id: 0, - pid: null, - username: "آرش سامانی", - isCostumer: true, - date: new Date(), - text: "خالد حسینی تو رمان باد بادک باز مینویسه : ﻣﺮﺩ ﺁﻫﺴﺘﻪ ﺩﺭ ﮔﻮﺵ ﻓﺮﺯﻧﺪ ﺗﺎﺯﻩ ﺑﻪ ﺑﻠﻮﻍ ﺭﺳﯿﺪﻩ ﺍﺵ ﺑﺮﺍﯼ ﭘﻨﺪ ﭼﻨﯿﻦ ﻧﺠﻮﺍ ﮐﺮﺩ : ” ﭘﺴﺮﻡ ﺩﺭ ﺯﻧﺪﮔﯽ ﻫﺮﮔﺰ ﺩﺯﺩﯼ ﻧﮑﻦ ” ﭘﺴﺮ ﻣﺘﻌﺠﺐ ﻭ ﻣﺒﻬﻮﺕ ﺑﻪ ﭘﺪﺭ ﻧﮕﺎﻩ ﮐﺮﺩ ﺑﺪﯾﻦ ﻣﻌﻨﺎ ﮐﻪ ﺍﻭ ﻫﺮﮔﺰ ﺩﺳﺖ ﮐﺞ ﻧﺪﺍﺷﺘﻪ ﭘﺪﺭ ﺑﻪ ﻧﮕﺎﻩ ﻣﺘﻌﺠﺐ ﻓﺮﺯﻧﺪ ﻟﺒﺨﻨﺪﯼ ﺯﺩ ﻭ ﺍﺩﺍﻣﻪ ", - rate: 4, - answers: [ - { - text: 'لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است و برای شرایط فعلی تکنولوژی مورد نیاز و کاربردهای متنوع با هدف بهبود ابزارهای کاربردی می باشد' - }, - { - text: 'لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است و برای شرایط فعلی تکنولوژی مورد نیاز و کاربردهای متنوع با هدف بهبود ابزارهای کاربردی می باشد' - }, - { - text: 'لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است و برای شرایط فعلی تکنولوژی مورد نیاز و کاربردهای متنوع با هدف بهبود ابزارهای کاربردی می باشد کتابهای زیادی در شصت و سه درصد گذشته حال و آینده شناخت فراوان جامعه و متخصصان را می طلبد تا با نرم افزارها شناخت بیشتری را برای طراحان رایانه ای علی الخصوص طراحان خلاقی و فرهنگ پیشرو در زبان فارسی ایجاد کرد در این صورت می توان امید داشت که تمام و دشواری موجود در ارائه راهکارها' - }, - { - text: 'لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است' - }, - - ], - status: true, - }, - { - id: 1, - pid: null, - username: "سورنا عابدی", - isCostumer: false, - date: new Date(), - text: "لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است و برای شرایط فعلی تکنولوژی مورد نیاز و کاربردهای متنوع با هدف بهبود ابزارهای کاربردی می باشد ", - rate: 4, - answers: [ - ], - status: true, - }, - - - ], - }; \ No newline at end of file + comments: [ + { + id: 0, + pid: null, + username: "آرش سامانی", + isCostumer: true, + date: new Date(), + text: "خالد حسینی تو رمان باد بادک باز مینویسه : ﻣﺮﺩ ﺁﻫﺴﺘﻪ ﺩﺭ ﮔﻮﺵ ﻓﺮﺯﻧﺪ ﺗﺎﺯﻩ ﺑﻪ ﺑﻠﻮﻍ ﺭﺳﯿﺪﻩ ﺍﺵ ﺑﺮﺍﯼ ﭘﻨﺪ ﭼﻨﯿﻦ ﻧﺠﻮﺍ ﮐﺮﺩ : ” ﭘﺴﺮﻡ ﺩﺭ ﺯﻧﺪﮔﯽ ﻫﺮﮔﺰ ﺩﺯﺩﯼ ﻧﮑﻦ ” ﭘﺴﺮ ﻣﺘﻌﺠﺐ ﻭ ﻣﺒﻬﻮﺕ ﺑﻪ ﭘﺪﺭ ﻧﮕﺎﻩ ﮐﺮﺩ ﺑﺪﯾﻦ ﻣﻌﻨﺎ ﮐﻪ ﺍﻭ ﻫﺮﮔﺰ ﺩﺳﺖ ﮐﺞ ﻧﺪﺍﺷﺘﻪ ﭘﺪﺭ ﺑﻪ ﻧﮕﺎﻩ ﻣﺘﻌﺠﺐ ﻓﺮﺯﻧﺪ ﻟﺒﺨﻨﺪﯼ ﺯﺩ ﻭ ﺍﺩﺍﻣﻪ ", + rate: 4, + answers: [ + { + text: "لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است و برای شرایط فعلی تکنولوژی مورد نیاز و کاربردهای متنوع با هدف بهبود ابزارهای کاربردی می باشد", + }, + { + text: "لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است و برای شرایط فعلی تکنولوژی مورد نیاز و کاربردهای متنوع با هدف بهبود ابزارهای کاربردی می باشد", + }, + { + text: "لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است و برای شرایط فعلی تکنولوژی مورد نیاز و کاربردهای متنوع با هدف بهبود ابزارهای کاربردی می باشد کتابهای زیادی در شصت و سه درصد گذشته حال و آینده شناخت فراوان جامعه و متخصصان را می طلبد تا با نرم افزارها شناخت بیشتری را برای طراحان رایانه ای علی الخصوص طراحان خلاقی و فرهنگ پیشرو در زبان فارسی ایجاد کرد در این صورت می توان امید داشت که تمام و دشواری موجود در ارائه راهکارها", + }, + { + text: "لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است", + }, + ], + status: true, + }, + { + id: 1, + pid: null, + username: "سورنا عابدی", + isCostumer: false, + date: new Date(), + text: "لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است چاپگرها و متون بلکه روزنامه و مجله در ستون و سطرآنچنان که لازم است و برای شرایط فعلی تکنولوژی مورد نیاز و کاربردهای متنوع با هدف بهبود ابزارهای کاربردی می باشد ", + rate: 4, + answers: [], + status: true, + }, + ], +}; diff --git a/src/redux/actions/public.js b/src/redux/actions/public.js index ff58c26..3755441 100644 --- a/src/redux/actions/public.js +++ b/src/redux/actions/public.js @@ -1,7 +1,7 @@ import proxy from "../proxy"; const publicApi = { - setDesktopContentTransform: (data) => async (dispatch) => - await dispatch({type : "public/setDesktopContentTransform", data}), + setDesktopContentTransform: (data) => async (dispatch) => + await dispatch({ type: "public/setDesktopContentTransform", data }), setHeaderOptions: (data) => async (dispatch) => await dispatch({ type: "public/setHeaderOptions", data }), setIsDark: (data) => async (dispatch) => @@ -49,6 +49,8 @@ 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 }), }; export default publicApi; diff --git a/src/redux/reducers/public.js b/src/redux/reducers/public.js index 164ff0a..b009fcf 100644 --- a/src/redux/reducers/public.js +++ b/src/redux/reducers/public.js @@ -2,7 +2,7 @@ import location from "../../utils/location"; const initialState = { isDark: localStorage.getItem("isDark") || false, - isMobile : window.innerWidth < 1024, + isMobile: window.innerWidth < 1024, homeData: [], newProducts: [], levels: [], @@ -51,16 +51,16 @@ const initialState = { 11: "یازدهم", 12: "دوازدهم", }, - headerOptions : { - shown : false, - logo : false, - hamburgerMenu :false, - qr : false, - menu : false, - back : false, - title : false, + headerOptions: { + shown: false, + logo: false, + hamburgerMenu: false, + qr: false, + menu: false, + back: false, + title: false, }, - desktopContentTransform : false, + desktopContentTransform: false, }; const grades = [ @@ -83,9 +83,9 @@ export default function publicApi(state = initialState, action) { let { type, data } = action; switch (type) { case "public/setDesktopContentTransform": - return {...state, desktopContentTransform : data }; + return { ...state, desktopContentTransform: data }; case "public/setHeaderOptions": - return {...state, headerOptions : data}; + return { ...state, headerOptions: data }; case "public/setIsDark": localStorage.setItem("isDark", data); return { ...state, location: false, error: null, isDark: data }; @@ -118,6 +118,7 @@ export default function publicApi(state = initialState, action) { allCats = Array.from( new Set(data.vods.map((item) => item.categoryId && item.categoryId)) ); + return { ...state, loading: false, @@ -155,7 +156,8 @@ export default function publicApi(state = initialState, action) { error: null, homeData: data, }; - + case "public/ar": + return { ...state, loading: false, error: null, arList: data }; case "public/contact": return { ...state, loading: false, error: null, contactData: data }; case "public/blogList": diff --git a/src/redux/reducers/user.js b/src/redux/reducers/user.js index b3a072e..3b6ff71 100644 --- a/src/redux/reducers/user.js +++ b/src/redux/reducers/user.js @@ -1,7 +1,8 @@ import proxy from "../proxy"; import { toast } from "react-toastify"; + const initialState = { - status: proxy.status() || true, + status: proxy.status(), loading: false, error: null, list: null, diff --git a/src/router.js b/src/router.js index 79e696a..643c625 100644 --- a/src/router.js +++ b/src/router.js @@ -16,6 +16,7 @@ import DeliveryForm from "./views/DeliveryForm"; import Videos from "./views/Videos"; import Video from "./views/Video"; import VideoDisplay from "./views/VideoDisplay"; +import AR from "./views/AR"; import QR from "./views/QR"; import NotFound from "./views/404"; import Orders from "./views/Orders"; @@ -46,6 +47,7 @@ function Router({ // } }); }, []); + return (
} /> @@ -305,6 +307,23 @@ function Router({ } /> } /> + + } + /> { + setHeaderOptions(headerOptions); + getArList(); + + }, []); + + return ( +
+ {arList.length > 0 && + arList.map((book, index) => )} +
+ ); +} + +const mapStateToProps = (state) => ({ + arList: state.publicApi.arList, +}); + +const mapDispatchToProps = { + getArList: publicApi.getArList, + setHeaderOptions : publicApi.setHeaderOptions, +}; + +export default connect(mapStateToProps, mapDispatchToProps)(AR); diff --git a/src/views/AR/layouts/Book.js b/src/views/AR/layouts/Book.js new file mode 100644 index 0000000..b20c6f0 --- /dev/null +++ b/src/views/AR/layouts/Book.js @@ -0,0 +1,25 @@ +import React from "react"; + +const Book = ({ book }) => { + return ( + + + + {book.title} + + + ); +}; + +export default Book; diff --git a/src/views/Activation/index.js b/src/views/Activation/index.js index c54660c..27bda7b 100644 --- a/src/views/Activation/index.js +++ b/src/views/Activation/index.js @@ -39,6 +39,7 @@ function Activation({ headerOptions, setHeaderOptions, isMobile }) { border={{ color: "#196EC055", width: "1px" }} width="100%" color="text-white" + onClick={() => {}} />
@@ -96,6 +97,7 @@ function Address({ addresses, isDark, isMobile }) { bgOpacity="bg-opacity-100" width="100%" color={isDark ? "text-white" : "text-gray70"} + onClick={() => {}} />
diff --git a/src/views/DeliveryForm/PaymentMethod/index.js b/src/views/DeliveryForm/PaymentMethod/index.js index 43961ee..c631ee5 100644 --- a/src/views/DeliveryForm/PaymentMethod/index.js +++ b/src/views/DeliveryForm/PaymentMethod/index.js @@ -6,7 +6,7 @@ function PaymentMethods({ paymentMethods, isDark }) { const Method = ({ method }) => { return ( + ); } diff --git a/src/views/ShoppingCart/Product/index.js b/src/views/ShoppingCart/Product/index.js index a438a10..429467d 100644 --- a/src/views/ShoppingCart/Product/index.js +++ b/src/views/ShoppingCart/Product/index.js @@ -16,13 +16,13 @@ function Product({ product, grades, pushToCart, isMobile }) { className="rounded-md w-20" />
- + {product.product.book.name} - + {"پایه" + " " + grades[product.product.book.gradeId]} - + {product.productType === 2 ? "نسخه فیزیکی" : "نسخه دیجیتال"}
diff --git a/src/views/ShoppingCart/index.js b/src/views/ShoppingCart/index.js index 4d6c415..06cb8e6 100644 --- a/src/views/ShoppingCart/index.js +++ b/src/views/ShoppingCart/index.js @@ -63,7 +63,7 @@ function ShoppingCart({
{name} جمع کل سبد خرید -

+

{factorInfo?.payPrice + " " + "تومان"}

@@ -142,7 +142,7 @@ function ShoppingCart({ border={{ color: "#196EC055", width: "1px" }} width="100%" color="text-white" - // onClick={() => } + onClick={() => {}} />
) : ( diff --git a/src/views/Video/components/Desktop/Table.js b/src/views/Video/components/Desktop/Table.js new file mode 100644 index 0000000..39fda4a --- /dev/null +++ b/src/views/Video/components/Desktop/Table.js @@ -0,0 +1,47 @@ +import React from "react"; + +const persian = { + weight: "وزن", + pageNumber: "تعداد صفحات", + pageType: "نوع کاغذ", + bookNumber: "شماره شابک", + publisher: "انتشارات", + author: "نویسنده", + bookType: "قطع", + publishedYear: "سال انتشار", +}; + +const Table = ({ specifications }) => { + return ( +
    + {Object.keys(specifications).map((specification, index) => ( +
  • +
    + {persian[specification]} +
    +
    + {specifications[specification]} +
    +
  • + ))} +
+ ); +}; + +export default Table; + +Table.defaultProps = { + specifications: { + weight: "1 کیلوگرم", + pageNumber: "400 صفحه", + pageType: "گلاسه", + bookNumber: "124900985340561870112312499", + publisher: "رزمندگان", + author: "یک نویسنده گمنام", + bookType: "خشتی", + publishedYear: "1399", + }, +}; diff --git a/src/views/Video/components/Season.js b/src/views/Video/components/Season.js index e6b46db..546d864 100644 --- a/src/views/Video/components/Season.js +++ b/src/views/Video/components/Season.js @@ -1,17 +1,37 @@ import React, { useState } from "react"; import { connect } from "react-redux"; import { Link } from "react-router-dom"; +import { publicApi } from "../../../redux/actions"; -const Season = ({ season, id, isMobile }) => { - const [activeSeason, setActiveSeason] = useState(null); - const Unit = ({ unit }) => { +const Season = ({ + toggle, + season, + id, + isMobile, + activeSeason, + realSeasons, + vodDuration, +}) => { + const duration = (value) => { + const minute = value % 60; + const hour = Math.round(value / 60); return ( -
-
- + (hour > 0 + ? (hour.toString().length === 1 ? "0" + hour.toString() : hour) + "" + : "") + + ":" + + (minute.toString().length === 1 ? "0" + minute.toString() : minute) + ); + }; + // const [activeSeason, setActiveSeason] = useState(null); + const Unit = ({ unit }) => { + return isMobile ? ( +
+
+ {unit.name} - + {unit.duration}
@@ -19,7 +39,7 @@ const Season = ({ season, id, isMobile }) => { {unit.play && ( نمایش @@ -27,43 +47,81 @@ const Season = ({ season, id, isMobile }) => { {unit.download && ( دانلود )}
+ ) : ( + +
  • + // setSelectedLesson(selectedLesson === data.id ? null : data.id) + // } + > +
    +
    {unit.name}
    +
    +
  • + ); }; return isMobile ? (
    {season.name === activeSeason && - season.units.map((unit, index) => )} + season.map((unit, index) => )}
    ) : ( -
    +
  • toggle(season[0].categoryId)} + >
    - - {season.name} + + { + realSeasons.filter((item) => item.id === season[0].categoryId)[0] + .name + }
    -
  • +
      + {season[0].categoryId === activeSeason && + season.map((unit, index) => )} +
    + ); }; const mapStateToProps = (state) => ({ isMobile: state.publicApi.isMobile, + activeSeason: state.publicApi.activeCategory, + realSeasons: state.publicApi.bookInfo?.categories, + vodDuration: state.publicApi.bookInfo?.vodDuration, }); -export default connect(mapStateToProps)(Season); +const mapDispatchToProps = { + toggle: publicApi.activeCategory, +}; + +export default connect(mapStateToProps, mapDispatchToProps)(Season); diff --git a/src/views/Video/index.js b/src/views/Video/index.js index 2fe3680..5a91683 100644 --- a/src/views/Video/index.js +++ b/src/views/Video/index.js @@ -8,6 +8,7 @@ import Videos from "./components/Desktop/Videos"; import StarRating from "../../components/StarRating"; import Button from "../../components/Button"; import ProductTab from "../../components/ProductTab"; +import Table from "./components/Desktop/Table"; //assets import poster from "../../assets/images/poster.svg"; @@ -62,12 +63,15 @@ function Video({ const [type, setType] = useState(0); useEffect(() => { - getBook({ bookId: location.getId() }); + getBook({ bookId: 19 }); setHeaderOptions(headerOptions); }, []); useEffect(() => { - console.log(book); + if(book){ + // console.log(book); + } + }, [book]); return isMobile ? (
    @@ -90,10 +94,10 @@ function Video({
    - + {product.name} - + {product.grade}
    @@ -107,7 +111,7 @@ function Video({
    ) : ( -
    +
    @@ -116,8 +120,8 @@ function Video({ { title: "سر فصل ها", components: ( -
    - {product.seasons.map((season, index) => ( +
    + {seasons?.map((season, index) => ( ))}
    @@ -125,7 +129,7 @@ function Video({ }, { title: "مشخصات", - components: "", + components: , }, { title: "نقد و بررسی", @@ -141,7 +145,7 @@ function Video({

    - {book?.product[type]?.name || "دوره ویدئوی کتاب علوم تجربی"} + {book?.name }

    {"پایه" + " " + (grades[book?.gradeId] || "پایه دوازدهم")} @@ -193,6 +197,7 @@ function Video({ bgOpacity="bg-opacity-10" width="100%" color={isDark ? "text-white" : "text-blueC0"} + onClick={() => {}} />
    diff --git a/src/views/VideoDisplay/components/Season.js b/src/views/VideoDisplay/components/Season.js index 5e30d83..1305d0c 100644 --- a/src/views/VideoDisplay/components/Season.js +++ b/src/views/VideoDisplay/components/Season.js @@ -5,12 +5,12 @@ const Season = ({ season }) => { const [activeSeason, setActiveSeason] = useState(null); const Unit = ({ unit }) => { return ( -
    -
    - +
    +
    + {unit.name} - + {unit.duration}
    @@ -18,7 +18,7 @@ const Season = ({ season }) => { {unit.play && ( نمایش @@ -26,7 +26,7 @@ const Season = ({ season }) => { {unit.download && ( دانلود @@ -37,9 +37,9 @@ const Season = ({ season }) => { }; return (
    - {season.units.map((unit, index) => ( diff --git a/src/views/Videos/components/MostViewedVideo.js b/src/views/Videos/components/MostViewedVideo.js index 64c8688..27a54aa 100644 --- a/src/views/Videos/components/MostViewedVideo.js +++ b/src/views/Videos/components/MostViewedVideo.js @@ -8,7 +8,7 @@ function MostViewedVideo({}) { return (
    - + {video.name} -
    - +
    + {video.price} - + {"پایه" + " " + video.grade}
    @@ -46,7 +46,7 @@ function MostViewedVideo({}) { return (
    -
    +
    {[0, 1, 2].map((video, index) => (