reza updated some feature

temp
Reza_ashrafi 3 years ago
parent 4523580573
commit 83415ba2d9
  1. 7
      src/components/Navbar/SearchResult/index.js
  2. 4
      src/components/Navbar/index.js
  3. 28
      src/components/OverLayer/index.js
  4. 65
      src/components/Product/index.js
  5. 20
      src/components/Search/index.js
  6. 191
      src/components/VerticalExpandableProductFilter/index.js
  7. 36
      src/components/VodProduct/index.js
  8. 2
      src/redux/actions/public.js
  9. 3
      src/redux/reducers/public.js
  10. 11
      src/router.js
  11. 2
      src/utils/comments.js
  12. 0
      src/utils/filter.js
  13. 4
      src/views/Home/Desktop/Part2/index.js
  14. 2
      src/views/Home/Desktop/Part4/index.js
  15. 4
      src/views/Home/Desktop/SalesContainer/index.js
  16. 3
      src/views/Products/index.js
  17. 180
      src/views/Products/layouts/Main.js
  18. 84
      src/views/Products/layouts/Sidebar.js

@ -38,12 +38,11 @@ export const SearchResult = ({ text, books, setText }) => {
return ( return (
<div <div
className="w-full list-none relative" className="w-full list-none relative z-50"
// style={{ height: 300 }}
> >
<div <div
onClick={(e) => e.stopPropagation()} onClick={(e) => e.stopPropagation()}
className="absolute -top-1 w-full left-0 px-6 pt-5 bg-white pb-5 shadow-lg rounded-md flex flex-col overflow-y-scroll" className="absolute -top-1 w-full left-0 px-6 pt-5 bg-white pb-5 shadow-lg rounded-md flex flex-col overflow-y-scroll z-50"
style={{ maxHeight: "calc(100vh / 1.5)", direction : 'ltr' }} style={{ maxHeight: "calc(100vh / 1.5)", direction : 'ltr' }}
> >
<header className="w-full flex flex-row-reverse items-center gap-4"> <header className="w-full flex flex-row-reverse items-center gap-4">
@ -98,7 +97,7 @@ export const SearchResult = ({ text, books, setText }) => {
</Link> </Link>
))} ))}
</ul> </ul>
) : <span style={{direction: "rtl"}} className="text-blueC0 text-sm text-right py-4 font-semibold">هیچ محصولی یافت نشد.</span>} ) : <span style={{direction: "rtl"}} className="text-blueC0 text-sm text-right py-4 font-semibold">هیچ صفحه ای موجود نیست</span>}
</div> </div>
</div> </div>
); );

