diff --git a/src/assets/icons/arrow-right-blue.svg b/src/assets/icons/arrow-right-blue.svg index 4eed913..72d113d 100644 --- a/src/assets/icons/arrow-right-blue.svg +++ b/src/assets/icons/arrow-right-blue.svg @@ -1,8 +1,8 @@ - - + + diff --git a/src/assets/icons/bookmark-deactive-light.svg b/src/assets/icons/bookmark-deactive-light.svg index abef12d..e731955 100644 --- a/src/assets/icons/bookmark-deactive-light.svg +++ b/src/assets/icons/bookmark-deactive-light.svg @@ -1,8 +1,8 @@ - - - + + + diff --git a/src/assets/icons/dots-menu-light.svg b/src/assets/icons/dots-menu-light.svg index 14839b2..f8f80cb 100644 --- a/src/assets/icons/dots-menu-light.svg +++ b/src/assets/icons/dots-menu-light.svg @@ -1,10 +1,10 @@ - - - - + + + + diff --git a/src/assets/icons/dropdown-blue.svg b/src/assets/icons/dropdown-blue.svg index 8b03880..dd768d9 100644 --- a/src/assets/icons/dropdown-blue.svg +++ b/src/assets/icons/dropdown-blue.svg @@ -1,4 +1,4 @@ - + diff --git a/src/components/BottomNavigation/index.js b/src/components/BottomNavigation/index.js index db374dc..7104482 100644 --- a/src/components/BottomNavigation/index.js +++ b/src/components/BottomNavigation/index.js @@ -26,11 +26,11 @@ export const BottomNavigation = ({ pages, isDark }) => { onClick={() => setActiveLink(page.link)} > - + {page.name} diff --git a/src/components/Button/index.js b/src/components/Button/index.js index b38944c..5ad098e 100644 --- a/src/components/Button/index.js +++ b/src/components/Button/index.js @@ -17,11 +17,11 @@ export default function Button({ }) { return ( + + {isMobile && ( +
+ + آدرس جدید + + back setPhase("deliveryForm")} + /> +
+ )} {dialog.open && } ); @@ -351,6 +417,8 @@ const mapStateToProps = (state) => ({ cities: state.publicApi.cities, loading: state.userAddress.loading, cityLoading: state.publicApi.loading, + isMobile: state.publicApi.isMobile, + isDark: state.publicApi.isDark, }); const mapDispatchToProps = { diff --git a/src/views/Blog/index.js b/src/views/Blog/index.js index a9469f3..e01cecb 100644 --- a/src/views/Blog/index.js +++ b/src/views/Blog/index.js @@ -7,6 +7,7 @@ import location from "../../utils/location"; import Hashtags from "../Blogs/layouts/Hashtags"; import Header from "../Blogs/layouts/Header"; import Suggest from "../Blogs/layouts/Suggest"; +import New from "../Blogs/layouts/New"; import Avatar from "../../components/Avatar"; //assets @@ -21,85 +22,137 @@ export const Blog = ({ blogs, }) => { useEffect(() => { - setHeaderOptions({ shown: true }); + setHeaderOptions({ shown: true, menu: true, back: true, bookmark: true }); getInfo({ id: location.getId() }); if (blogs.length === 0) { getList(); } }, []); return ( -
+
-
+ {isMobile && ( +
+ +
+
+
+ +
+ + {"نوشته از:" + " " + "کامران ایزدی"} + +

+ {"سردبیر بخش وبلاگ دانوین"} +

+
+
+
+ + {"زمان مطالعه" + " " + "۳۰ دقیقه"} + + + {"1400/11/24"} + +
+
+
+
+ )} + {!isMobile && ( +
+ )}
- + {blog?.title} -
-
- -
- - {"نوشته از:" + " " + "کامران ایزدی"} - -

- {"سردبیر بخش وبلاگ دانوین"} -

+ {!isMobile && ( +
+
+ +
+ + {"نوشته از:" + " " + "کامران ایزدی"} + +

+ {"سردبیر بخش وبلاگ دانوین"} +

+
+
+
+ + {"زمان مطالعه" + " " + "۳۰ دقیقه"} + + + {"1400/11/24"} +
-
- - {"زمان مطالعه" + " " + "۳۰ دقیقه"} - - - {"1400/11/24"} - -
-
-
-
{" "} -
-
- {blogs.length > 0 && ( - e.stopPropagation()} - /> - } - leftArrow={ - e.stopPropagation()} - /> - } - > - {blogs.map((blog, index) => ( - - ))} - )}
+
{" "} +
+ {isMobile ? ( +
+ {blogs.map((blog, index) => ( + + ))} +
+ ) : ( +
+ {blogs.length > 0 && ( + e.stopPropagation()} + /> + } + leftArrow={ + e.stopPropagation()} + /> + } + > + {blogs.map((blog, index) => ( + + ))} + + )} +
+ )}
); }; diff --git a/src/views/Blogs/index.js b/src/views/Blogs/index.js index 6c8848d..ea2b0ed 100644 --- a/src/views/Blogs/index.js +++ b/src/views/Blogs/index.js @@ -16,81 +16,105 @@ import arrow from "../../assets/icons/dropdown-blue.svg"; export const Blogs = ({ isMobile, getList, blogs, setHeaderOptions }) => { useEffect(() => { - setHeaderOptions({ shown: true }); + if (isMobile) { + setHeaderOptions({ + shown: true, + hamburgerMenu: true, + qr: true, + }); + } else { + setHeaderOptions({ shown: true }); + } if (blogs.length === 0) { getList(); } }, []); return ( -
+
-
- {blogs.length > 0 && ( - e.stopPropagation()} - /> - } - leftArrow={ - e.stopPropagation()} - /> - } - > - {blogs.map((blog, index) => ( - - ))} - - )} -
+ {isMobile ? ( +
+ {blogs.map((blog, index) => ( + + ))} +
+ ) : ( +
+ {blogs.length > 0 && ( + e.stopPropagation()} + /> + } + leftArrow={ + e.stopPropagation()} + /> + } + > + {blogs.map((blog, index) => ( + + ))} + + )} +
+ )}
-
- {blogs.length > 0 && ( - e.stopPropagation()} - /> - } - leftArrow={ - e.stopPropagation()} - /> - } - > - {blogs.map((blog, index) => ( - - ))} - - )} -
+ {isMobile ? ( +
+ {blogs.map((blog, index) => ( + + ))} +
+ ) : ( +
+ {blogs.length > 0 && ( + e.stopPropagation()} + /> + } + leftArrow={ + e.stopPropagation()} + /> + } + > + {blogs.map((blog, index) => ( + + ))} + + )} +
+ )}
- +
); diff --git a/src/views/Blogs/layouts/Hashtags.js b/src/views/Blogs/layouts/Hashtags.js index 84ea97a..5277fe6 100644 --- a/src/views/Blogs/layouts/Hashtags.js +++ b/src/views/Blogs/layouts/Hashtags.js @@ -6,11 +6,11 @@ import arrowIcon from "../arrow.svg"; export const Hashtags = ({ hashtags }) => { return ( -
+
-
    +
      {hashtags.map((hashtag, index) => ( -
    • +
    • {"#" + " " + hashtag.title}
    • ))} diff --git a/src/views/Blogs/layouts/Header.js b/src/views/Blogs/layouts/Header.js index aaa8a97..af18e0f 100644 --- a/src/views/Blogs/layouts/Header.js +++ b/src/views/Blogs/layouts/Header.js @@ -3,9 +3,9 @@ import { connect } from "react-redux"; export const Header = ({ title, color }) => { return ( -
      - {title} - +
      + {title} +
      ); }; diff --git a/src/views/Blogs/layouts/Join.js b/src/views/Blogs/layouts/Join.js index a2a0764..1082de1 100644 --- a/src/views/Blogs/layouts/Join.js +++ b/src/views/Blogs/layouts/Join.js @@ -4,49 +4,75 @@ import { connect } from "react-redux"; //assets import picImage from "../pic.svg"; -export const Join = ({}) => { +export const Join = ({ isMobile }) => { return ( -
      +
      -
      - اینجا خبری از اسپم نیست! + {isMobile && ( +
      +
      + + +
      +
      + )} +
      + اینجا خبری از اسپم نیست! خبرنامه وبلاگ دانوین -

      +

      بهترین و آخرین اخبار علمی و آموزشی را در ایمیل خودتون دریافت کنید. هر زمان هم که لازم نداشتید می تونید عضویت رو لغو کنید

      -
      -
      - - -
      -
      + {!isMobile && ( +
      +
      + + +
      +
      + )}
      ); }; -const mapStateToProps = (state) => ({}); +const mapStateToProps = (state) => ({ + isMobile: state.publicApi.isMobile, +}); const mapDispatchToProps = {}; diff --git a/src/views/Blogs/layouts/New.js b/src/views/Blogs/layouts/New.js index 5154928..d8511f2 100644 --- a/src/views/Blogs/layouts/New.js +++ b/src/views/Blogs/layouts/New.js @@ -3,25 +3,32 @@ import { connect } from "react-redux"; import { Link } from "react-router-dom"; import Avatar from "../../../components/Avatar"; -export const New = ({ blog }) => { +export const New = ({ blog, isMobile }) => { return ( - {blog?.title} -

      + + {blog?.title} + +

      هر نفسی که فرو می‌ بریم، مرگی را که مدام به ما دست‌ اندازی می‌کند پس می‌زند در نهایت این مرگ{" "}

      -
      +
      @@ -46,7 +53,9 @@ export const New = ({ blog }) => { ); }; -const mapStateToProps = (state) => ({}); +const mapStateToProps = (state) => ({ + isMobile: state.publicApi.isMobile, +}); const mapDispatchToProps = {}; diff --git a/src/views/Blogs/layouts/Single.js b/src/views/Blogs/layouts/Single.js index 3f8706d..388ec4d 100644 --- a/src/views/Blogs/layouts/Single.js +++ b/src/views/Blogs/layouts/Single.js @@ -1,51 +1,81 @@ import React from "react"; import { connect } from "react-redux"; -import {Link} from 'react-router-dom'; +import { Link } from "react-router-dom"; import Avatar from "../../../components/Avatar"; export const Single = ({ blog, isMobile }) => { return ( - +
      +
      +
      +
      + +
      + + {"نوشته از:" + " " + "کامران ایزدی"} + +

      + {"سردبیر بخش وبلاگ دانوین"} +

      +
      +
      +
      + + {"زمان مطالعه" + " " + "۳۰ دقیقه"} + + {"1400/11/24"} +
      +
      +
      -
      -

      {blog?.title}

      -

      +

      +

      {blog?.title}

      +

      هر نفسی که فرو می‌ بریم، مرگی را که مدام به ما دست‌ اندازی می‌کند پس می‌زند... در نهایت این مرگ است که باید پیروز شود، زیرا از هنگام تولد بخشی از سرنوشت ما شده و فقط مدت کوتاهی پیش از بلعیدن طعمه اش، با آن بازی می کند. با این همه، ما تا آنجا که ممکن است، با علاقه فراوان{" "}

      -
      -
      - -
      - - {"نوشته از:" + " " + "کامران ایزدی"} - -

      - {"سردبیر بخش وبلاگ دانوین"} -

      + {!isMobile && ( +
      +
      + +
      + + {"نوشته از:" + " " + "کامران ایزدی"} + +

      + {"سردبیر بخش وبلاگ دانوین"} +

      +
      +
      +
      + + {"زمان مطالعه" + " " + "۳۰ دقیقه"} + + + {"1400/11/24"} +
      -
      - {"زمان مطالعه" + " " + "۳۰ دقیقه"} - {'1400/11/24'} -
      -
      + )}
      ); diff --git a/src/views/Blogs/layouts/Target.js b/src/views/Blogs/layouts/Target.js index e191be0..a7443f9 100644 --- a/src/views/Blogs/layouts/Target.js +++ b/src/views/Blogs/layouts/Target.js @@ -3,9 +3,45 @@ import { connect } from "react-redux"; import { Link } from "react-router-dom"; import Avatar from "../../../components/Avatar"; -export const Target = ({ blogs }) => { +export const Target = ({ blogs, isMobile }) => { const Large = ({ blog }) => { - return ( + return isMobile ? ( +
      +
      + +
      +
      + + {blog?.title} + +
      +
      + +
      + + {"نوشته از:" + " " + "کامران ایزدی"} + +

      + {"سردبیر بخش وبلاگ دانوین"} +

      +
      +
      +
      + + {"زمان مطالعه" + " " + "۳۰ دقیقه"} + + {"1400/11/24"} +
      +
      +
      + ) : ( { const Small = ({ blogs }) => { return ( -
      +
      {blogs.map((blog, index) => ( -
      - {blog?.title} -

      +

      + {blog?.title} +

      هر نفسی که فرو می‌ بریم، مرگی را که مدام به ما دست‌ اندازی می‌کند پس می‌زند در نهایت این مرگ{" "}

      @@ -69,14 +110,16 @@ export const Target = ({ blogs }) => { ); }; return ( -
      +
      ); }; -const mapStateToProps = (state) => ({}); +const mapStateToProps = (state) => ({ + isMobile: state.publicApi.isMobile, +}); const mapDispatchToProps = {}; diff --git a/src/views/DeliveryForm/Address/index.js b/src/views/DeliveryForm/Address/index.js index 0bc6a67..dfc073b 100644 --- a/src/views/DeliveryForm/Address/index.js +++ b/src/views/DeliveryForm/Address/index.js @@ -18,25 +18,29 @@ function Address({ const Location = ({ address, active }) => { return isMobile ? ( @@ -82,24 +86,31 @@ function Address({ }; return isMobile ? (
      - + انتخاب آدرس -
        +
          {addresses.map((address, index) => ( - + ))}
        -
      ) : ( @@ -115,15 +126,18 @@ function Address({ ))}
    -
    ); diff --git a/src/views/DeliveryForm/TransportDate/index.js b/src/views/DeliveryForm/TransportDate/index.js index f875667..44221d6 100644 --- a/src/views/DeliveryForm/TransportDate/index.js +++ b/src/views/DeliveryForm/TransportDate/index.js @@ -8,16 +8,19 @@ function TransportDate({ transportDate, isDark, isMobile }) { const Time = ({ time }) => { return isMobile ? ( ) : (
-
    +
      {list.map((blog, index) => ( ))} @@ -56,7 +56,7 @@ const Blog = ({ blog }) => { }} >
      -

      +

      {blog.title}

      diff --git a/src/views/Home/Portrait/Private/Videos/index.js b/src/views/Home/Portrait/Private/Videos/index.js index 408f948..54c2eee 100644 --- a/src/views/Home/Portrait/Private/Videos/index.js +++ b/src/views/Home/Portrait/Private/Videos/index.js @@ -7,23 +7,32 @@ import Progress from "../../../../../components/Progress"; //assets import arrowGreenIcon from "../../../../../assets/icons/dropdown-blue.svg"; import arrowWhiteIcon from "../../../../../assets/icons/arrow-left-white.svg"; +import whitePlayIcon from "../../../../../components/VodProduct/white-play-button-icon.svg"; function Videos({ videos, grades, isDark, isMobile }) { const Video = ({ video }) => { return (
    • - - + +
      + +
      + +
      +
      +

      {"دوره ویدئویی" + " " + video?.product[2]?.name}

      diff --git a/src/views/Home/Portrait/Private/index.js b/src/views/Home/Portrait/Private/index.js index 4a58163..45e6bd3 100644 --- a/src/views/Home/Portrait/Private/index.js +++ b/src/views/Home/Portrait/Private/index.js @@ -17,7 +17,7 @@ function Private({ getList, products, blogs, getBlogList, grades }) { // console.log(getBlogList()); }, []); return ( -
      +
      diff --git a/src/views/Product/Comment/index.js b/src/views/Product/Comment/index.js index 2ebc4f1..50a0106 100644 --- a/src/views/Product/Comment/index.js +++ b/src/views/Product/Comment/index.js @@ -3,7 +3,7 @@ import userImage from "../../../assets/images/user.png"; function Comment({ comment }) { return ( -
      +
      @@ -11,7 +11,7 @@ function Comment({ comment }) {
      -

      {comment?.text}

      +

      {comment?.text}

      ); } diff --git a/src/views/Product/index.js b/src/views/Product/index.js index 5a4fd6e..c7dc34b 100644 --- a/src/views/Product/index.js +++ b/src/views/Product/index.js @@ -2,6 +2,7 @@ import React, { useState, useEffect } from "react"; import { connect } from "react-redux"; import { toast } from "react-toastify"; import { book, userProduct, publicApi } from "../../redux/actions"; +import { Link } from "react-router-dom"; import proxy from "../../redux/proxy"; import location from "../../utils/location"; import Button from "../../components/Button"; @@ -10,6 +11,10 @@ import Comment from "./Comment"; import Rate from "./Rate"; import DesktopProductLayout from "./Desktop"; +//assets +import arrow from "../../assets/icons/dropdown-blue.svg"; + + export const Product = ({ isMobile, productType, @@ -26,7 +31,7 @@ export const Product = ({ const [desktopContentTransform, setDesktopContentTransform] = useState(false); useEffect(() => { - getInfo({ id: location.getId(), vod : true }); + getInfo({ id: location.getId(), vod: true }); setHeaderOptions(headerOptions); if (!isMobile) { window.addEventListener("scroll", () => { @@ -42,7 +47,7 @@ export const Product = ({ <> {/* Portrait */} {isMobile ? ( -
      +
      -

      +

      {type === "digital" ? book?.product[0]?.name : book?.product[1]?.name}

      -
      +
      {"پایه" + " " + grades[book?.gradeId]}
      @@ -68,17 +73,17 @@ export const Product = ({ className="list-none flex flex-row divide-x items-center mt-4" style={{ direction: "ltr" }} > -
    • +
    • {book?.pagesNum}
      صفحه
    • -
    • +
    • {"فیزیکی - دیجیتالی"}
      در دسترس
    • -
    • +
    • {book?.rate}
      امتیاز
    -

    +

    نسخه محصول را انتخاب کنید

    @@ -133,7 +138,7 @@ export const Product = ({ "تومان" } backgroundColor="bg-blueC0" - border={{ color: "#196EC055", width: "1px" }} + border={{ color: "#196EC055", width: "0px" }} width="65%" color="text-white" /> @@ -150,19 +155,21 @@ export const Product = ({ />
    -
    -

    +

    خالد حسینی تو رمان باد بادک باز مینویسه : ﻣﺮﺩ ﺁﻫﺴﺘﻪ ﺩﺭ ﮔﻮﺵ ﻓﺮﺯﻧﺪ ﺗﺎﺯﻩ ﺑﻪ ﺑﻠﻮﻍ ﺭﺳﯿﺪﻩ ﺍﺵ ﺑﺮﺍﯼ ﭘﻨﺪ ﭼﻨﯿﻦ ﻧﺠﻮﺍ ﮐﺮﺩ : ” ﭘﺴﺮﻡ ﺩﺭ ﺯﻧﺪﮔﯽ ﻫﺮﮔﺰ ﺩﺯﺩﯼ ﻧﮑﻦ ” ﭘﺴﺮ ﻣﺘﻌﺠﺐ ﻭ ﻣﺒﻬﻮﺕ ﺑﻪ ﭘﺪﺭ ﻧﮕﺎﻩ ﮐﺮﺩ ﺑﺪﯾﻦ ﻣﻌﻨﺎ ﮐﻪ ﺍﻭ @@ -173,12 +180,12 @@ export const Product = ({ ﺩﺯﺩﯾﺪﻩ ﺍی... ﭘﺲ ﺩﺭ ﺯﻧﺪﮔﯽ ﻓﻘﻂ ﺩﺯﺩﯼ نکن{" "}

    -
    +
    {[0, 1, 2, 2].map((comment, index) => ( diff --git a/src/views/Products/layouts/Mobile/Header.js b/src/views/Products/layouts/Mobile/Header.js index 68d0986..95e71aa 100644 --- a/src/views/Products/layouts/Mobile/Header.js +++ b/src/views/Products/layouts/Mobile/Header.js @@ -18,9 +18,9 @@ export const Header = ({ return (
    setFilterOptions({ ...filterOptions, search: val }), diff --git a/src/views/Products/layouts/Mobile/Main.js b/src/views/Products/layouts/Mobile/Main.js index 289063b..2470aa2 100644 --- a/src/views/Products/layouts/Mobile/Main.js +++ b/src/views/Products/layouts/Mobile/Main.js @@ -58,12 +58,12 @@ export const Main = ({ books, filterOptions, grades }) => { return filterOptions.productType === "دوره ویدئویی" ? bySearchFilter?.map((product, index) => (
    {
    - + {product?.name} - + {"پایه" + " " + grades[product?.gradeId]}
    @@ -94,18 +94,16 @@ export const Main = ({ books, filterOptions, grades }) => { - + {"کتاب دیجیتال" + " " + product?.name} - + {"پایه" + " " + grades[product?.gradeId]}
    @@ -117,18 +115,16 @@ export const Main = ({ books, filterOptions, grades }) => { - + {"کتاب فیزیکی" + " " + product?.name} - + {"پایه" + " " + grades[product?.gradeId]}
    diff --git a/src/views/QR/Scan/index.js b/src/views/QR/Scan/index.js index 9c380bf..7a30d3a 100644 --- a/src/views/QR/Scan/index.js +++ b/src/views/QR/Scan/index.js @@ -21,25 +21,25 @@ export const Scan = ({ }; useEffect(() => { - setHeaderOptions(headerOptions); + setHeaderOptions({shown : false}); }); return (
    -
    +
    - + اسکن کد QR فعالسازی کتاب

    @@ -48,7 +48,7 @@ export const Scan = ({

    diff --git a/src/views/ShoppingCart/Code/index.js b/src/views/ShoppingCart/Code/index.js index 023d236..a867f83 100644 --- a/src/views/ShoppingCart/Code/index.js +++ b/src/views/ShoppingCart/Code/index.js @@ -10,7 +10,7 @@ function Code({ codeId, setCodeId, userId, factorId }) { } return ( -
    +
    - + {product.product.book.name} - + {"پایه" + " " + grades[product.product.book.gradeId]} - + {product.productType === 2 ? "نسخه فیزیکی" : "نسخه دیجیتال"}
    @@ -61,29 +61,53 @@ function Product({ product, grades, pushToCart, isMobile, loading }) { > + - + {loading ? ( ) : ( product.count )} - + { + <> + {product.count === 1 ? ( + + pushToCart( + { + productId: product?.productId, + userId: product?.userId, + count: + product?.productType === 1 ? -1 : -product?.count, + }, + {}, + { id: product?.factorId } + ) + } + src={deleteIcon} + alt="delete" + className="border border-red-800 border-solid p-1 w-8 bg-red-100 rounded-md cursor-pointer" + /> + ) : ( + + )} + + }
    )} - {product.product.price} تومان + {separate(product.product.price * product.count)} تومان
    @@ -134,11 +158,7 @@ function Product({ product, grades, pushToCart, isMobile, loading }) { + - {loading ? ( - - ) : ( - product.count - )} + {loading ? : product.count} { <> diff --git a/src/views/ShoppingCart/index.js b/src/views/ShoppingCart/index.js index 027d3dd..0f4694f 100644 --- a/src/views/ShoppingCart/index.js +++ b/src/views/ShoppingCart/index.js @@ -40,6 +40,12 @@ function ShoppingCart({ setHeaderOptions(headerOptions); }, []); + useEffect(() => { + if (phase === "products") { + setHeaderOptions(headerOptions); + } + }, [phase]); + const productsLength = userProducts?.filter( (product) => product.condition < 2 )?.length; @@ -86,15 +92,29 @@ function ShoppingCart({ const PriceStatus = ({ name, value, type }) => { return isMobile ? ( -
    - {name} +
    + + {name} + - {value + " " + "تومان"} + {separate(Math.floor(value))} + + تومان +
    ) : ( @@ -112,7 +132,7 @@ function ShoppingCart({ : "", }} > - {separate(value)} + {separate(Math.floor(value))} + {productsLength ? ( + list + .sort((a, b) => a?.id - b?.id) + .map( + (product, index) => + product.condition < 2 && ( + + ) + ) + ) : ( + سبد خرید شما خالی است. + )} + + + ) : productsLength ? ( ) : ( سبد خرید شما خالی است. @@ -137,53 +173,67 @@ function ShoppingCart({ }; return isMobile ? ( -
    - {list.map((product, index) => ( - - ))} - -
    - - - -
    -
    - - جمع کل سبد خرید - -

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

    -
    -
    - -

    - هزینه ارسال کالا پس از تعیین محل آدرس مشخص می‌شود -

    -
    - + )} + + )}
    ) : (
    { return isMobile ? ( - -
    - - {unit.name} - - {/* - {unit.duration} - */} -
    - {/*
    - {unit.play && ( - - نمایش - - )} - {unit.download && ( - - دانلود - - )} -
    */} - +
    +
  • +
    +
    {unit.name}
    +
    + setCategory(season[0].categoryId, unit.name)} + > + {Number(index) === 0 ? "تماشا" : "قفل"} + +
    +
    +
  • +
    ) : (
  • toggle(season[0].categoryId)} > - {season[0].categoryId === activeSeason && - season.map((unit, index) => )} +
      + {season.map((unit, index) => ( + + ))} +
  • ) : ( -
  • +
  • toggle(season[0].categoryId)} @@ -148,13 +164,9 @@ const Season = ({ />
      {season.map((unit, index) => ( diff --git a/src/views/Video/index.js b/src/views/Video/index.js index 7e34a34..74fa67e 100644 --- a/src/views/Video/index.js +++ b/src/views/Video/index.js @@ -22,41 +22,7 @@ function Video({ isLogin, pushToCart, userId, - product = { - id: 0, - type: "کتاب ها", - name: "ریاضی", - price: "145.000 تومان", - imageUrl: "https://dnvn.ir/api/v1/file/2105", - poster: poster, - grade: "پایه هفتم ابتدایی", - seasons: [ - { - name: "فصل اول: مباحث جوشش مواد مذاب در مرکز زمین", - duration: "2:30:13", - units: [ - { - name: "مقدمه جالب توجه نویسنده کتاب برای شما", - duration: "14:30", - download: true, - play: true, - }, - { - name: "چگونگی ساخت نیروگاه‌های برقی ", - duration: "14:30", - download: false, - play: true, - }, - { - name: "آیا گوگل از ما دزدی می‌کند ؟", - duration: "14:30", - download: true, - play: true, - }, - ], - }, - ], - }, + product, isMobile, isDark, headerOptions, @@ -73,41 +39,66 @@ function Video({ getBook({ bookId: location.getId() }, { id: location.getId(), vod: true }); setHeaderOptions(headerOptions); }, []); + return isMobile ? ( -
      +
      -
      -
      -
      - - {book?.name} +
      + + {"دوره ویدئویی" + " " + book?.product[2]?.name} - + {"پایه" + " " + (grades[book?.gradeId] || "پایه دوازدهم")}
      - +
      +
      +
      - {seasons?.map((season, index) => ( - - ))} + {seasons + ?.sort((a, b) => a[0]?.categoryId - b[0]?.categoryId) + ?.map((season, index) => ( + + ))}
      ) : ( @@ -122,9 +113,11 @@ function Video({ title: "سر فصل ها", components: (
      - {seasons?.map((season, index) => ( - - ))} + {seasons + ?.sort((a, b) => a[0]?.categoryId - b[0]?.categoryId) + ?.map((season, index) => ( + + ))}
      ), }, @@ -152,10 +145,10 @@ function Video({ /> )}
      -
      +

      - {"دوره ویدئویی" + " " + book?.name} + {"دوره ویدئویی" + " " + book?.product[2]?.name}

      {"پایه" + " " + grades[book?.gradeId]} @@ -179,7 +172,7 @@ function Video({
      - {separate(book?.price)} + {separate(book?.product[2]?.price)} تومان
      @@ -199,7 +192,7 @@ function Video({ onClick={() => isLogin ? pushToCart({ - productId: book?.id, + productId: book?.product[2]?.id, userId: userId, count: 1, }) @@ -224,7 +217,7 @@ function Video({ const mapStateToProps = (state) => ({ isMobile: state.publicApi.isMobile, isDark: state.publicApi.isDark, - book: state.book.info?.product[2], + book: state.book.info, seasons: state.publicApi.categories, grades: state.publicApi.grades, isLogin: state.user.status, diff --git a/src/views/VideoDisplay/index.js b/src/views/VideoDisplay/index.js index 0dd0bb1..44b4e9a 100644 --- a/src/views/VideoDisplay/index.js +++ b/src/views/VideoDisplay/index.js @@ -11,40 +11,6 @@ import Season from "./components/Season"; function VideoDisplay({ isMobile, - product = { - type: "کتاب ها", - name: "ریاضی", - price: "145.000 تومان", - imageUrl: "https://dnvn.ir/api/v1/file/2105", - poster: poster, - grade: "پایه هفتم ابتدایی", - seasons: [ - { - name: "فصل اول: مباحث جوشش مواد مذاب در مرکز زمین", - duration: "2:30:13", - units: [ - { - name: "مقدمه جالب توجه نویسنده کتاب برای شما", - duration: "14:30", - download: true, - play: true, - }, - { - name: "چگونگی ساخت نیروگاه‌های برقی ", - duration: "14:30", - download: false, - play: true, - }, - { - name: "آیا گوگل از ما دزدی می‌کند ؟", - duration: "14:30", - download: true, - play: true, - }, - ], - }, - ], - }, headerOptions, setHeaderOptions, book, @@ -59,47 +25,24 @@ function VideoDisplay({ 8, window.location.pathname.lastIndexOf("/") ); - getBook({bookId : id}, {id}); + getBook({ bookId: id }, { id }); setHeaderOptions(headerOptions); const cat = localStorage.getItem("season")?.split(","); getSeason({ bookId: cat[0], categoryId: cat[1] }); }, []); - useEffect(() => { - - },[]) - - const enamad = - ''; return isMobile ? ( -
      +
      -
      - -
      - {/*
      -
      - - {product.name} - - {product.grade} -
      - -
      */} -
      -
      - {product.seasons.map((season, index) => ( - - ))} + +

      + {selectedVideo?.name} +

      +
      ) : (
      @@ -128,15 +71,6 @@ function VideoDisplay({
      - {/*
      -
      - - {product.name} - - {product.grade} -
      - -
      */}
      ); @@ -153,7 +87,7 @@ const mapStateToProps = (state) => ({ const mapDispatchToProps = { setHeaderOptions: publicApi.setHeaderOptions, getBook: publicApi.bookInfo, - getSeason: publicApi.bookSection + getSeason: publicApi.bookSection, }; export default connect(mapStateToProps, mapDispatchToProps)(VideoDisplay); diff --git a/src/views/Videos/components/MostViewedVideo.js b/src/views/Videos/components/MostViewedVideo.js index db1a48b..e30d508 100644 --- a/src/views/Videos/components/MostViewedVideo.js +++ b/src/views/Videos/components/MostViewedVideo.js @@ -1,14 +1,15 @@ import React from "react"; import { Link } from "react-router-dom"; +import separate from "../../../utils/separate"; import Header from "../../../components/Header"; import posterImage from "../../../assets/images/poster.svg"; -function MostViewedVideo({videos, grades}) { +function MostViewedVideo({ videos, grades }) { const Video = ({ video }) => { return (
      - - {video.name} + + {"دوره‌ ویدئویی" + " " + video.name}
      - - {video.price} + + {separate(video?.product[2]?.price) + " " + "تومان"} - + {"پایه" + " " + grades[video.gradeId]}
      @@ -46,12 +47,9 @@ function MostViewedVideo({videos, grades}) { return (
      -
      +
      {videos.map((video, index) => ( -
      diff --git a/src/views/Videos/components/NewestVideo.js b/src/views/Videos/components/NewestVideo.js index e294189..61e95d2 100644 --- a/src/views/Videos/components/NewestVideo.js +++ b/src/views/Videos/components/NewestVideo.js @@ -1,7 +1,8 @@ import React from "react"; import { Link } from "react-router-dom"; import Header from "../../../components/Header"; -import posterImage from "../../../assets/images/poster.svg"; +import separate from "../../../utils/separate"; + const NewestVideo = ({ videos, grades }) => { const Video = ({ video }) => { @@ -25,9 +26,14 @@ const NewestVideo = ({ videos, grades }) => { {video.name} - - {"پایه" + " " + grades[video.gradeId]} - +
      + + {"پایه" + " " + grades[video.gradeId]} + + + {separate(video?.product[2]?.price) + " " + "تومان"} + +
      ); }; @@ -35,7 +41,7 @@ const NewestVideo = ({ videos, grades }) => {
      - {videos.map((video, index) => ( + {videos.slice(0, 5).map((video, index) => (
      diff --git a/src/views/Videos/index.js b/src/views/Videos/index.js index c4c1907..0f11f34 100644 --- a/src/views/Videos/index.js +++ b/src/views/Videos/index.js @@ -13,11 +13,11 @@ function Videos({ headerOptions, setHeaderOptions, getList, videos, grades }) { const [search, setSearch] = useState(""); useEffect(() => { setHeaderOptions(headerOptions); - getList(); + getList({ vod: true }); }, []); return ( -
      -
      +
      + {/*
      -
      +
      */}
      -
      +
      ); } const mapStateToProps = (state) => ({ - videos : state.book.list, + videos: state.book.list, grades: state.publicApi.grades, }); const mapDispatchToProps = { setHeaderOptions: publicApi.setHeaderOptions, - getList : book.list + getList: book.list, }; export default connect(mapStateToProps, mapDispatchToProps)(Videos);