diff --git a/src/views/Dashboard/layouts/Main/UserItems/index.js b/src/views/Dashboard/layouts/Main/UserItems/index.js new file mode 100644 index 0000000..5758342 --- /dev/null +++ b/src/views/Dashboard/layouts/Main/UserItems/index.js @@ -0,0 +1,21 @@ +import React from "react"; +import { connect } from "react-redux"; + +import MyBooks from "../../../../Home/Portrait/Private/MyBooks"; +import Videos from "../../../../Home/Portrait/Private/Videos"; + + +export const UserItems = ({}) => { + return ( +
+ + +
+ ); +}; + +const mapStateToProps = (state) => ({}); + +const mapDispatchToProps = {}; + +export default connect(mapStateToProps, mapDispatchToProps)(UserItems); \ No newline at end of file diff --git a/src/views/Dashboard/layouts/Main/index.js b/src/views/Dashboard/layouts/Main/index.js index 544ebcc..5cf192d 100644 --- a/src/views/Dashboard/layouts/Main/index.js +++ b/src/views/Dashboard/layouts/Main/index.js @@ -1,14 +1,15 @@ import React, { useState } from "react"; import { connect } from "react-redux"; -import Order from "../../../Order"; import Orders from "../../../Orders"; +import UserItems from "../Main/UserItems"; export const Main = ({}) => { const views = { orders: , + userItems: }; - const [page, setPage] = useState("orders"); + const [page, setPage] = useState("userItems"); return
{views[page]}
; }; diff --git a/src/views/Home/Portrait/Private/MyBooks/index.js b/src/views/Home/Portrait/Private/MyBooks/index.js index dcc9e38..16b4af1 100644 --- a/src/views/Home/Portrait/Private/MyBooks/index.js +++ b/src/views/Home/Portrait/Private/MyBooks/index.js @@ -4,17 +4,39 @@ import { connect } from "react-redux"; import { book } from "../../../../../redux/actions"; import Progress from '../../../../../components/Progress'; -function MyBooks({ list, getList, grades }) { +function MyBooks({ list, getList, grades, isMobile }) { useEffect(() => { getList(); }, []); + + const Book = ({ book}) => { + return ( +
  • + + +

    {book.name}

    +

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

    + + +
  • + ); + }; + return (
    -
    - کتابهای من -
      - {list.map((book, index) => ( - +
      + کتابهای من +
        + {list?.slice(0,5)?.map((book, index) => ( + ))}
      @@ -22,30 +44,11 @@ function MyBooks({ list, getList, grades }) { ); } -const Book = ({ book, grades }) => { - return ( -
    • - - -

      {book.name}

      -

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

      - - -
    • - ); -}; const mapStateToProps = (state) => ({ list: state.book.list, - grades : state.publicApi.grades + grades : state.publicApi.grades, + isMobile: state.publicApi.isMobile }); export default connect(mapStateToProps, { getList: book.list })(MyBooks); diff --git a/src/views/Home/Portrait/Private/Videos/index.js b/src/views/Home/Portrait/Private/Videos/index.js index 44139c4..12dce86 100644 --- a/src/views/Home/Portrait/Private/Videos/index.js +++ b/src/views/Home/Portrait/Private/Videos/index.js @@ -6,26 +6,51 @@ import Progress from "../../../../../components/Progress"; import arrowBlueIcon from "../../../../../assets/icons/arrow-right-blue.svg"; import arrowWhiteIcon from "../../../../../assets/icons/arrow-left-white.svg"; -function Videos({ list, getList, grades, isDark }) { +function Videos({ list, getList, grades, isDark, isMobile }) { useEffect(() => { getList(); }, []); + + const Book = ({ book }) => { + return ( +
    • + + +

      + {book.name} +

      +

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

      + + +
    • + ); + }; return (
      -
      +
      - + دوره‌های ویدئویی شما
      -
        - {list.map((book, index) => ( - +
          + {list.slice(0,5)?.map((book, index) => ( + ))}
      @@ -33,35 +58,11 @@ function Videos({ list, getList, grades, isDark }) { ); } -const Book = ({ book, grades }) => { - return ( -
    • - - -

      - {book.name} -

      -

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

      - - -
    • - ); -}; - const mapStateToProps = (state) => ({ list: state.book.list, grades: state.publicApi.grades, isDark: state.publicApi.isDark, + isMobile: state.publicApi.isMobile }); export default connect(mapStateToProps, { getList: book.list })(Videos);