reza fixed mobile products bug

temp
Reza_ashrafi 3 years ago
parent 5b9c20a9f6
commit c6a7b91097
  1. 2
      src/components/Select/index.js
  2. 6
      src/redux/reducers/book.js
  3. 19
      src/redux/reducers/public.js
  4. 6
      src/views/Dashboard/layouts/Mobile/ProfileAddress/index.js
  5. 17
      src/views/Products/layouts/Mobile/Header.js
  6. 8
      src/views/Products/layouts/Mobile/Main.js

@ -22,7 +22,7 @@ function Select({
defaultValue={defaultValue} defaultValue={defaultValue}
> >
{options.map((option, index) => ( {options.map((option, index) => (
<option key={index} className=""> <option key={index} className="text-sm lg:text-tiny">
{option} {option}
</option> </option>
))} ))}

@ -16,7 +16,11 @@ const initialState = {
sortFilterCourse: null, sortFilterCourse: null,
selectedGrade: null, selectedGrade: null,
selectedSort: "پربازدید ترین ها", selectedSort: "پربازدید ترین ها",
productTypes: [ productTypes:
window.innerWidth >= 1024
? ["کتاب فیزیکی", "کتاب دیجیتال", "دوره ویدئویی", "بسته های آموزشی"]
: [
"نوع محصول",
"کتاب فیزیکی", "کتاب فیزیکی",
"کتاب دیجیتال", "کتاب دیجیتال",
"دوره ویدئویی", "دوره ویدئویی",

@ -41,7 +41,9 @@ const initialState = {
activeCategory: null, activeCategory: null,
categories: null, categories: null,
bookSection: null, bookSection: null,
grades: { grades:
window.innerWidth >= 1024
? {
0: "پیش دبستان", 0: "پیش دبستان",
1: "اول", 1: "اول",
2: "دوم", 2: "دوم",
@ -55,6 +57,21 @@ const initialState = {
10: "دهم", 10: "دهم",
11: "یازدهم", 11: "یازدهم",
12: "دوازدهم", 12: "دوازدهم",
}
: {
0: "پایه تحصیلی",
1: "اول",
2: "دوم",
3: "سوم",
4: "چهارم",
5: "پنجم",
6: "ششم",
7: "هفتم",
8: "هشتم",
9: "نهم",
10: "دهم",
11: "یازدهم",
12: "دوازدهم",
}, },
headerOptions: { headerOptions: {
shown: false, shown: false,

@ -1,6 +1,6 @@
import React from "react"; import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { userAddress, userFactor } from "../../../../../redux/actions"; import { userAddress, userFactor, publicApi } from "../../../../../redux/actions";
import { Link, useNavigate } from "react-router-dom"; import { Link, useNavigate } from "react-router-dom";
//components //components
@ -19,6 +19,8 @@ const ProfileAddress = ({
closeBottomSheet, closeBottomSheet,
mobile, mobile,
isDark, isDark,
headerOptions,
setHeaderOptions
}) => { }) => {
const navigation = useNavigate(); const navigation = useNavigate();
const Location = ({ address, active }) => { const Location = ({ address, active }) => {
@ -97,6 +99,7 @@ const ProfileAddress = ({
}; };
React.useEffect(() => { React.useEffect(() => {
setHeaderOptions(headerOptions);
getFactorInfo({ userId }); getFactorInfo({ userId });
getList(); getList();
}, []); }, []);
@ -140,6 +143,7 @@ const mapDispatchToProps = {
getFactorInfo: userFactor.info, getFactorInfo: userFactor.info,
update: userFactor.update, update: userFactor.update,
getList: userAddress.list, getList: userAddress.list,
setHeaderOptions: publicApi.setHeaderOptions,
}; };
export default connect(mapStateToProps, mapDispatchToProps)(ProfileAddress); export default connect(mapStateToProps, mapDispatchToProps)(ProfileAddress);

@ -13,10 +13,13 @@ export const Header = ({
filterOptions, filterOptions,
levels, levels,
productTypes, productTypes,
isDark isDark,
}) => { }) => {
return ( return (
<header className="w-full px-4 fixed top-0 left-0 pb-5 z-10" style={{backgroundColor: isDark ? '#061B30' : 'white'}}> <header
className="w-full px-4 fixed top-0 left-0 pb-5 z-10"
style={{ backgroundColor: isDark ? "#061B30" : "white" }}
>
<Search <Search
backgroundColor="bg-gray-100" backgroundColor="bg-gray-100"
borderColor="border-grayDB dark:border-gray45" borderColor="border-grayDB dark:border-gray45"
@ -34,7 +37,9 @@ export const Header = ({
borderColor="border-grayDB dark:border-gray45" borderColor="border-grayDB dark:border-gray45"
backgroundColor="bg-gray-100" backgroundColor="bg-gray-100"
onChange={(name, value) => onChange={(name, value) =>
setFilterOptions({ ...filterOptions, [name]: value }) value === "نوع محصول"
? setFilterOptions({ ...filterOptions, [name]: null })
: setFilterOptions({ ...filterOptions, [name]: value })
} }
name="productType" name="productType"
options={productTypes} options={productTypes}
@ -45,7 +50,9 @@ export const Header = ({
borderColor="border-grayDB dark:border-gray45" borderColor="border-grayDB dark:border-gray45"
backgroundColor="bg-gray-100" backgroundColor="bg-gray-100"
onChange={(name, value) => onChange={(name, value) =>
setFilterOptions({ ...filterOptions, [name]: value }) value === "پایه تحصیلی"
? setFilterOptions({ ...filterOptions, [name]: null })
: setFilterOptions({ ...filterOptions, [name]: value })
} }
name="grade" name="grade"
options={Object.values(levels)} options={Object.values(levels)}
@ -59,7 +66,7 @@ const mapStateToProps = (state) => ({
levels: state.publicApi.grades, levels: state.publicApi.grades,
productTypes: state.book.productTypes, productTypes: state.book.productTypes,
filterOptions: state.book.filterOptions, filterOptions: state.book.filterOptions,
isDark: state.publicApi.isDark isDark: state.publicApi.isDark,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {

@ -88,17 +88,17 @@ export const Main = ({ books, filterOptions, grades }) => {
</div> </div>
</Link> </Link>
)) ))
: bySearchFilter?.map((product, index) => ( : bySearchFilter?.map((product) => (
<> <>
{(productType ? productType === "کتاب دیجیتال" : true) && ( {(productType ? productType === "کتاب دیجیتال" : true) && (
<Link <Link
key={index} key={product?.product[0]?.id}
to={"/products/" + product?.id} to={"/products/" + product?.id}
className={`w-1/2 flex flex-col p-3`} className={`w-1/2 flex flex-col p-3`}
> >
<img <img
src={"https://dnvn.ir/api/v1/file/" + product?.fileIds} src={"https://dnvn.ir/api/v1/file/" + product?.fileIds}
className="w-full rounded-md mb-3" className="w-full rounded-md mb-3 object-contain"
/> />
<strong className="text-blue5F dark:text-white text-tiny font-bold lg:text-sm lg:font-medium mb-2"> <strong className="text-blue5F dark:text-white text-tiny font-bold lg:text-sm lg:font-medium mb-2">
{"کتاب دیجیتال" + " " + product?.name} {"کتاب دیجیتال" + " " + product?.name}
@ -113,7 +113,7 @@ export const Main = ({ books, filterOptions, grades }) => {
)} )}
{(productType ? productType === "کتاب فیزیکی" : true) && ( {(productType ? productType === "کتاب فیزیکی" : true) && (
<Link <Link
key={index} key={product?.product[1]?.id}
to={"/products/" + product?.id} to={"/products/" + product?.id}
className={`w-1/2 flex flex-col p-3`} className={`w-1/2 flex flex-col p-3`}
> >

Loading…
Cancel
Save