parent
							
								
									d4a7e5b8c7
								
							
						
					
					
						commit
						133361b9e0
					
				
				 22 changed files with 451 additions and 201 deletions
			
			
		| After Width: | Height: | Size: 14 KiB | 
| After Width: | Height: | Size: 6.6 KiB | 
| @ -0,0 +1,23 @@ | ||||
| import { toast } from "react-toastify"; | ||||
| 
 | ||||
| const initialState = { | ||||
|   loading: false, | ||||
|   video: null, | ||||
|   listVOD: [], | ||||
| }; | ||||
| export default function content(state = initialState, action) { | ||||
|   let { type, data } = action; | ||||
|   switch (type) { | ||||
|     case "content/listVOD": | ||||
|       return {...state, loading: false, listVOD : data }; | ||||
|     case "content/infoVOD": | ||||
|       return {...state, loading: false, video : data }; | ||||
|     case "content/loading": | ||||
|       return { ...state, loading: true }; | ||||
|     case "content/error": | ||||
|       toast.error(data.message); | ||||
|       return { ...state, loading: false, error: data.message }; | ||||
|     default: | ||||
|       return state; | ||||
|   } | ||||
| } | ||||
| @ -0,0 +1,46 @@ | ||||
| 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"; | ||||
| 
 | ||||
| function Suggestion({ products, grades, isMobile }) { | ||||
|   return ( | ||||
|     <div className="flex flex-col mt-8 px-4"> | ||||
|       <strong className="text-blueC0 dark:text-white font-bold text-sm lg:text-base"> | ||||
|         پیشنهادات ما به شما | ||||
|       </strong> | ||||
|       {products.length > 0 && ( | ||||
|         <div className="relative w-full" style={{ direction: "ltr" }}> | ||||
|           <Carousel | ||||
|             show={Math.round(window.innerWidth / 300)} | ||||
|             slide={2} | ||||
|             swiping={true} | ||||
|             useArrowKeys={true} | ||||
|             transition={0.5} | ||||
|             rightArrow={ | ||||
|               <img | ||||
|                 className="absolute top-1/2 transform -translate-y-1/2 cursor-pointer p-2" | ||||
|                 src={arrow} | ||||
|                 alt="" | ||||
|               /> | ||||
|             } | ||||
|             leftArrow={ | ||||
|               <img | ||||
|                 className="absolute top-1/2 transform -translate-y-1/2 -translate-x-5 cursor-pointer -rotate-180 p-2" | ||||
|                 src={arrow} | ||||
|                 alt="" | ||||
|               /> | ||||
|             } | ||||
|           > | ||||
|             {products.map((product, index) => ( | ||||
|               <Product key={index} product={product} imageSize={4.5} /> | ||||
|             ))} | ||||
|           </Carousel> | ||||
|         </div> | ||||
|       )} | ||||
|     </div> | ||||
|   ); | ||||
| } | ||||
| 
 | ||||
| export default Suggestion; | ||||
| @ -1,21 +1,35 @@ | ||||
| import React from "react"; | ||||
| import React, {useEffect} from "react"; | ||||
| import { connect } from "react-redux"; | ||||
| import {book} from '../../../../../redux/actions'; | ||||
| 
 | ||||
| import MyBooks from "../../../../Home/Portrait/Private/MyBooks"; | ||||
| import Videos from "../../../../Home/Portrait/Private/Videos"; | ||||
| import ProductSuggestion from './ProductSuggestion'; | ||||
| 
 | ||||
| 
 | ||||
| export const UserItems = ({}) => { | ||||
| export const UserItems = ({list, grades, getList, isMobile}) => { | ||||
|   useEffect(() => { | ||||
|     if(list.length <= 0){ | ||||
|       getList(); | ||||
|     } | ||||
|   },[]); | ||||
|   return ( | ||||
|     <div className="flex-1 flex flex-col overflow-y-scroll"> | ||||
|       <MyBooks /> | ||||
|       <Videos /> | ||||
|     <div className="w-full flex flex-col lg:pt-20"> | ||||
|       <MyBooks books={list} grades={grades} /> | ||||
|       <br/> | ||||
|       <Videos videos={list} grades={grades} /> | ||||
|       <ProductSuggestion products={list} grades={grades} isMobile={isMobile} /> | ||||
|     </div> | ||||
|   ); | ||||
| }; | ||||
| 
 | ||||
| const mapStateToProps = (state) => ({}); | ||||
| const mapStateToProps = (state) => ({ | ||||
|   list : state.book.list, | ||||
|   grades: state.publicApi.grades, | ||||
|   isMobile: state.publicApi.isMobile | ||||
| }); | ||||
| 
 | ||||
| const mapDispatchToProps = {}; | ||||
| const mapDispatchToProps = { | ||||
|   getList : book.list, | ||||
| }; | ||||
| 
 | ||||
| export default connect(mapStateToProps, mapDispatchToProps)(UserItems); | ||||
| @ -1,20 +1,26 @@ | ||||
| import React, { useState } from "react"; | ||||
| import React, { useState, useEffect } from "react"; | ||||
| import { connect } from "react-redux"; | ||||
| import {publicApi} from '../../../../redux/actions'; | ||||
| 
 | ||||
| import Orders from "../../../Orders"; | ||||
| import UserItems from "../Main/UserItems"; | ||||
| 
 | ||||
| export const Main = ({}) => { | ||||
| export const Main = ({setHeaderOptions}) => { | ||||
|   useEffect(() => { | ||||
|     setHeaderOptions({shown: true}); | ||||
|   },[]); | ||||
|   const views = { | ||||
|     orders: <Orders />, | ||||
|     // orders: <Orders />,
 | ||||
|     userItems: <UserItems /> | ||||
|   }; | ||||
|   const [page, setPage] = useState("orders"); | ||||
|   return <div className="flex-1 py-2.5 overflow-y-scroll">{views[page]}</div>; | ||||
|   const [page, setPage] = useState("userItems"); | ||||
|   return <div className="w-full py-2.5">{views[page]}</div>; | ||||
| }; | ||||
| 
 | ||||
| const mapStateToProps = (state) => ({}); | ||||
| 
 | ||||
| const mapDispatchToProps = {}; | ||||
| const mapDispatchToProps = { | ||||
|   setHeaderOptions: publicApi.setHeaderOptions, | ||||
| }; | ||||
| 
 | ||||
| export default connect(mapStateToProps, mapDispatchToProps)(Main); | ||||
|  | ||||
					Loading…
					
					
				
		Reference in new issue