@ -6,6 +6,7 @@ import _ from "lodash";
import Drawer from "../Drawer"; import Drawer from "../Drawer";
import Search from "../Search"; import Search from "../Search";
import SearchResult from "./SearchResult"; import SearchResult from "./SearchResult";
import OverLayer from "../OverLayer";
//assets //assets
import cartIcon from "./cart-blue.svg"; import cartIcon from "./cart-blue.svg";
// import whiteCartIcon from "./white-cart-icon.svg"; // import whiteCartIcon from "./white-cart-icon.svg";
@ -242,8 +243,9 @@ function Navbar({
className="hidden lg:flex items-center w-3/5 justify-around flex-1 absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2" className="hidden lg:flex items-center w-3/5 justify-around flex-1 absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2"
style={{ maxWidth: "calc(100vw / 2)" }} style={{ maxWidth: "calc(100vw / 2)" }}
></div> ></div>
<OverLayer />
<div <div
className="flex flex-col w-full absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2" className="flex flex-col w-full absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 z-50 rounded-md"
style={{ maxWidth: "calc(100vw / 3)" }} style={{ maxWidth: "calc(100vw / 3)" }}
> >
<Search onChange={(val) => setSearch(val)} /> <Search onChange={(val) => setSearch(val)} />

@ -0,0 +1,28 @@
import React from "react";
import { connect } from "react-redux";
import { publicApi } from "../../redux/actions";
export const OverLayer = ({ setOverLayer, overLayer }) => {
const click = (e) => {
setOverLayer(false);
e.stopPropagation();
};
return (
overLayer && (
<div
className="z-20 w-screen h-full fixed top-0 right-0 backdrop-filter blur-sm bg-opacity-60 bg-gray-600"
onClick={(e) => click(e)}
></div>
)
);
};
const mapStateToProps = (state) => ({
overLayer: state.publicApi.overLayer,
});
const mapDispatchToProps = {
setOverLayer: publicApi.setOverLayer,
};
export default connect(mapStateToProps, mapDispatchToProps)(OverLayer);

@ -1,5 +1,5 @@
import React, { useState } from "react"; import React, { useState } from "react";
import {connect} from 'react-redux'; import { connect } from "react-redux";
import StarRating from "../StarRating"; import StarRating from "../StarRating";
// import Tag from "../Tag"; // import Tag from "../Tag";
@ -46,14 +46,15 @@ const ProductDesign = ({
productHolderHoverBorder, productHolderHoverBorder,
hoverMode, hoverMode,
starRate, starRate,
imageSize
}) => { }) => {
const [isHovering, setIsHovering] = useState(false); const [isHovering, setIsHovering] = useState(false);
return ( return (
<div <div
className={`flex flex-wrap sm:flex-nowrap justify-around`} className={`flex flex-wrap sm:flex-nowrap justify-around`}
style={{ direction : 'rtl' }} style={{ direction: "rtl" }}
> >
<div className="w-full flex flex-wrap items-center justify-around my-5 px-4"> <div className="w-full flex flex-wrap items-center justify-around px-4">
<div <div
className={`w-full sm:w-60 md:w-72 rounded-lg transition-all p-2 my-3 ${productHolderBorder} ${ className={`w-full sm:w-60 md:w-72 rounded-lg transition-all p-2 my-3 ${productHolderBorder} ${
hoverMode == "blue" ? "hover:bg-grayF4" : null hoverMode == "blue" ? "hover:bg-grayF4" : null
@ -85,56 +86,26 @@ const ProductDesign = ({
</div> </div>
{/* img */} {/* img */}
<div <div
className={`w-full flex bg-grayF4 p-0 justify-center rounded-lg`} className={`w-11/12 flex bg-grayF4 p-0 justify-center rounded-lg`}
> >
{verticalImg && ( {verticalImg && (
<img <img
src={`https://dnvn.ir/api/v1/file/${product.fileIds}`} src={`https://dnvn.ir/api/v1/file/${product.fileIds}`}
alt="" alt=""
className="rounded-lg cursor-pointer py-5" className="rounded-lg cursor-pointer py-5"
style={{height : 'calc(100vw / 5.1)', width : 'calc(100% - 75px)'}} style={{
height: `calc(100vh / ${imageSize})`,
width: `calc(100vh / ${imageSize} * 2 / 3.5)`,
}}
/> />
)} )}
</div> </div>
{/* select Color */}
{/* {colors && (
<div className="flex items-center absolute right-2 bottom-2">
<img
src={YellowDotIcon}
alt=""
data-tip="زرد"
className="w-3 h-3 ml-1 cursor-pointer"
/>
<ReactTooltip place="top" type="dark" effect="float" />
<img
src={RedDotIcon}
alt=""
data-tip="قرمز"
className="w-3 h-3 ml-1 cursor-pointer"
/>
<ReactTooltip place="top" type="dark" effect="float" />
<img
src={PurpleDotIcon}
alt=""
data-tip="بنفش"
className="w-3 h-3 ml-1 cursor-pointer"
/>
<ReactTooltip place="top" type="dark" effect="float" />
<img
src={LightBlueDotIcon}
alt=""
data-tip="آبی"
className="w-3 h-3 ml-1 cursor-pointer"
/>
<ReactTooltip place="top" type="dark" effect="float" />
</div>
)} */}
</div> </div>
{/* product content */} {/* product content */}
<div className="px-2"> <div className="px-2">
<div className="mt-4"> <div className="mt-4">
<h2 <h2
className={`leading-4 text-xl font-black py-2 ${productTitleColor} ${productTitleAlignment}`} className={`leading-5 text-base 2xl:text-tiny font-normal py-2 text-right ${productTitleColor}`}
> >
{product?.product[1]?.name} {product?.product[1]?.name}
</h2> </h2>
@ -148,9 +119,9 @@ const ProductDesign = ({
)} )}
{productCat && ( {productCat && (
<span <span
className={`text-md py-1 font-light ${productCatTextColor}`} className={`text-sm py-1 font-normal ${productCatTextColor}`}
> >
{grades[product.gradeId]} {"پایه" + " " + grades[product.gradeId]}
</span> </span>
)} )}
</div> </div>
@ -158,15 +129,15 @@ const ProductDesign = ({
{star && ( {star && (
<div className="flex items-center mt-3"> <div className="flex items-center mt-3">
<StarRating value={starRate} /> <StarRating value={starRate} />
<span className="text-xs text-productContent font-bold text-gray-500 mr-2"> {/* <span className="text-xs text-productContent font-bold text-gray-500 mr-2">
بر اساس {numberOfRegards} بررسی بر اساس {numberOfRegards} بررسی
</span> </span> */}
</div> </div>
)} )}
{/* price */} {/* price */}
{priceHolder && ( {priceHolder && (
<div <div
className={`flex items-center justify-between ${priceDirection}`} className={`flex items-center justify-between mt-2 ${priceDirection}`}
> >
<div className="mt-2"> <div className="mt-2">
<div <div
@ -186,7 +157,7 @@ const ProductDesign = ({
</p> </p>
)} )}
</div> </div>
<p className="text-xl text-productPrice font-semibold inline text-blue5F"> <p className="text-lg text-productPrice font-semibold inline text-blue5F">
{product?.product[1]?.price} <span>تومان</span> {product?.product[1]?.price} <span>تومان</span>
</p> </p>
</div> </div>
@ -237,8 +208,8 @@ const ProductDesign = ({
}; };
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
grades : state.publicApi.grades, grades: state.publicApi.grades,
}) });
export default connect(mapStateToProps)(ProductDesign); export default connect(mapStateToProps)(ProductDesign);

@ -1,4 +1,6 @@
import React from "react"; import React from "react";
import {connect} from 'react-redux';
import { publicApi } from "../../redux/actions";
import _ from "lodash"; import _ from "lodash";
import searchIcon from "./search.png"; import searchIcon from "./search.png";
@ -6,9 +8,9 @@ const langDetector = (lang = 'fa', option1, option2) => {
return lang === "fa" ? option1 : option2; return lang === "fa" ? option1 : option2;
}; };
export default function Search(props) { function Search(props) {
return ( return (
<div className="flex items-center justify-center w-full my-3"> <div className="flex items-center justify-center w-full my-3 bg-white z-50 overflow-hidden rounded-md">
<div className="relative text-gray-600 focus-within:text-gray-400 w-full"> <div className="relative text-gray-600 focus-within:text-gray-400 w-full">
<span className={_.join(["absolute inset-y-0 flex items-center pl-2", langDetector(props.lang, "left-0", "right-0")], " ")}> <span className={_.join(["absolute inset-y-0 flex items-center pl-2", langDetector(props.lang, "left-0", "right-0")], " ")}>
<button <button
@ -21,12 +23,24 @@ export default function Search(props) {
<input <input
type="search" type="search"
name={props.name} name={props.name}
className="w-full py-3 text-sm lg:text-tiny lg:font-semibold text-gray1 border border-solid border-gray-200 rounded-md pr-5 pl-14 outline-none focus:ring-1 focus:text-gray-900 " className="z-50 w-full py-3 text-sm lg:text-tiny lg:font-semibold text-gray1 border border-solid border-gray-200 rounded-md pr-5 pl-14 outline-none focus:ring-1 focus:text-gray-900 "
placeholder={_.join([langDetector(props.lang , "جستجو...", "Search...")], " ")} placeholder={_.join([langDetector(props.lang , "جستجو...", "Search...")], " ")}
autoComplete="off" autoComplete="off"
onChange={(e) => props.onChange(e.target.value)} onChange={(e) => props.onChange(e.target.value)}
onFocus={() => props.setOverLayer(true)}
onBlur={() => props.setOverLayer(false)}
/> />
</div> </div>
</div> </div>
); );
} }
const mapStateToProps = (state) => ({
})
const mapDispatchToProps = {
setOverLayer : publicApi.setOverLayer
}
export default connect(mapStateToProps, mapDispatchToProps)(Search);

@ -12,69 +12,75 @@ export default function VerticalExpandableProductFilter(props) {
const [text, setText] = useState(""); const [text, setText] = useState("");
const [searchResult, setSearchResult] = useState([]); const [searchResult, setSearchResult] = useState([]);
const [checkedBox, setChecked] = useState([]); const [checkedBox, setChecked] = useState([]);
const name = props.name||Math.random() const name = props.name || Math.random();
useEffect(() => { // useEffect(() => {
let fakeSearchResult; // let fakeSearchResult;
fakeSearchResult = props.list.filter( // fakeSearchResult = props.list.filter(
(item1) => item1.name.indexOf(text) !== -1 // (item1) => item1.name.indexOf(text) !== -1
); // );
setSearchResult(fakeSearchResult); // setSearchResult(fakeSearchResult);
}, [text]); // }, [text]);
return ( return (
<div className="flex flex-col w-full border border-solid border-gray-100 rounded-md pt-6 bg-transparent max-h-screen bg-white my-3"> <div className="flex flex-col w-full border border-solid border-gray-100 rounded-md pt-6 bg-transparent max-h-screen bg-white my-3">
<strong className="text-md text-gray-500 w-full mb-3 text-right px-3"> <strong className="text-md text-gray-500 w-full mb-3 text-right px-3">
{props.title} {props.title}
</strong> </strong>
{props.searchAble && <form className="relative w-full px-3 mb-3"> {props.searchAble && (
<input <form className="relative w-full px-3 mb-3">
type="text" <input
placeholder={_.join( type="text"
[langDetector(props.lang, "جستجو...", "Search...")], placeholder={_.join(
" " [langDetector(props.lang, "جستجو...", "Search...")],
)} " "
className="border rounded-md py-1 px-2 w-full placeholder-gray-300 outline-none text-gray-500" )}
onChange={(e) => setText(e.target.value)} className="border rounded-md py-1 px-2 w-full placeholder-gray-300 outline-none text-gray-500"
/> onChange={(e) => setText(e.target.value)}
<span />
className={_.join( <span
[ className={_.join(
"absolute inset-y-0 flex items-center", [
langDetector(props.lang, "left-4", "right-4"), "absolute inset-y-0 flex items-center",
], langDetector(props.lang, "left-4", "right-4"),
" " ],
)} " "
> )}
<button
type="submit"
className="p-1 focus:outline-none focus:shadow-outline"
> >
<img src={searchIcon} className="w-5 h-5" alt="" /> <button
</button> type="submit"
</span> className="p-1 focus:outline-none focus:shadow-outline"
</form>} >
<ul className="w-full list-none flex flex-col divide-y divide-gray-100"> <img src={searchIcon} className="w-5 h-5" alt="" />
</button>
</span>
</form>
)}
<ul className="w-full list-none flex flex-col divide-y divide-gray-100 overflow-y-scroll" style={{maxHeight: 'calc(100vh / 3.5)', minHeight: 200}}>
{(searchResult.length > 0 ? searchResult : props.list)?.map( {(searchResult.length > 0 ? searchResult : props.list)?.map(
(item1, i) => ( (item1, i) => (
<li <li
key={i} key={i}
className="hover:bg-gray-100 px-3 flex flex-row items-center justify-between py-2" className="hover:bg-gray-100 px-3 flex flex-row items-center justify-between py-2"
> >
{/* {console.log(i)} */} {/* {console.log(i)} */}
<div className="flex flex-row items-center"> <div className="flex flex-row items-center">
<Checkbox name={`ch${name}_${i}`} checked={checkedBox[i]} onclick={(e) => { <Checkbox
checkedBox[i] = !checkedBox[i] name={`ch${name}_${i}`}
setChecked(checkedBox) checked={false}
onclick={(e) => {
checkedBox[i] = !checkedBox[i];
}} onChange={() => props.onChange(name , item1.name)} /> setChecked(checkedBox);
}}
onChange={() => props.onChange(name, item1.name)}
/>
<strong className="text-xs font-light text-gray-500"> <strong className="text-xs font-light text-gray-500">
{props.preName ? props.preName + ' ' + item1.name : item1.name} {props.preName
? props.preName + " " + item1.name
: item1}
</strong> </strong>
</div> </div>
{item1.subList?.length > 0 && ( {item1?.subList?.length > 0 && (
<img <img
src={arrowIcon} src={arrowIcon}
alt="" alt=""
@ -91,92 +97,17 @@ export default function VerticalExpandableProductFilter(props) {
) )
)} )}
</ul> </ul>
{props.btnTitle && <div className="flex align-center justify-center"> {props.btnTitle && (
<button className="my-4 bg-blueFFOP text-sm bg-opacity-40 transition-all w-4/5 py-3 px-6 rounded text-blueC0 hover:text-white hover:bg-blueC0" onClick={props.btnClicked}>{props.btnTitle}</button> <div className="flex align-center justify-center">
</div>} <button
className="my-4 bg-blueFFOP text-sm bg-opacity-40 transition-all w-4/5 py-3 px-6 rounded text-blueC0 hover:text-white hover:bg-blueC0"
onClick={props.btnClicked}
>
{props.btnTitle}
</button>
</div>
)}
</div> </div>
); );
} }
VerticalExpandableProductFilter.defaultProps = {
list: [
{
id: 0,
name: "وسایل آشپزخانه",
expaneded: false,
subList: [],
},
{
id: 3,
name: "ماشین و موتور سیکلت",
expaneded: false,
subList: [
{
id: 4,
name: "ماشین",
},
{
id: 5,
name: "موتور",
},
],
},
{
id: 6,
name: "اتاق خواب",
expaneded: false,
subList: [
{
id: 7,
name: "کمد",
},
{
id: 8,
name: "تخت خواب",
},
],
},
{
id: 9,
name: "دکوراسیون و چیدمان",
expaneded: false,
subList: [],
},
{
id: 10,
name: "وسایل بهداشت شخصی",
expaneded: false,
subList: [
{
id: 11,
name: "مسواک",
},
{
id: 12,
name: "حوله",
},
],
},
{
id: 13,
name: "وسایل بهداشت شخصی",
expaneded: false,
subList: [
{
id: 14,
name: "مسواک",
},
{
id: 15,
name: "حوله",
},
],
},
{
id: 16,
name: "وسایل بهداشت شخصی",
expaneded: false,
subList: [],
},
],
};

@ -4,13 +4,12 @@ import StarRating from "../StarRating";
import ReactTooltip from "react-tooltip"; import ReactTooltip from "react-tooltip";
//assets //assets
import videoImage1 from './videoImages/image-1.svg'; import videoImage1 from "./videoImages/image-1.svg";
import videoImage2 from './videoImages/image-2.svg'; import videoImage2 from "./videoImages/image-2.svg";
import videoImage3 from './videoImages/image-3.svg'; import videoImage3 from "./videoImages/image-3.svg";
import videoImage4 from './videoImages/image-4.svg'; import videoImage4 from "./videoImages/image-4.svg";
import videoImage5 from './videoImages/image-5.svg'; import videoImage5 from "./videoImages/image-5.svg";
import videoImage6 from './videoImages/image-6.svg'; import videoImage6 from "./videoImages/image-6.svg";
import watermelon from "./watermelon.png"; import watermelon from "./watermelon.png";
import video from "./danovin.mp4"; import video from "./danovin.mp4";
@ -22,7 +21,14 @@ import PurpleDotIcon from "./purpleDotIcon.svg";
import LightBlueDotIcon from "./lightBlueDotIcon.svg"; import LightBlueDotIcon from "./lightBlueDotIcon.svg";
import whitePlayIcon from "./white-play-button-icon.svg"; import whitePlayIcon from "./white-play-button-icon.svg";
const videoImages = [videoImage1, videoImage2, videoImage3, videoImage4,videoImage5, videoImage6]; const videoImages = [
videoImage1,
videoImage2,
videoImage3,
videoImage4,
videoImage5,
videoImage6,
];
const VodProduct = ({ const VodProduct = ({
index, index,
@ -50,7 +56,8 @@ const VodProduct = ({
productTitle, productTitle,
poster, poster,
price, price,
minHeight height,
// minHeight,
}) => { }) => {
const [progressFlag, setProgressFlag] = useState(false); const [progressFlag, setProgressFlag] = useState(false);
// const [openModal, setOpenModal] = useState(false); // const [openModal, setOpenModal] = useState(false);
@ -64,8 +71,8 @@ const VodProduct = ({
return ( return (
<> <>
{/* product UI Design */} {/* product UI Design */}
<div className="flex flex-wrap sm:flex-nowrap justify-around"> <div className="flex flex-wrap sm:flex-nowrap justify-around" style={{direction: 'rtl'}}>
<div className="w-full flex flex-wrap items-center justify-around my-10 px-1 sm:px-4"> <div className="w-full flex flex-wrap items-center justify-around my-3 px-1 sm:px-4">
<div <div
className={`w-full mx-1 sm:w-60 md:w-96 rounded-lg shadow-sm p-2 my-3 border border-grayBorderColor`} className={`w-full mx-1 sm:w-60 md:w-96 rounded-lg shadow-sm p-2 my-3 border border-grayBorderColor`}
> >
@ -76,12 +83,13 @@ const VodProduct = ({
backgroundImage: `url(${videoImages[Number(index)]})`, backgroundImage: `url(${videoImages[Number(index)]})`,
backgroundSize: "100% 100%", backgroundSize: "100% 100%",
backgroundRepeat: "no-repeat", backgroundRepeat: "no-repeat",
minHeight: minHeight, height : height
// minHeight: minHeight,
}} }}
data-modal-toggle="large-modal" data-modal-toggle="large-modal"
> >
{/* icons on image */} {/* icons on image */}
<div className="absolute left-6 top-2"> <div className="absolute left-2 top-1">
{discountPricePercent && ( {discountPricePercent && (
<div className="bg-discountPriceBg rounded-md px-2 py-2 mt-2 transition ease-in-out duration-300 transform hover:-translate-y-1 hover:scale-110 cursor-pointer bg-white bg-opacity-70"> <div className="bg-discountPriceBg rounded-md px-2 py-2 mt-2 transition ease-in-out duration-300 transform hover:-translate-y-1 hover:scale-110 cursor-pointer bg-white bg-opacity-70">
<p className="text-discountPriceTitle font-bold text-xs"> <p className="text-discountPriceTitle font-bold text-xs">
@ -114,7 +122,7 @@ const VodProduct = ({
</div> </div>
{/* select Color */} {/* select Color */}
{productColor && ( {productColor && (
<div className="flex items-center absolute right-6 bottom-2"> <div className="flex items-center absolute right-2 bottom-3">
{/* {colors.map((color,index))} */} {/* {colors.map((color,index))} */}
<img <img
src={YellowDotIcon} src={YellowDotIcon}

@ -1,5 +1,7 @@
import proxy from "../proxy"; import proxy from "../proxy";
const publicApi = { const publicApi = {
setOverLayer: (data) => async (dispatch) =>
await dispatch({ type: "public/setOverLayer", data }),
setDesktopContentTransform: (data) => async (dispatch) => setDesktopContentTransform: (data) => async (dispatch) =>
await dispatch({ type: "public/setDesktopContentTransform", data }), await dispatch({ type: "public/setDesktopContentTransform", data }),
setHeaderOptions: (data) => async (dispatch) => setHeaderOptions: (data) => async (dispatch) =>

@ -61,6 +61,7 @@ const initialState = {
title: false, title: false,
}, },
desktopContentTransform: false, desktopContentTransform: false,
overLayer: false,
}; };
const grades = [ const grades = [
@ -82,6 +83,8 @@ const grades = [
export default function publicApi(state = initialState, action) { export default function publicApi(state = initialState, action) {
let { type, data } = action; let { type, data } = action;
switch (type) { switch (type) {
case "public/setOverLayer":
return { ...state, overLayer: data };
case "public/setDesktopContentTransform": case "public/setDesktopContentTransform":
return { ...state, desktopContentTransform: data }; return { ...state, desktopContentTransform: data };
case "public/setHeaderOptions": case "public/setHeaderOptions":

@ -27,7 +27,7 @@ import Faq from "./views/Faq";
import Contact from "./views/Contact"; import Contact from "./views/Contact";
import Dashboard from "./views/Dashboard"; import Dashboard from "./views/Dashboard";
import FooterDesign1 from "./components/Footer"; import FooterDesign1 from "./components/Footer";
import Bugs from './views/BugsAndProblems'; import Bugs from "./views/BugsAndProblems";
// import VideoTube from "./views/Home/VideoTube"; // import VideoTube from "./views/Home/VideoTube";
function Router({ function Router({
@ -352,14 +352,7 @@ function Router({
/> />
} }
/> />
<Route <Route path="/bugs" exact element={<Bugs />} />
path="/bugs"
exact
element={
<Bugs
/>
}
/>
<Route <Route
path="*" path="*"
exact exact

@ -1,3 +1,5 @@
export const connectToParent = (list) => { export const connectToParent = (list) => {
let comments = []; let comments = [];
for (let item of list) { for (let item of list) {

@ -51,7 +51,7 @@ const Part2 = ({ books, grades }) => {
{books.length > 0 && ( {books.length > 0 && (
<div className="relative w-full" style={{ direction: "ltr" }}> <div className="relative w-full" style={{ direction: "ltr" }}>
<Carousel <Carousel
show={4.5} show={Math.round(window.innerWidth / 350)}
slide={2} slide={2}
swiping={true} swiping={true}
useArrowKeys={true} useArrowKeys={true}
@ -72,7 +72,7 @@ const Part2 = ({ books, grades }) => {
} }
> >
{books.map((product, index) => ( {books.map((product, index) => (
<Product key={index} product={product} /> <Product key={index} product={product} imageSize={3} />
))} ))}
</Carousel> </Carousel>
</div> </div>

@ -102,7 +102,7 @@ const Part4 = () => {
discountPrice={false} discountPrice={false}
key={index} key={index}
index={index} index={index}
minHeight={"calc(100vh / 3.5)"} height={"calc(100vh / 3.8)"}
/> />
</Link> </Link>
</li> </li>

@ -40,7 +40,7 @@ const SalesContainer = ({ books }) => {
{books.length > 0 && ( {books.length > 0 && (
<div className="relative w-full" style={{ direction: "ltr" }}> <div className="relative w-full" style={{ direction: "ltr" }}>
<Carousel <Carousel
show={window.innerWidth / 350} show={Math.round(window.innerWidth / 350)}
slide={2} slide={2}
swiping={true} swiping={true}
useArrowKeys={true} useArrowKeys={true}
@ -63,7 +63,7 @@ const SalesContainer = ({ books }) => {
} }
> >
{books.map((product, index) => ( {books.map((product, index) => (
<Product key={index} product={product} /> <Product key={index} product={product} imageSize={3} />
))} ))}
</Carousel> </Carousel>
</div> </div>

@ -162,9 +162,8 @@ export const Products = ({
) : ( ) : (
<div <div
className={`w-full flex flex-row gap-10 px-5 overflow-y-hidden mt-3 justify-center`} className={`w-full flex flex-row gap-10 px-5 overflow-y-hidden mt-3 justify-center`}
// style={{ height: 1500 }}
> >
<div className="w-11/12 flex"> <div className="w-11/12 flex flex-row gap-5">
<Sidebar onChange={onChange}/> <Sidebar onChange={onChange}/>
<Main filter={filter}/> <Main filter={filter}/>
</div> </div>

@ -1,18 +1,17 @@
import React, { useState, useEffect, useCallback } from "react"; import React, { useState, useEffect, useCallback } from "react";
import ScrollContainer from "react-indiana-drag-scroll"; import { connect } from "react-redux";
import { connect } from 'react-redux';
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import filterIcon from '../../../assets/images/vuesax-linear-filter-tick.svg'; import { Carousel } from "@trendyol-js/react-carousel";
import Product from '../../../components/Product' import filterIcon from "../../../assets/images/vuesax-linear-filter-tick.svg";
import Product from "../../../components/Product";
import VodProduct from "../../../components/VodProduct"; import VodProduct from "../../../components/VodProduct";
import { book, publicApi } from "../../../redux/actions"; import { book, publicApi } from "../../../redux/actions";
import posterImage from "../../../assets/images/poster.svg"; import posterImage from "../../../assets/images/poster.svg";
import arrow from "../../../assets/icons/slider-arrow.svg";
export const Main = ({
export const Main = ({ isMobile,
books, books,
getList,
grades, grades,
gradeFilter, gradeFilter,
selectedGrade, selectedGrade,
@ -20,28 +19,30 @@ export const Main = ({ isMobile,
setHeaderOptions, setHeaderOptions,
headerOptions, headerOptions,
videos, videos,
filter }) => { filter,
useEffect(() => { }) => {
window.scrollTo(0, 0) useEffect(() => {
}, []) window.scrollTo(0, 0);
}, []);
const filteringNavItems = [ const filteringNavItems = [
{ {
title: 'بیشترین بازدید' title: "بیشترین بازدید",
}, },
{ {
title: 'پرفروش ترین' title: "پرفروش ترین",
}, },
{ {
title: 'کمترین قیمت' title: "کمترین قیمت",
}, },
{ {
title: 'بیشترین قیمت' title: "بیشترین قیمت",
}, },
{ {
title: 'محبوب ترین' title: "محبوب ترین",
}, },
]; ];
const videosData = [ const videosData = [
{ {
id: 0, id: 0,
@ -82,34 +83,52 @@ export const Main = ({ isMobile,
grade: "پایه چهارم", grade: "پایه چهارم",
imageUrl: "https://dnvn.ir/api/v1/file/2105", imageUrl: "https://dnvn.ir/api/v1/file/2105",
poster: posterImage, poster: posterImage,
} },
] ];
return <div className="flex flex-col w-3/4 p-4"> return (
<div className="flex w-full bg-blue rounded-lg border border-solid border-gray-200 p-2 items-center my-1.5 justify-center text-blue52"> <div className="flex flex-col w-3/4 p-4 pb-20">
<div className='flex text-xs items-center mx-4'> <div className="flex w-full bg-blue rounded-lg border border-solid border-gray-200 p-2 items-center my-1.5 justify-center text-blue52">
<img src={filterIcon} /> <div className="flex text-xs items-center mx-4">
<span> <img src={filterIcon} />
مرتب سازی بر اساس <span>مرتب سازی بر اساس</span>
</span> </div>
<ul className="flex justify-between w-3/4 px-4 py-0 ">
{filteringNavItems.map((e) => (
<li
className="text-sm rounded py-2 px-6 transition-all duration-700 hover:bg-gray-300 hover:text-blueC0 cursor-pointer"
onClick={() => console.log("a")}
>
{e.title}
</li>
))}
</ul>
</div> </div>
<ul className='flex justify-between w-3/4 px-4 py-0 '>
{
filteringNavItems.map(e => (
<li className='text-sm rounded py-2 px-6 transition-all duration-700 hover:bg-gray-300 hover:text-blueC0 cursor-pointer' onClick={() => console.log('a')}>{e.title}</li>
))
}
</ul>
</div>
<ScrollContainer className="flex"> <div className="relative w-full" style={{ direction: "ltr" }}>
{ <Carousel
videosData.map((video, index) => ( show={Math.round(window.innerWidth / 500)}
<Link slide={2}
to={"/videos/" + video.id} swiping={true}
className="flex flex-col rounded-md ml-4 " useArrowKeys={true}
transition={0.5}
> className="flex flex-row"
<VodProduct 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=""
/>
}
>
{videosData.map((video, index) => (
<VodProduct
productTitle={`دوره ی ویدیویی ${video.name}`} productTitle={`دوره ی ویدیویی ${video.name}`}
productCat={video.grade} productCat={video.grade}
price={video.price} price={video.price}
@ -117,73 +136,60 @@ export const Main = ({ isMobile,
discountPrice={false} discountPrice={false}
key={index} key={index}
index={index} index={index}
minHeight={"250px"} height={"calc(100vh / 5)"}
/> />
</Link> ))}
)) </Carousel>
} </div>
</ScrollContainer>
<div className="w-full flex flex-row flex-wrap mt-0 border-t-2 border-solid border-gray-100 overflow-y-hidden justify-between"> <div className="w-full flex flex-row flex-wrap mt-0 border-t-2 border-solid border-gray-100 overflow-y-hidden justify-evenly">
{selectedGrade {selectedGrade
? gradeFilterBooks?.map((product, index) => ( ? gradeFilterBooks?.map((product, index) => (
<Product
key={index}
productsType={filter.productsType}
product={product}
index={Number(index)}
grades={grades}
roductName={`کتاب ${product?.name}`}
productCat={`پایه ${grades[product?.gradeId]}`}
productPrice={100000}
productImg={"https://dnvn.ir/api/v1/file/" + product?.fileIds}
numberOfRegards={160}
productTitleColor='text-blue5F'
productCatTextColor='text-blueC0'
productHolderBorder=''
productHolderHoverBorder='shadow-md'
starRate={Math.floor(Math.random() * 5) + 1}
/>
))
: books?.map((product, index) => (
<Link to={"/products/" + product?.id}>
<Product <Product
key={index} key={index}
productsType={filter.productsType} productsType={filter.productsType}
product={product} product={product}
index={Number(index)} index={Number(index)}
productName={`کتاب ${product?.name}`} grades={grades}
roductName={`کتاب ${product?.name}`}
productCat={`پایه ${grades[product?.gradeId]}`} productCat={`پایه ${grades[product?.gradeId]}`}
productPrice={100000} productPrice={100000}
productImg={"https://dnvn.ir/api/v1/file/" + product?.fileIds} productImg={"https://dnvn.ir/api/v1/file/" + product?.fileIds}
numberOfRegards={160} numberOfRegards={160}
productTitleColor='text-blue5F' productTitleColor="text-blue5F"
productCatTextColor='text-blueC0' productCatTextColor="text-blueC0"
productHolderBorder='' productHolderBorder=""
productHolderHoverBorder='shadow-md' productHolderHoverBorder="shadow-md"
starRate={Math.floor(Math.random() * 5) + 2} starRate={Math.floor(Math.random() * 5) + 1}
imageSize={4.5}
/> />
</Link> ))
))} : books?.map((product, index) => (
<Link
to={"/products/" + product?.id}
className="w-full lg:w-1/3 xl:w-1/4 2xl:w-1/5"
>
<Product
product={product}
index={Number(index)}
imageSize={4.5}
/>
</Link>
))}
</div> </div>
</div>
</div>; );
}; };
Main.defaultProps ={ Main.defaultProps = {
videos: [ videos: [],
};
]
}
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
isDark: state.publicApi.isDark, isDark: state.publicApi.isDark,
isMobile: state.publicApi.isMobile, isMobile: state.publicApi.isMobile,
books: state.book.list, books: state.book.list,
grades: state.publicApi.grades, grades: state.publicApi.grades,
gradeFilterBooks: state.book.gradeFilterBooks,
selectedGrade: state.book.selectedGrade,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {

@ -3,69 +3,33 @@ import { connect } from "react-redux";
import Checkbox from "../../../components/Checkbox"; import Checkbox from "../../../components/Checkbox";
import VerticalExpandableProductFilter from "../../../components/VerticalExpandableProductFilter"; import VerticalExpandableProductFilter from "../../../components/VerticalExpandableProductFilter";
export const Sidebar = ({onChange}) => { export const Sidebar = ({ onChange, grades }) => {
const filteronGrade = [
{
id:0,
name: "اول",
expaneded: false,
subList: [{
id:1,
name: 'علوم اجتماعی'
}],
},
{
id:1,
name: "دوم",
expaneded: false,
subList: [{
id:1,
name: 'علوم اجتماعی'
}],
},
{
id:2,
name: "سوم",
expaneded: false,
subList: [],
},
];
const categories = [ const categories = [
{ "کتاب فیزیکی",
id: 0, "کتاب دیجیتال",
expaneded: false, "دوره ویدیویی",
name: 'کتاب فیزیکی', "بسته های آموزشی",
subList: [] ];
}, return (
{ <div className="flex flex-col w-1/4 p-4">
id: 1, <VerticalExpandableProductFilter
expaneded: false, onChange={onChange}
name: 'کتاب دیجیتال', name="grade"
subList: [] list={Object.values(grades)}
}, title="پایه تحصیلی"
{ />
id: 2, <VerticalExpandableProductFilter
expaneded: false, name="category"
name: 'دوره ویدیویی', list={categories}
subList: [] title="دسته بندی"
}, />
{ </div>
id: 3, );
expaneded: false,
name: 'بسته های آموزشی',
subList: []
},
]
return <div className="flex flex-col w-1/4 p-4">
<VerticalExpandableProductFilter onChange={onChange} name="grade" preName='پایه' btnTitle='مشاهده همه ی کالاهای آموزشی' list={filteronGrade} title="پایه تحصیلی" searchAble={true}/>
<VerticalExpandableProductFilter name="category" list={categories} title="دسته بندی" searchAble={false}/>
</div>;
}; };
const mapStateToProps = (state) => ({}); const mapStateToProps = (state) => ({
grades: state.publicApi.grades,
});
const mapDispatchToProps = {}; const mapDispatchToProps = {};

Loading…
Cancel
Save