reza added home search

master
RezaAshrafi77 3 years ago
parent c00b6357c8
commit 856d027bce
  1. 12
      src/App.js
  2. 325
      src/AppRouter.js
  3. 4
      src/Redux/actions/public.js
  4. 1
      src/Redux/actions/transport.js
  5. 6
      src/Redux/actions/userFactor.js
  6. 8
      src/Redux/actions/userProduct.js
  7. 2
      src/Redux/reducers/book.js
  8. 44
      src/Redux/reducers/public.js
  9. 2
      src/Redux/reducers/transport.js
  10. 9
      src/Redux/reducers/user.js
  11. 7
      src/Redux/reducers/userFactor.js
  12. 13
      src/Redux/reducers/userProduct.js
  13. 5
      src/views/AR/index.js
  14. 4
      src/views/Activation/index.js
  15. 12
      src/views/Auth/Profile/index.js
  16. 12
      src/views/Auth/index.js
  17. 2
      src/views/Blog/index.js
  18. 1
      src/views/Blogs/index.js
  19. 12
      src/views/Callback/index.js
  20. 13
      src/views/Cart/DeliveryMethod/index.js
  21. 1
      src/views/Cart/DeliveryMethod/index.scss
  22. 17
      src/views/Cart/Discount/index.js
  23. 25
      src/views/Cart/Factor/index.js
  24. 117
      src/views/Cart/Table/index.js
  25. 127
      src/views/Cart/index.js
  26. 2
      src/views/Cart/index.scss
  27. 472
      src/views/ChatRoom/Body/Emoji/index.js
  28. 25
      src/views/ChatRoom/Body/index.js
  29. 15
      src/views/ChatRoom/Drawer/index.js
  30. 7
      src/views/Contact/index.js
  31. 6
      src/views/Faq/index.js
  32. 14
      src/views/Home/HomeSearch/Select/index.js
  33. 36
      src/views/Home/HomeSearch/index.js
  34. 6
      src/views/Home/HomeSearch/index.scss
  35. 5
      src/views/Home/Membership/index.js
  36. 1
      src/views/Home/SingleBlog/index.js
  37. 1
      src/views/Home/index.js
  38. 101
      src/views/MyBooks/index.js
  39. 20
      src/views/Product/AddToCart/index.js
  40. 2
      src/views/Product/AddToCart/index.scss
  41. 44
      src/views/Product/index.js
  42. 6
      src/views/Products/List/index.js
  43. 10
      src/views/Products/index.js
  44. 1
      src/views/QR/Image/index.js
  45. 1
      src/views/QR/index.js

@ -1,4 +1,5 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { ToastContainer } from "react-toastify";
import AppRouter from "./AppRouter"; import AppRouter from "./AppRouter";
import store from "./Redux/store"; import store from "./Redux/store";
import { Provider } from "react-redux"; import { Provider } from "react-redux";
@ -10,6 +11,17 @@ class App extends Component {
return ( return (
<Provider store={store}> <Provider store={store}>
<AppRouter /> <AppRouter />
<ToastContainer
position="top-right"
autoClose={2000}
hideProgressBar={true}
newestOnTop={true}
closeOnClick
rtl={true}
pauseOnFocusLoss
draggable
pauseOnHover
/>
</Provider> </Provider>
); );
} }

@ -8,6 +8,7 @@ import {
} from "react-router-dom"; } from "react-router-dom";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { user } from "~/Redux/actions"; import { user } from "~/Redux/actions";
import { userProduct } from "~/Redux/actions";
import proxy from "./Redux/proxy"; import proxy from "./Redux/proxy";
import Home from "./views/Home/index"; import Home from "./views/Home/index";
@ -35,10 +36,33 @@ class AppRouter extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
window.router = this; window.router = this;
this.state = {
cartControll: false,
};
} }
state = {}; state = {};
componentDidUpdate(prevProps, prevState) {
if (this.props.userProductList > 0) {
if (!this.state.cartControll) {
this.setState({
cartControll: true,
});
}
} else {
if (!this.state.cartControll) {
this.setState({
cartControll: true,
});
}
}
}
componentDidMount() {
this.props.getUserProductList();
}
render() { render() {
const mobile = window.innerWidth < 1000 ? true : false; const mobile = window.innerWidth < 1000 ? true : false;
let home = mobile ? ( let home = mobile ? (
@ -70,12 +94,18 @@ class AppRouter extends Component {
) : ( ) : (
<Redirect <Redirect
to={{ to={{
pathname: "/auth", pathname: "/",
}} }}
/> />
) )
) : ( ) : proxy.status() ? (
<Faq /> <Faq />
) : (
<Redirect
to={{
pathname: "/auth",
}}
/>
)} )}
</Route> </Route>
<Route exact path={"/contact"}> <Route exact path={"/contact"}>
@ -85,7 +115,7 @@ class AppRouter extends Component {
) : ( ) : (
<Redirect <Redirect
to={{ to={{
pathname: "/auth", pathname: "/",
}} }}
/> />
) )
@ -93,32 +123,126 @@ class AppRouter extends Component {
<Contact /> <Contact />
)} )}
</Route> </Route>
<Route exact path={"/callback"}>
<Callback />
</Route>
<Route exact path={"/blogs"}> <Route exact path={"/blogs"}>
{mobile ? (
proxy.status() ? (
<Blogs />
) : (
<Redirect
to={{
pathname: "/",
}}
/>
)
) : (
<Blogs />
)}
<Blogs /> <Blogs />
</Route> </Route>
<Route exact path={"/blogs/:id"}> <Route exact path={"/blogs/:id"}>
<Blog /> {mobile ? (
proxy.status() ? (
<Blog />
) : (
<Redirect
to={{
pathname: "/",
}}
/>
)
) : (
<Blog />
)}
</Route> </Route>
<Route exact path={"/about"}> <Route exact path={"/about"}>
<About /> {mobile ? (
proxy.status() ? (
<About />
) : (
<Redirect
to={{
pathname: "/",
}}
/>
)
) : (
<About />
)}
</Route> </Route>
<Route exact path={"/products"}> <Route exact path={"/products"}>
<Products /> {mobile ? (
proxy.status() ? (
<Products />
) : (
<Redirect
to={{
pathname: "/",
}}
/>
)
) : (
<Products />
)}
</Route> </Route>
<Route exact path={"/newProfile"}> <Route exact path={"/newProfile"}>
<NewProfile /> {mobile ? (
proxy.status() ? (
<NewProfile />
) : (
<Redirect
to={{
pathname: "/",
}}
/>
)
) : (
<NewProfile />
)}
</Route> </Route>
<Route exact path={"/support"}> <Route exact path={"/support"}>
<Support /> {mobile ? (
proxy.status() ? (
<Support />
) : (
<Redirect
to={{
pathname: "/",
}}
/>
)
) : (
<Support />
)}
</Route> </Route>
<Route exact path={"/products/digital/:id"}> <Route exact path={"/products/digital/:id"}>
<Product page="digital" /> {mobile ? (
proxy.status() ? (
<Product page="digital" />
) : (
<Redirect
to={{
pathname: "/",
}}
/>
)
) : (
<Product page="digital" />
)}
</Route> </Route>
<Route exact path={"/products/physical/:id"}> <Route exact path={"/products/physical/:id"}>
<Product page="physical" /> {mobile ? (
proxy.status() ? (
<Product page="physical" />
) : (
<Redirect
to={{
pathname: "/",
}}
/>
)
) : (
<Product page="physical" />
)}
</Route> </Route>
<Route exact path={"/qr"}> <Route exact path={"/qr"}>
<QR /> <QR />
@ -135,22 +259,150 @@ class AppRouter extends Component {
)} )}
</Route> </Route>
<Route exact path={"/profile"}> <Route exact path={"/profile"}>
<Auth page={"profile"} /> {mobile ? (
proxy.status() ? (
<Auth page={"profile"} />
) : (
<Redirect
to={{
pathname: "/",
}}
/>
)
) : proxy.status() ? (
<Auth page={"profile"} />
) : (
<Redirect
to={{
pathname: "/auth",
}}
/>
)}
</Route> </Route>
<Route exact path={"/qr-scan"}> <Route exact path={"/qr-scan"}>
<QRScan /> {mobile ? (
proxy.status() ? (
<QRScan />
) : (
<Redirect
to={{
pathname: "/",
}}
/>
)
) : proxy.status() ? (
<QRScan />
) : (
<Redirect
to={{
pathname: "/auth",
}}
/>
)}
</Route> </Route>
<Route exact path={"/activation"}> <Route exact path={"/activation"}>
<Activation /> {mobile ? (
proxy.status() ? (
<Activation />
) : (
<Redirect
to={{
pathname: "/",
}}
/>
)
) : proxy.status() ? (
<Activation />
) : (
<Redirect
to={{
pathname: "/auth",
}}
/>
)}
</Route> </Route>
<Route exact path={"/chatroom"}> <Route exact path={"/chatroom"}>
<ChatList /> {mobile ? (
proxy.status() ? (
<ChatList />
) : (
<Redirect
to={{
pathname: "/",
}}
/>
)
) : proxy.status() ? (
<ChatList />
) : (
<Redirect
to={{
pathname: "/auth",
}}
/>
)}
</Route> </Route>
<Route exact path={"/cart"}> <Route exact path={"/cart"}>
<Cart /> {mobile ? (
proxy.status() ? (
this.props.userProductList.length > 0 ||
!this.state.cartControll ? (
<Cart />
) : (
<Redirect
to={{
pathname: "/products",
search: "cart",
}}
/>
)
) : (
<Redirect
to={{
pathname: "/",
}}
/>
)
) : proxy.status() ? (
!this.state.cartControll ||
this.props.userProductList.length > 0 ? (
<Cart />
) : (
<Redirect
to={{
pathname: "/products",
search: "cart",
}}
/>
)
) : (
<Redirect
to={{
pathname: "/auth",
}}
/>
)}
</Route> </Route>
<Route exact path={"/mybooks"}> <Route exact path={"/mybooks"}>
<MyBooks /> {mobile ? (
proxy.status() ? (
<MyBooks />
) : (
<Redirect
to={{
pathname: "/",
}}
/>
)
) : proxy.status() ? (
<MyBooks />
) : (
<Redirect
to={{
pathname: "/auth",
}}
/>
)}
</Route> </Route>
<Route exact path={"/ar"}> <Route exact path={"/ar"}>
{mobile ? ( {mobile ? (
@ -159,27 +411,41 @@ class AppRouter extends Component {
) : ( ) : (
<Redirect <Redirect
to={{ to={{
pathname: "/auth", pathname: "/",
}} }}
/> />
) )
) : ( ) : proxy.status() ? (
<AR /> <AR />
) : (
<Redirect
to={{
pathname: "/auth",
}}
/>
)} )}
</Route> </Route>
{mobile ? ( <Route exact path={"/chatroom/:id"}>
<Route exact path={"/chatroom/:id"}> {mobile ? (
{proxy.status() ? ( proxy.status() ? (
<Chatroom /> <Chatroom />
) : ( ) : (
<Redirect <Redirect
to={{ to={{
pathname: "/auth", pathname: "/",
}} }}
/> />
)} )
</Route> ) : proxy.status() ? (
) : null} <Chatroom />
) : (
<Redirect
to={{
pathname: "/auth",
}}
/>
)}
</Route>
<Route path={""}> <Route path={""}>
{proxy.status() ? ( {proxy.status() ? (
<Redirect <Redirect
@ -210,7 +476,8 @@ class AppRouter extends Component {
export default connect( export default connect(
(state) => ({ (state) => ({
profile: state.user.status, profile: state.user.status,
userProductList: state.userProduct.list,
// status: state.user.status, // status: state.user.status,
}), }),
{ getProfile: user.getProfile } { getProfile: user.getProfile, getUserProductList: userProduct.list }
)(AppRouter); )(AppRouter);

@ -3,7 +3,7 @@ const publicApi = {
getHomeData: (data, history) => async (dispatch) => getHomeData: (data, history) => async (dispatch) =>
await proxy.get("public/homePage", data, { history, dispatch }), await proxy.get("public/homePage", data, { history, dispatch }),
getFaqList: (data, history) => async (dispatch) => getFaqList: (data, history) => async (dispatch) =>
await proxy.get("public/faq", data, { history, dispatch }), await proxy.get("faq/list", data, { history, dispatch }),
setFaqActive: (data) => async (dispatch) => setFaqActive: (data) => async (dispatch) =>
await dispatch({ type: "public/faq/activate", data: data }), await dispatch({ type: "public/faq/activate", data: data }),
searchFaq: (data) => async (dispatch) => searchFaq: (data) => async (dispatch) =>
@ -18,6 +18,8 @@ const publicApi = {
await proxy.get("public/blogList", data, { history, dispatch }), await proxy.get("public/blogList", data, { history, dispatch }),
getBlogInfo: (data, history) => async (dispatch) => getBlogInfo: (data, history) => async (dispatch) =>
await proxy.get("public/blogInfo", data, { history, dispatch }), await proxy.get("public/blogInfo", data, { history, dispatch }),
filterNewProducts: (data, history) => async (dispatch) =>
await dispatch({ type: "public/filter", data: data }),
}; };
export default publicApi; export default publicApi;

@ -26,7 +26,6 @@ const transport = {
await proxy.post("transport/setTransport", data); await proxy.post("transport/setTransport", data);
await proxy.get("userFactor/info", data3, { dispatch }); await proxy.get("userFactor/info", data3, { dispatch });
await proxy.get("transport/list", data2, { dispatch }); await proxy.get("transport/list", data2, { dispatch });
console.log(data);
}, },
del: del:
(data = {}, data2 = {}) => (data = {}, data2 = {}) =>

@ -12,7 +12,11 @@ const userFactor = {
(data = {}, data2 = {}) => (data = {}, data2 = {}) =>
async (dispatch) => { async (dispatch) => {
await proxy.put("userFactor/update", data); await proxy.put("userFactor/update", data);
await proxy.get("userFactor/list", data2, { dispatch }); },
payment:
(data = {}, data2 = {}) =>
async (dispatch) => {
await proxy.post("userFactor/payment", data, { dispatch });
}, },
add: add:
(data = {}, data2 = {}) => (data = {}, data2 = {}) =>

@ -2,8 +2,9 @@ import proxy from "../proxy";
const userProduct = { const userProduct = {
list: list:
(data = {}) => (data = {}) =>
async (dispatch) => async (dispatch) => {
await proxy.get("userProduct/list", data, { dispatch }), await proxy.get("userProduct/list", data, { dispatch });
},
info: info:
(data = {}) => (data = {}) =>
async (dispatch) => async (dispatch) =>
@ -15,10 +16,11 @@ const userProduct = {
await proxy.get("userProduct/list", data2, { dispatch }); await proxy.get("userProduct/list", data2, { dispatch });
}, },
add: add:
(data = {}, data2 = {}) => (data = {}, data2 = {}, data3 = {}) =>
async (dispatch) => { async (dispatch) => {
await proxy.post("userProduct/add", data, { dispatch }); await proxy.post("userProduct/add", data, { dispatch });
await proxy.get("userProduct/list", data2, { dispatch }); await proxy.get("userProduct/list", data2, { dispatch });
await proxy.get("userFactor/info", data3, { dispatch });
}, },
del: del:
(data = {}, data2 = {}) => (data = {}, data2 = {}) =>

@ -1,5 +1,5 @@
const initialState = { const initialState = {
loading: true, loading: false,
error: null, error: null,
list: [], list: [],
info: null, info: null,

@ -1,8 +1,9 @@
const initialState = { const initialState = {
homeData: [], homeData: [],
newProducts: [],
levels: [], levels: [],
faqList: [], faqList: [],
loading: true, loading: false,
error: null, error: null,
searchResult: [], searchResult: [],
contactData: null, contactData: null,
@ -50,13 +51,35 @@ export default function publicApi(state = initialState, action) {
homeData: data, homeData: data,
}; };
case "public/filter": case "public/filter":
const realList = state.homeData.filter( const realList =
(item) => item.title === "جدیدترین کتابهای دانوین" state.newProducts.length === 0
).data; ? state.homeData.filter(
const level = data.level; (item) => item.title === "جدیدترین کتابهای دانوین"
)[0].data
: state.newProducts;
if (state.newProducts.length === 0) {
state = {
...state,
newProducts: realList,
};
console.log("here1");
}
const level = data.levels;
const search = data.search; const search = data.search;
if (level.length > 0 || search) { if (level.length > 0 || search) {
localStorage.setItem("filter", "ON"); localStorage.setItem("filter", "ON");
} else {
return {
...state,
loading: false,
error: null,
homeData: state.homeData.map((item) =>
item.title === "جدیدترین کتابهای دانوین"
? { ...item, data: state.newProducts }
: { ...item }
),
newProducts: [],
};
} }
let byLevelFilter = []; let byLevelFilter = [];
if (level.length > 0) { if (level.length > 0) {
@ -87,7 +110,6 @@ export default function publicApi(state = initialState, action) {
const bySearchFilter = search const bySearchFilter = search
? byLevelFilter.filter((item1) => item1.name.indexOf(search) !== -1) ? byLevelFilter.filter((item1) => item1.name.indexOf(search) !== -1)
: byLevelFilter; : byLevelFilter;
// if (sort === "گران ترین") { // if (sort === "گران ترین") {
// finalSort = bySearchFilter.sort((item1, item2) => { // finalSort = bySearchFilter.sort((item1, item2) => {
// return item1.product[0].price - item2.product[0].price; // return item1.product[0].price - item2.product[0].price;
@ -95,13 +117,18 @@ export default function publicApi(state = initialState, action) {
// } else { // } else {
// finalSort = bySearchFilter; // finalSort = bySearchFilter;
// } // }
return { return {
...state, ...state,
loading: false, loading: false,
error: null, error: null,
filterResult: bySearchFilter, homeData: state.homeData.map((item) =>
item.title === "جدیدترین کتابهای دانوین"
? { ...item, data: bySearchFilter }
: { ...item }
),
}; };
case "public/faq": case "faq/list":
return { ...state, loading: false, error: null, faqList: data }; return { ...state, loading: false, error: null, faqList: data };
case "public/faq/activate": case "public/faq/activate":
return { return {
@ -115,7 +142,6 @@ export default function publicApi(state = initialState, action) {
), ),
}; };
case "public/faq/search": case "public/faq/search":
console.log(data);
return { return {
...state, ...state,
loading: false, loading: false,

@ -1,6 +1,6 @@
import { toast } from "react-toastify"; import { toast } from "react-toastify";
const initialState = { const initialState = {
loading: true, loading: false,
error: null, error: null,
list: [], list: [],
info: null, info: null,

@ -1,5 +1,5 @@
import proxy from "../proxy"; import proxy from "../proxy";
import { ToastContainer, toast } from "react-toastify"; import { toast } from "react-toastify";
const initialState = { const initialState = {
status: proxy.status(), status: proxy.status(),
loading: false, loading: false,
@ -41,13 +41,14 @@ export default function user(state = initialState, action) {
return { ...state, loading: false, mothers: data, error: null }; return { ...state, loading: false, mothers: data, error: null };
case "user/setProfile": case "user/setProfile":
toast.success("تغییرات اعمال شد."); toast.success("تغییرات اعمال شد.");
window.location = "/"; setTimeout(() => {
window.location = "/";
}, 500);
return { ...state, loading: false, error: null }; return { ...state, loading: false, error: null };
/////////////
case "loading": case "loading":
return { ...state, loading: true }; return { ...state, loading: true };
case "error": case "error":
toast.error(data.message); // toast.error(data.message);
return { ...state, loading: false, error: data.message }; return { ...state, loading: false, error: data.message };
default: default:
return state; return state;

@ -27,16 +27,17 @@ export default function userFactor(state = initialState, action) {
case "userFactor/update": case "userFactor/update":
return { ...state, loading: false, error: null }; return { ...state, loading: false, error: null };
case "userFactor/add": case "userFactor/add":
console.log(data);
toast.success("درخواست شما با موفقیت انجام شد."); toast.success("درخواست شما با موفقیت انجام شد.");
return { ...state, loading: false, error: null, sum: data.payPrice }; return { ...state, loading: false, error: null, sum: data.payPrice };
case "userFactor/delete": case "userFactor/delete":
return { ...state, loading: false, error: null }; return { ...state, loading: false, error: null };
///////////// case "userFactor/payment":
window.location.replace(data);
return { ...state, loading: false, error: null };
case "loading": case "loading":
return { ...state, loading: true }; return { ...state, loading: true };
case "error": case "error":
toast.error(data.message); // toast.error(data.message);
return { ...state, loading: false, error: data.message }; return { ...state, loading: false, error: data.message };
default: default:
return state; return state;

@ -7,6 +7,7 @@ const initialState = {
info: null, info: null,
sum: null, sum: null,
checkEmpty: false, checkEmpty: false,
hasPhysical: false,
}; };
export default function userProduct(state = initialState, action) { export default function userProduct(state = initialState, action) {
let { type, data, message } = action; let { type, data, message } = action;
@ -15,28 +16,32 @@ export default function userProduct(state = initialState, action) {
const checkEmpty = data.filter( const checkEmpty = data.filter(
(item) => item.condition === 2 && item.product.productType === (1 || 3) (item) => item.condition === 2 && item.product.productType === (1 || 3)
); );
const hasPhysical =
data.filter((item) => item.product.productType === 2).length > 0
? true
: false;
return { return {
...state, ...state,
loading: false, loading: false,
list: data, list: data,
checkEmpty: checkEmpty.length > 0 ? false : true, checkEmpty: checkEmpty.length > 0 ? false : true,
error: null, error: null,
hasPhysical: hasPhysical,
}; };
case "userProduct/info": case "userProduct/info":
return { ...state, loading: false, info: data, error: null }; return { ...state, loading: false, info: data, error: null };
case "userProduct/update": case "userProduct/update":
return { ...state, loading: false, error: null }; return { ...state, loading: false, error: null };
case "userProduct/add": case "userProduct/add":
console.log(data); if (window.location.pathname.indexOf("products") !== -1) {
toast.success("درخواست شما با موفقیت انجام شد."); toast.success("درخواست شما با موفقیت انجام شد.");
}
return { ...state, loading: false, error: null, sum: data.payPrice }; return { ...state, loading: false, error: null, sum: data.payPrice };
case "userProduct/delete": case "userProduct/delete":
return { ...state, loading: false, error: null }; return { ...state, loading: false, error: null };
/////////////
case "loading": case "loading":
return { ...state, loading: true }; return { ...state, loading: true };
case "error": case "error":
toast.error(data.message);
return { ...state, loading: false, error: data.message }; return { ...state, loading: false, error: data.message };
default: default:
return state; return state;

@ -21,6 +21,7 @@ const fontSize = {
class AR extends Component { class AR extends Component {
componentDidMount() { componentDidMount() {
window.scrollTo(0, 0);
this.props.getArList(); this.props.getArList();
} }
@ -29,7 +30,7 @@ class AR extends Component {
return ( return (
<> <>
{window.innerWidth > 1000 ? ( {window.innerWidth > 1000 ? (
arList ? ( arList.length > 0 ? (
<> <>
<div className="ar d-flex flex-column"> <div className="ar d-flex flex-column">
<Navbar /> <Navbar />
@ -48,7 +49,7 @@ class AR extends Component {
) )
) : null} ) : null}
{window.innerWidth < 1000 ? ( {window.innerWidth < 1000 ? (
arList ? ( arList.length ? (
<div className="mobile-ar d-flex flex-column"> <div className="mobile-ar d-flex flex-column">
<Navbar /> <Navbar />
<BreadCrumbs /> <BreadCrumbs />

@ -60,7 +60,7 @@ class Activation extends Component {
</div> </div>
<form <form
className="activation__form d-flex" className="activation__form d-flex"
onSubmit={() => console.log()} // onSubmit={() => console.log()}
> >
<input <input
id="code" id="code"
@ -121,7 +121,7 @@ class Activation extends Component {
</div> </div>
<form <form
className="mobile-activation__form d-flex flex-column" className="mobile-activation__form d-flex flex-column"
onSubmit={() => console.log()} // onSubmit={() => console.log()}
> >
<input <input
id="code" id="code"

@ -1,5 +1,4 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { ToastContainer } from "react-toastify";
import onInput from "~/util/onInput"; import onInput from "~/util/onInput";
import { user } from "~/Redux/actions"; import { user } from "~/Redux/actions";
import { connect } from "react-redux"; import { connect } from "react-redux";
@ -489,17 +488,6 @@ class Profile extends Component {
</div> </div>
) )
) : null} ) : null}
<ToastContainer
position="bottom-right"
autoClose={1500}
hideProgressBar={true}
newestOnTop={true}
closeOnClick
rtl={true}
pauseOnFocusLoss
draggable
pauseOnHover
/>
</> </>
); );
} }

@ -1,5 +1,4 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { ToastContainer } from "react-toastify";
import Profile from "./Profile/index"; import Profile from "./Profile/index";
import Login from "./Login/index"; import Login from "./Login/index";
@ -17,17 +16,6 @@ export default class Auth extends Component {
<div className="auth d-flex"> <div className="auth d-flex">
{this.state.page === "login" ? <Login parent={this} /> : null} {this.state.page === "login" ? <Login parent={this} /> : null}
{this.state.page === "profile" ? <Profile parent={this} /> : null} {this.state.page === "profile" ? <Profile parent={this} /> : null}
<ToastContainer
position="bottom-right"
autoClose={1500}
hideProgressBar={true}
newestOnTop={true}
closeOnClick
rtl={true}
pauseOnFocusLoss
draggable
pauseOnHover
/>
</div> </div>
); );
} }

@ -16,6 +16,7 @@ const maxDesktopSize = 1250;
class Blog extends Component { class Blog extends Component {
componentDidMount() { componentDidMount() {
window.scrollTo(0, 0);
this.props.getBlogInfo({ this.props.getBlogInfo({
id: window.location.pathname.slice( id: window.location.pathname.slice(
window.location.pathname.lastIndexOf("/") + 1, window.location.pathname.lastIndexOf("/") + 1,
@ -123,7 +124,6 @@ export default connect(
const Identifier = (props) => { const Identifier = (props) => {
const { data } = props; const { data } = props;
console.log(data);
return ( return (
<> <>
{data.type === "audio" ? ( {data.type === "audio" ? (

@ -15,6 +15,7 @@ import "./index.scss";
class Blogs extends Component { class Blogs extends Component {
componentDidMount() { componentDidMount() {
window.scrollTo(0, 0);
this.props.getBlogList(); this.props.getBlogList();
} }
render() { render() {

@ -1,7 +1,6 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { userProduct } from "~/Redux/actions"; import { userProduct } from "~/Redux/actions";
import { ToastContainer } from "react-toastify";
import Navbar from "../Home/Navbar/index"; import Navbar from "../Home/Navbar/index";
import Footer from "../Home/Footer/index"; import Footer from "../Home/Footer/index";
@ -261,17 +260,6 @@ class Callback extends Component {
</div> </div>
) )
) : null} ) : null}
<ToastContainer
position="bottom-right"
autoClose={1500}
hideProgressBar={true}
newestOnTop={true}
closeOnClick
rtl={true}
pauseOnFocusLoss
draggable
pauseOnHover
/>
</> </>
); );
} }

@ -35,9 +35,18 @@ class DeliveryMethod extends Component {
<div <div
className="delivery-methods d-flex justify-content-between align-items-center" className="delivery-methods d-flex justify-content-between align-items-center"
style={{ style={{
background: data.isDe ? "#ccffcc" : "white", background: data.id === transportId ? "#ccffcc" : "white",
}} }}
onClick={() => parent.setState({ selectedDelivery: data })} onClick={() =>
setTransport(
{
factorId: factorInfo.id,
transportId: data.id,
},
{},
{ id: list[0].factorId }
)
}
> >
<strong style={{ fontSize: fontSize.desktop.strong }}> <strong style={{ fontSize: fontSize.desktop.strong }}>
{data.name} {data.name}

@ -31,6 +31,7 @@
margin-top: 10px; margin-top: 10px;
flex: 1; flex: 1;
max-width: 45%; max-width: 45%;
cursor: pointer;
h3, h3,
strong, strong,
span { span {

@ -21,10 +21,10 @@ const fontSize = {
}, },
}; };
const DiscoutCode = ({ codeId, setCodeId }) => { const DiscoutCode = ({ codeId, setCodeId, userId, factorId }) => {
const [value, setValue] = React.useState(codeId || ""); const [value, setValue] = React.useState(codeId || "");
function setOff() { function setOff() {
setCodeId({ codeId: value }); setCodeId({ offCodeValue: value, userId: userId, id: factorId });
} }
return ( return (
<> <>
@ -75,6 +75,13 @@ const DiscoutCode = ({ codeId, setCodeId }) => {
); );
}; };
export default connect((state) => ({ codeId: state.userFactor.codeId }), { export default connect(
setCodeId: userFactor.update, (state) => ({
})(DiscoutCode); codeId: state.userFactor.info.codeId,
userId: state.user.status.id,
factorId: state.userFactor.info.id,
}),
{
setCodeId: userFactor.update,
}
)(DiscoutCode);

@ -1,4 +1,5 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { connect } from "react-redux";
import "./index.scss"; import "./index.scss";
const maxDesktopSize = 1250; const maxDesktopSize = 1250;
@ -33,26 +34,25 @@ const Factor = (props) => {
} }
return total; return total;
}; };
const { factorInfo } = props;
return ( return (
<> <>
{window.innerWidth < 1000 ? ( {window.innerWidth < 1000 ? (
<div className="mobile-factor d-flex flex-column"> <div className="mobile-factor d-flex flex-column">
<div className="d-flex justify-content-between"> <div className="d-flex justify-content-between">
<strong>مبلغ سبد خرید</strong> <strong>مبلغ سبد خرید</strong>
<span>{totalPrice()} تومان</span> <span>{factorInfo.sumPrice} تومان</span>
</div> </div>
<div className="d-flex justify-content-between"> <div className="d-flex justify-content-between">
<strong>هزینه ارسال</strong> <strong>هزینه ارسال</strong>
<span> <span>
{props.parent.props.list.length {factorInfo.transportPrice}
? props.parent.state.selectedDelivery.price
: 0}{" "}
تومان تومان
</span> </span>
</div> </div>
<div className="d-flex justify-content-between"> <div className="d-flex justify-content-between">
<strong>میزان تخفیف</strong> <strong>میزان تخفیف</strong>
<span>{props.parent.state.discount} تومان</span> <span>{factorInfo.offPrice} تومان</span>
</div> </div>
</div> </div>
) : null} ) : null}
@ -63,7 +63,7 @@ const Factor = (props) => {
مبلغ سبد خرید مبلغ سبد خرید
</strong> </strong>
<span style={{ fontSize: fontSize.desktop.span }}> <span style={{ fontSize: fontSize.desktop.span }}>
{totalPrice()} تومان {factorInfo.sumPrice} تومان
</span> </span>
</div> </div>
<div className="d-flex justify-content-between"> <div className="d-flex justify-content-between">
@ -71,9 +71,7 @@ const Factor = (props) => {
هزینه ارسال هزینه ارسال
</strong> </strong>
<span style={{ fontSize: fontSize.desktop.span }}> <span style={{ fontSize: fontSize.desktop.span }}>
{props.parent.props.list.length {factorInfo.transportPrice}
? props.parent.state.selectedDelivery.price
: 0}{" "}
تومان تومان
</span> </span>
</div> </div>
@ -82,7 +80,7 @@ const Factor = (props) => {
میزان تخفیف میزان تخفیف
</strong> </strong>
<span style={{ fontSize: fontSize.desktop.span }}> <span style={{ fontSize: fontSize.desktop.span }}>
{props.parent.state.discount} تومان {factorInfo.offPrice} تومان
</span> </span>
</div> </div>
</div> </div>
@ -91,4 +89,9 @@ const Factor = (props) => {
); );
}; };
export default Factor; export default connect(
(state) => ({
factorInfo: state.userFactor.info,
}),
{}
)(Factor);

@ -61,7 +61,7 @@ const fontSize = {
function BasicTable(props) { function BasicTable(props) {
const classes = useStyles(); const classes = useStyles();
const { list, handleCounter, handleDelete, route } = props; const { list, handleCounter, handleDelete, route, factorInfo } = props;
const sum = () => { const sum = () => {
let total = 0; let total = 0;
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
@ -96,13 +96,14 @@ function BasicTable(props) {
id={props.id} id={props.id}
handleDelete={handleDelete} handleDelete={handleDelete}
route={route} route={route}
factorInfo={factorInfo}
/> />
))} ))}
{route === "cart" ? ( {route === "cart" && factorInfo ? (
<TableRow> <TableRow>
<TableCell align="center"> <TableCell align="center">
<span style={{ color: "grey" }}> <span style={{ color: "grey" }}>
مبلغ کل {Math.round(props.payPrice)} مبلغ کل {factorInfo.sumPrice}
</span> </span>
</TableCell> </TableCell>
<TableCell align="right" component="th" scope="row"> <TableCell align="right" component="th" scope="row">
@ -136,24 +137,27 @@ function BasicTable(props) {
id={props.id} id={props.id}
handleDelete={handleDelete} handleDelete={handleDelete}
route={route} route={route}
factorInfo={factorInfo}
/> />
))} ))}
<TableRow> {factorInfo ? (
<TableCell align="right" component="th" scope="row"> <TableRow>
<span style={{ color: "grey" }}></span> <TableCell align="right" component="th" scope="row">
</TableCell> <span style={{ color: "grey" }}></span>
<TableCell align="center"> </TableCell>
<span style={{ color: "grey" }}> <TableCell align="center">
مبلغ کل {Math.round(props.payPrice)} <span style={{ color: "grey" }}>
</span> مبلغ کل {factorInfo.sumPrice}
</TableCell> </span>
<TableCell align="center" component="th" scope="row"> </TableCell>
<span style={{ color: "grey" }}>{sum()} محصول</span> <TableCell align="center" component="th" scope="row">
</TableCell> <span style={{ color: "grey" }}>{sum()} محصول</span>
<TableCell align="center" component="th" scope="row"> </TableCell>
<span style={{ color: "grey" }}></span> <TableCell align="center" component="th" scope="row">
</TableCell> <span style={{ color: "grey" }}></span>
</TableRow> </TableCell>
</TableRow>
) : null}
</TableBody> </TableBody>
</Table> </Table>
</TableContainer> </TableContainer>
@ -163,7 +167,7 @@ function BasicTable(props) {
} }
const Item = (props) => { const Item = (props) => {
const { data, pushToCart, handleDelete, info, id, route } = props; const { data, pushToCart, id, route, factorInfo } = props;
return ( return (
<> <>
{window.innerWidth < 1000 ? ( {window.innerWidth < 1000 ? (
@ -236,11 +240,15 @@ const Item = (props) => {
<div className="mobile-cart-table-price__counter d-flex justify-content-around align-items-center"> <div className="mobile-cart-table-price__counter d-flex justify-content-around align-items-center">
<button <button
onClick={() => onClick={() =>
pushToCart({ pushToCart(
productId: data.productId, {
userId: id, productId: data.productId,
count: 1, userId: id,
}) count: 1,
},
{},
{ id: data.factorId }
)
} }
style={{ fontSize: fontSize.mobile.counter.button }} style={{ fontSize: fontSize.mobile.counter.button }}
> >
@ -251,11 +259,17 @@ const Item = (props) => {
</span> </span>
<button <button
onClick={() => onClick={() =>
pushToCart({ data.count > 0
productId: data.productId, ? pushToCart(
userId: id, {
count: -1, productId: data.productId,
}) userId: id,
count: -1,
},
{},
{ id: data.factorId }
)
: null
} }
style={{ fontSize: fontSize.mobile.counter.button }} style={{ fontSize: fontSize.mobile.counter.button }}
> >
@ -316,11 +330,15 @@ const Item = (props) => {
<div className="cart-item__counter--box d-flex justify-content-around align-items-center"> <div className="cart-item__counter--box d-flex justify-content-around align-items-center">
<button <button
onClick={() => onClick={() =>
pushToCart({ pushToCart(
productId: data.productId, {
userId: id, productId: data.productId,
count: 1, userId: id,
}) count: 1,
},
{},
{ id: data.factorId }
)
} }
style={{ fontSize: fontSize.desktop.counter.button }} style={{ fontSize: fontSize.desktop.counter.button }}
> >
@ -331,11 +349,15 @@ const Item = (props) => {
</span> </span>
<button <button
onClick={() => onClick={() =>
pushToCart({ pushToCart(
productId: data.productId, {
userId: id, productId: data.productId,
count: -1, userId: id,
}) count: -1,
},
{},
{ id: data.factorId }
)
} }
style={{ fontSize: fontSize.desktop.counter.button }} style={{ fontSize: fontSize.desktop.counter.button }}
> >
@ -349,9 +371,23 @@ const Item = (props) => {
<DeleteOutlineOutlinedIcon <DeleteOutlineOutlinedIcon
style={{ color: "#FC120A", fontSize: 30, marginLeft: 5 }} style={{ color: "#FC120A", fontSize: 30, marginLeft: 5 }}
// onClick={() => handleDelete(data.id)} // onClick={() => handleDelete(data.id)}
onClick={() =>
pushToCart({
productId: data.productId,
userId: id,
count: -data.count,
})
}
/> />
<span <span
// onClick={() => handleDelete(data.id)} // onClick={() => handleDelete(data.id)}
onClick={() =>
pushToCart({
productId: data.productId,
userId: id,
count: -data.count,
})
}
style={{ fontSize: fontSize.desktop.delete.span }} style={{ fontSize: fontSize.desktop.delete.span }}
> >
حذف حذف
@ -369,6 +405,7 @@ export default connect(
loading: state.userProduct.loading, loading: state.userProduct.loading,
info: state.book.info, info: state.book.info,
id: state.user.status.id, id: state.user.status.id,
factorInfo: state.userFactor.info,
}), }),
{ pushToCart: userProduct.add } { pushToCart: userProduct.add }
)(BasicTable); )(BasicTable);

@ -1,7 +1,6 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { userProduct, transport, userFactor } from "~/Redux/actions"; import { userProduct, transport, userFactor } from "~/Redux/actions";
import { ToastContainer } from "react-toastify";
import Navbar from "../Home/Navbar/index"; import Navbar from "../Home/Navbar/index";
import Footer from "../Home/Footer/index"; import Footer from "../Home/Footer/index";
@ -44,12 +43,19 @@ class Cart extends Component {
discount: 0, discount: 0,
totalPrice: null, totalPrice: null,
list: this.props.list, list: this.props.list,
controlFactorInfoRepeat: true,
}; };
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
if (this.props.list.length > 0) { if (this.props.list.length > 0) {
if (this.props.factorInfo === null) { if (
this.props.factorInfo === null &&
this.state.controlFactorInfoRepeat
) {
this.props.getFactorInfo({ id: this.props.list[0].factorId }); this.props.getFactorInfo({ id: this.props.list[0].factorId });
this.setState({
controlFactorInfoRepeat: false,
});
} }
let wantedId; //should be zero let wantedId; //should be zero
for (let item of this.props.list) { for (let item of this.props.list) {
@ -65,7 +71,7 @@ class Cart extends Component {
} }
componentDidMount() { componentDidMount() {
this.props.getList(); window.scrollTo(0, 0);
this.props.getTransportList(); this.props.getTransportList();
} }
@ -101,11 +107,12 @@ class Cart extends Component {
}; };
render() { render() {
const { list, payPrice, payMethods, factorInfo } = this.props; const { list, payPrice, payMethods, factorInfo, userId, hasPhysical } =
this.props;
return ( return (
<> <>
{window.innerWidth > 1000 ? ( {window.innerWidth > 1000 ? (
list ? ( list.length > 0 ? (
<> <>
<div className="cart d-flex flex-column"> <div className="cart d-flex flex-column">
<Navbar /> <Navbar />
@ -128,33 +135,47 @@ class Cart extends Component {
/> />
</section> </section>
<section className="cart__left d-flex flex-column p-3"> <section className="cart__left d-flex flex-column p-3">
<header className="cart__left--header d-flex flex-column"> {hasPhysical ? (
<h2 style={{ fontSize: fontSize.desktop.h2 }}> <header className="cart__left--header d-flex flex-column">
روشهای ارسال <h2 style={{ fontSize: fontSize.desktop.h2 }}>
</h2> روشهای ارسال
<div className="d-flex justify-content-between"> </h2>
{payMethods.map((item, i) => ( <div className="d-flex justify-content-between">
<DeliveryMethod data={item} key={i} parent={this} /> {payMethods.map((item, i) => (
))} <DeliveryMethod
data={item}
key={i}
parent={this}
transportId={
factorInfo ? factorInfo.transportId : null
}
/>
))}
</div>
</header>
) : null}
{factorInfo ? <DiscoutCode /> : null}
{factorInfo ? <Factor parent={this} list={list} /> : null}
{factorInfo ? (
<div className="cart__totalPrice d-flex align-items-center justify-content-center">
<h3 style={{ fontSize: fontSize.mobile.h2 }}>
جمع کل
<br />
سبد خرید
</h3>
<div className="d-flex align-items-center">
<strong style={{ fontSize: fontSize.mobile.h1 }}>
{factorInfo.sumPrice +
factorInfo.transportPrice -
factorInfo.offPrice}
</strong>
<span style={{ fontSize: fontSize.mobile.h3 }}>
تومان
</span>
</div>
</div> </div>
</header> ) : null}
<DiscoutCode />
<Factor parent={this} list={list} />
<div className="cart__totalPrice d-flex align-items-center justify-content-center">
<h3 style={{ fontSize: fontSize.mobile.h2 }}>
جمع کل
<br />
سبد خرید
</h3>
<div className="d-flex align-items-center">
<strong style={{ fontSize: fontSize.mobile.h1 }}>
{payPrice}
</strong>
<span style={{ fontSize: fontSize.mobile.h3 }}>
تومان
</span>
</div>
</div>
{/* <div className="cart__left--header d-flex flex-column mt-3"> {/* <div className="cart__left--header d-flex flex-column mt-3">
<h2 style={{ fontSize: fontSize.desktop.h2 }}> <h2 style={{ fontSize: fontSize.desktop.h2 }}>
روشهای ارسال روشهای ارسال
@ -168,7 +189,12 @@ class Cart extends Component {
))} ))}
</div> </div>
</div> */} </div> */}
<button className="cart__left--submit">پرداخت</button> <button
className="cart__left--submit"
onClick={() => this.props.payFactor({ userId: userId })}
>
پرداخت
</button>
</section> </section>
</div> </div>
</div> </div>
@ -184,7 +210,7 @@ class Cart extends Component {
) )
) : null} ) : null}
{window.innerWidth < 1000 ? ( {window.innerWidth < 1000 ? (
list ? ( list.length > 0 ? (
<div className="mobile-cart d-flex flex-column"> <div className="mobile-cart d-flex flex-column">
<Navbar /> <Navbar />
<h1 style={{ fontSize: fontSize.mobile.h1 }}>سبد خرید</h1> <h1 style={{ fontSize: fontSize.mobile.h1 }}>سبد خرید</h1>
@ -215,19 +241,24 @@ class Cart extends Component {
</div> </div>
</div> </div>
<DiscoutCode parent={this} /> <DiscoutCode parent={this} />
<Factor parent={this} list={list} /> {factorInfo ? <Factor parent={this} list={list} /> : null}
<div className="mobile-cart__totalPrice d-flex align-items-center justify-content-center">
<div className="mobile-cart__totalPrice d-flex align-items-center justify-content-center mt-2">
<h3 style={{ fontSize: fontSize.mobile.h2 }}> <h3 style={{ fontSize: fontSize.mobile.h2 }}>
جمع کل جمع کل
<br /> <br />
سبد خرید سبد خرید
</h3> </h3>
<div className="d-flex align-items-center"> {factorInfo ? (
<strong style={{ fontSize: fontSize.mobile.h1 }}> <div className="d-flex align-items-center">
{payPrice} <strong style={{ fontSize: fontSize.mobile.h1 }}>
</strong> {factorInfo.sumPrice +
<span style={{ fontSize: fontSize.mobile.h3 }}>تومان</span> factorInfo.transportPrice -
</div> factorInfo.offPrice}
</strong>
<span style={{ fontSize: fontSize.mobile.h3 }}>تومان</span>
</div>
) : null}
</div> </div>
{/* <div className="mobile-cart__payMethods d-flex flex-column"> {/* <div className="mobile-cart__payMethods d-flex flex-column">
<h2 style={{ fontSize: fontSize.mobile.h2 }}>روشهای ارسال</h2> <h2 style={{ fontSize: fontSize.mobile.h2 }}>روشهای ارسال</h2>
@ -252,17 +283,6 @@ class Cart extends Component {
</div> </div>
) )
) : null} ) : null}
<ToastContainer
position="bottom-right"
autoClose={1500}
hideProgressBar={true}
newestOnTop={true}
closeOnClick
rtl={true}
pauseOnFocusLoss
draggable
pauseOnHover
/>
</> </>
); );
} }
@ -274,11 +294,14 @@ export default connect(
payPrice: state.userProduct.sum, payPrice: state.userProduct.sum,
payMethods: state.transport.list, payMethods: state.transport.list,
factorInfo: state.userFactor.info, factorInfo: state.userFactor.info,
userId: state.user.status.id,
hasPhysical: state.userProduct.hasPhysical,
}), }),
{ {
getList: userProduct.list, getList: userProduct.list,
getInfo: userProduct.info, getInfo: userProduct.info,
getTransportList: transport.list, getTransportList: transport.list,
getFactorInfo: userFactor.info, getFactorInfo: userFactor.info,
payFactor: userFactor.payment,
} }
)(Cart); )(Cart);

@ -2,7 +2,7 @@
width: 100vw; width: 100vw;
max-width: 1250px; max-width: 1250px;
margin: 0px auto; margin: 0px auto;
padding: 0px; padding: 0px 10px;
font-family: numeralLight; font-family: numeralLight;
padding-top: 85px; padding-top: 85px;
&__totalPrice { &__totalPrice {

@ -1,133 +1,330 @@
import React from 'react'; import React from "react";
import PropTypes from 'prop-types'; import PropTypes from "prop-types";
import { makeStyles } from '@material-ui/core/styles'; import { makeStyles } from "@material-ui/core/styles";
import AppBar from '@material-ui/core/AppBar'; import AppBar from "@material-ui/core/AppBar";
import Tabs from '@material-ui/core/Tabs'; import Tabs from "@material-ui/core/Tabs";
import Tab from '@material-ui/core/Tab'; import Tab from "@material-ui/core/Tab";
import Typography from '@material-ui/core/Typography'; import Typography from "@material-ui/core/Typography";
import Box from '@material-ui/core/Box'; import Box from "@material-ui/core/Box";
import './index.scss'; import "./index.scss";
const Smileys = [ const Smileys = [
'😃', "😃",
'😃', "😃",
'😄', "😄",
'😁', "😁",
'😆', "😆",
'😅', "😅",
'😂', "😂",
'🤣', "🤣",
'🥲', "🥲",
'☺', "☺",
'😊', "😊",
'😇', "😇",
'🙂', "🙂",
'🙃', "🙃",
'😉', "😉",
'😌', "😌",
'😍', "😍",
'🥰', "🥰",
'😘', "😘",
'😗', "😗",
'😙', "😙",
'😚', "😚",
'😋', "😋",
'😛', "😛",
'😝', "😝",
'😜', "😜",
'🤪', "🤪",
'🤨', "🤨",
'🧐', "🧐",
'🤓', "🤓",
'😎', "😎",
'🥸', "🥸",
'🤩', "🤩",
'🥳', "🥳",
'😏', "😏",
'😒', "😒",
'😞', "😞",
'😔', "😔",
'😟', "😟",
'😕', "😕",
'🙁', "🙁",
'☹', "☹",
'😣', "😣",
'😖', "😖",
'😫', "😫",
'😩', "😩",
'🥺', "🥺",
'😢', "😢",
'😭', "😭",
'😤', "😤",
'😠', "😠",
'😡', "😡",
'🤬', "🤬",
'🤯', "🤯",
'😳', "😳",
'🥵', "🥵",
'🥶', "🥶",
'😱', "😱",
'😨', "😨",
'😰', "😰",
'😥', "😥",
'😓', "😓",
'🤗', "🤗",
'🤔', "🤔",
'🤭', "🤭",
'🤫', "🤫",
'🤥', "🤥",
'😶', "😶",
'😐', "😐",
'😑', "😑",
'😬', "😬",
'🙄', "🙄",
'😯', "😯",
'😦', "😦",
'😧', "😧",
'😮', "😮",
'😲', "😲",
'🥱', "🥱",
'😴', "😴",
'🤤', "🤤",
'😪', "😪",
'😵', "😵",
'🤐', "🤐",
'🥴', "🥴",
'🤢', "🤢",
'🤮', "🤮",
'🤧', "🤧",
'😷', "😷",
'🤒', "🤒",
'🤕', "🤕",
'🤑', "🤑",
'🤠', "🤠",
'😈', "😈",
'👿', "👿",
'👹', "👹",
'👺', "👺",
'🤡', "🤡",
'💩', "💩",
'👻', "👻",
'💀', "💀",
'☠', "☠",
'👽', "👽",
'👾', "👾",
'🤖', "🤖",
'🎃', "🎃",
'😺', "😺",
'😸', "😸",
'😹', "😹",
'😻', "😻",
'😼', "😼",
'😽', "😽",
'🙀', "🙀",
'😿', "😿",
'😾', "😾",
]; ];
const animals = [ const animals = [
'🐶', '🐱', '🐭', '🐹', '🐰', '🦊', '🐻', '🐼', '🐻', '🐨', '🐯', '🦁', '🐮', '🐷', '🐽', '🐸', '🐵', '🙈', '🙉', '🙊', '🐒', '🐔', '🐧', '🐦', '🐤', '🐣', '🐥', '🦆', '🦅', '🦉', '🦇', '🐺', '🐗', '🐴', '🦄', '🐝', '🪱', '🐛', '🦋', '🐌', '🐞', '🐜', '🪰', '🪲', '🪳', '🦟', '🦗', '🕷', '🕸', '🦂', '🐢', '🐍', '🦎', '🦖', '🦕', '🐙', '🦑', '🦐', '🦞', '🦀', '🐡', '🐠', '🐟', '🐬', '🐳', '🐋', '🦈', '🐊', '🐅', '🐆', '🦓', '🦍', '🦧', '🦣', '🐘', '🦛', '🦏', '🐪', '🐫', '🦒', '🦘', '🦬', '🐃', '🐂', '🐄', '🐎', '🐖', '🐏', '🐑', '🦙', '🐐', '🦌', '🐕', '🐩', '🦮', '🐕🦺', '🐈', '🐈⬛', '🪶', '🐓', '🦃', '🦤', '🦚', '🦜', '🦢', '🦩', '🕊', '🐇', '🦝', '🦨', '🦡', '🦫', '🦦', '🦥', '🐁', '🐀', '🐿', '🦔', '🐾', '🐉', '🐲', '🌵', '🎄', '🌲', '🌳', '🌴', '🪵', '🌱', '🌿', '☘', '🍀', '🎍', '🪴', '🎋', '🍃', '🍂', '🍁', '🍄', '🐚', '🪨', '🌾', '💐', '🌷', '🌹', '🥀', '🌺', '🌸', '🌼', '🌻', '🌞', '🌝', '🌛', '🌜', '🌚', '🌕', '🌖', '🌗', '🌘', '🌑', '🌒', '🌓', '🌔', '🌙', '🌎', '🌍', '🌏', '🪐 ', '💫', '⭐', '🌟', '✨', '⚡', '☄', '💥', '🔥', '🌪', '🌈', '☀', '🌤', '⛅', '🌥', '☁', '🌦', '🌧', '⛈', '🌩', '🌨', '❄', '☃', '⛄', '🌬', '💨', '💧', '💦', '☔', '☂', '🌊', '🌫' "🐶",
"🐱",
"🐭",
"🐹",
"🐰",
"🦊",
"🐻",
"🐼",
"🐻",
"🐨",
"🐯",
"🦁",
"🐮",
"🐷",
"🐽",
"🐸",
"🐵",
"🙈",
"🙉",
"🙊",
"🐒",
"🐔",
"🐧",
"🐦",
"🐤",
"🐣",
"🐥",
"🦆",
"🦅",
"🦉",
"🦇",
"🐺",
"🐗",
"🐴",
"🦄",
"🐝",
"🪱",
"🐛",
"🦋",
"🐌",
"🐞",
"🐜",
"🪰",
"🪲",
"🪳",
"🦟",
"🦗",
"🕷",
"🕸",
"🦂",
"🐢",
"🐍",
"🦎",
"🦖",
"🦕",
"🐙",
"🦑",
"🦐",
"🦞",
"🦀",
"🐡",
"🐠",
"🐟",
"🐬",
"🐳",
"🐋",
"🦈",
"🐊",
"🐅",
"🐆",
"🦓",
"🦍",
"🦧",
"🦣",
"🐘",
"🦛",
"🦏",
"🐪",
"🐫",
"🦒",
"🦘",
"🦬",
"🐃",
"🐂",
"🐄",
"🐎",
"🐖",
"🐏",
"🐑",
"🦙",
"🐐",
"🦌",
"🐕",
"🐩",
"🦮",
"🐕🦺",
"🐈",
"🐈⬛",
"🪶",
"🐓",
"🦃",
"🦤",
"🦚",
"🦜",
"🦢",
"🦩",
"🕊",
"🐇",
"🦝",
"🦨",
"🦡",
"🦫",
"🦦",
"🦥",
"🐁",
"🐀",
"🐿",
"🦔",
"🐾",
"🐉",
"🐲",
"🌵",
"🎄",
"🌲",
"🌳",
"🌴",
"🪵",
"🌱",
"🌿",
"☘",
"🍀",
"🎍",
"🪴",
"🎋",
"🍃",
"🍂",
"🍁",
"🍄",
"🐚",
"🪨",
"🌾",
"💐",
"🌷",
"🌹",
"🥀",
"🌺",
"🌸",
"🌼",
"🌻",
"🌞",
"🌝",
"🌛",
"🌜",
"🌚",
"🌕",
"🌖",
"🌗",
"🌘",
"🌑",
"🌒",
"🌓",
"🌔",
"🌙",
"🌎",
"🌍",
"🌏",
"🪐 ",
"💫",
"⭐",
"🌟",
"✨",
"⚡",
"☄",
"💥",
"🔥",
"🌪",
"🌈",
"☀",
"🌤",
"⛅",
"🌥",
"☁",
"🌦",
"🌧",
"⛈",
"🌩",
"🌨",
"❄",
"☃",
"⛄",
"🌬",
"💨",
"💧",
"💦",
"☔",
"☂",
"🌊",
"🌫",
]; ];
function TabPanel(props) { function TabPanel(props) {
@ -159,21 +356,21 @@ TabPanel.propTypes = {
function a11yProps(index) { function a11yProps(index) {
return { return {
id: `scrollable-force-tab-${index}`, id: `scrollable-force-tab-${index}`,
'aria-controls': `scrollable-force-tabpanel-${index}`, "aria-controls": `scrollable-force-tabpanel-${index}`,
}; };
} }
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
flexGrow: 1, flexGrow: 1,
width: '100%', width: "100%",
backgroundColor: theme.palette.background.paper, backgroundColor: theme.palette.background.paper,
flexDirection: 'row-reverse' flexDirection: "row-reverse",
}, },
list: { list: {
flex: 1, flex: 1,
width: '100%', width: "100%",
flexDirection: 'row-reverse' flexDirection: "row-reverse",
}, },
})); }));
@ -184,7 +381,6 @@ export default function ScrollableTabsButtonForce(props) {
const handleChange = (event, newValue) => { const handleChange = (event, newValue) => {
setValue(newValue); setValue(newValue);
}; };
console.log(props.emojies[0]);
return ( return (
<div className={classes.root}> <div className={classes.root}>
<AppBar position="static" color="default"> <AppBar position="static" color="default">
@ -205,8 +401,15 @@ export default function ScrollableTabsButtonForce(props) {
{props.emojies.map((item) => ( {props.emojies.map((item) => (
<TabPanel value={value} index={item.id}> <TabPanel value={value} index={item.id}>
<div className="d-flex flex-wrap"> <div className="d-flex flex-wrap">
{item.list.map((jojo,i) => ( {item.list.map((jojo, i) => (
<span value={jojo} onClick={() => props.typeText('emoji',jojo)} style={{fontSize: 24, width: 30, height:30 }} className="m-1">{jojo}</span> <span
value={jojo}
onClick={() => props.typeText("emoji", jojo)}
style={{ fontSize: 24, width: 30, height: 30 }}
className="m-1"
>
{jojo}
</span>
))} ))}
</div> </div>
</TabPanel> </TabPanel>
@ -217,8 +420,7 @@ export default function ScrollableTabsButtonForce(props) {
ScrollableTabsButtonForce.defaultProps = { ScrollableTabsButtonForce.defaultProps = {
emojies: [ emojies: [
{ type: 'Smileys', list: Smileys, id: 0 }, { type: "Smileys", list: Smileys, id: 0 },
{ type: 'Animals', list: animals, id: 1 }, { type: "Animals", list: animals, id: 1 },
], ],
}; };

@ -5,7 +5,6 @@ import Keyboard from "./Keyboard";
import { RecordState } from "audio-react-recorder"; import { RecordState } from "audio-react-recorder";
import ReactPlayer from "react-player"; import ReactPlayer from "react-player";
import ReactAudioPlayer from "react-audio-player"; import ReactAudioPlayer from "react-audio-player";
import { ToastContainer } from "react-toastify";
// import { list, send, sendKeys } from "../../../Redux/actions/message"; // import { list, send, sendKeys } from "../../../Redux/actions/message";
import { chat } from "../../../Redux/actions"; import { chat } from "../../../Redux/actions";
import { connect } from "react-redux"; import { connect } from "react-redux";
@ -506,17 +505,6 @@ class List extends Component {
</div> </div>
) : null} ) : null}
</div> </div>
<ToastContainer
position="top-center"
autoClose={1500}
hideProgressBar={true}
newestOnTop={true}
closeOnClick
rtl={true}
pauseOnFocusLoss
draggable
pauseOnHover
/>
</div> </div>
) : null} ) : null}
{window.innerWidth > 1000 ? ( {window.innerWidth > 1000 ? (
@ -629,17 +617,6 @@ class List extends Component {
</div> </div>
) : null} ) : null}
</div> </div>
<ToastContainer
position="top-center"
autoClose={1500}
hideProgressBar={true}
newestOnTop={true}
closeOnClick
rtl={true}
pauseOnFocusLoss
draggable
pauseOnHover
/>
</div> </div>
) : null} ) : null}
</> </>
@ -655,5 +632,5 @@ export default connect(
last: state.message.list.slice(-1)[0] || {}, last: state.message.list.slice(-1)[0] || {},
}; };
}, },
{ info : chat.info , bio : chat.bio } { info: chat.info, bio: chat.bio }
)(List); )(List);

@ -1,13 +1,16 @@
import React from 'react'; import React from "react";
import Info from '../Info/index'; import Info from "../Info/index";
import './index.scss'; import "./index.scss";
export default function PersistentDrawerLeft(props) { export default function PersistentDrawerLeft(props) {
console.log(props.open);
return ( return (
<div className={`custom-drawer d-flex ${props.open ? 'custom-drawer-active' : ''}`}> <div
className={`custom-drawer d-flex ${
props.open ? "custom-drawer-active" : ""
}`}
>
<Info parent={props.parent} /> <Info parent={props.parent} />
</div> </div>
); );
} }

@ -46,11 +46,11 @@ class Contact extends Component {
} }
render() { render() {
const { contactData } = this.props; const { contactData, loading } = this.props;
return ( return (
<> <>
{window.innerWidth > 1000 ? ( {window.innerWidth > 1000 ? (
contactData ? ( !loading ? (
<> <>
<div className="contact d-flex flex-column align-items-center"> <div className="contact d-flex flex-column align-items-center">
<Navbar page={"contact"} /> <Navbar page={"contact"} />
@ -117,7 +117,7 @@ class Contact extends Component {
) )
) : null} ) : null}
{window.innerWidth < 1000 ? ( {window.innerWidth < 1000 ? (
contactData ? ( !loading ? (
<div className="mobile-contact d-flex flex-column align-items-center"> <div className="mobile-contact d-flex flex-column align-items-center">
<Navbar page={"contact"} /> <Navbar page={"contact"} />
<div className="mobile-contact__form d-flex flex-column"> <div className="mobile-contact__form d-flex flex-column">
@ -209,6 +209,7 @@ export default connect(
loading: state.publicApi.loading, loading: state.publicApi.loading,
contactData: state.publicApi.contactData, contactData: state.publicApi.contactData,
list: state.userProduct.list, list: state.userProduct.list,
loading: state.publicApi.loading,
}), }),
{ getContactData: publicApi.getContactData, getList: userProduct.list } { getContactData: publicApi.getContactData, getList: userProduct.list }
)(Contact); )(Contact);

@ -1,4 +1,6 @@
import React, { Component } from "react"; import React, { Component } from "react";
import proxy from "~/Redux/proxy";
import { toast } from "react-toastify";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { publicApi } from "~/Redux/actions"; import { publicApi } from "~/Redux/actions";
@ -83,11 +85,11 @@ class Faq extends Component {
}; };
render() { render() {
const { faqList, searchResult, loading } = this.props; const { faqList, searchResult } = this.props;
return ( return (
<> <>
{window.innerWidth > 1000 ? ( {window.innerWidth > 1000 ? (
!loading ? ( faqList.length > 0 ? (
<> <>
<div className="faq d-flex flex-column align-items-center"> <div className="faq d-flex flex-column align-items-center">
<Navbar page={"faq"} /> <Navbar page={"faq"} />

@ -46,16 +46,20 @@ const useStyles = makeStyles((theme) => ({
export default function CustomizedSelects(props) { export default function CustomizedSelects(props) {
const classes = useStyles(); const classes = useStyles();
const [age, setAge] = React.useState(""); const [age, setAge] = React.useState("");
const handleChange = (event) => { const { name, parent, options } = props;
setAge(event.target.value);
};
return ( return (
<div className="home-search__select mr-2"> <div className="home-search__select mr-2">
<FormControl className={classes.margin}> <FormControl className={classes.margin}>
<NativeSelect <NativeSelect
id="demo-customized-select-native" id="demo-customized-select-native"
value={age} onChange={(e) =>
onChange={handleChange} parent.setState({
filters: {
...parent.state.filters,
[name]: e.target.value === "همه" ? [] : [e.target.value],
},
})
}
input={<BootstrapInput />} input={<BootstrapInput />}
> >
{props.options.map((item, i) => ( {props.options.map((item, i) => (

@ -1,12 +1,30 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { connect } from "react-redux";
import { publicApi } from "~/Redux/actions";
import Select from "./Select/index"; import Select from "./Select/index";
import dropdown from "../../../assets/icons/dropdown.png"; import dropdown from "../../../assets/icons/dropdown.png";
import "./index.scss"; import "./index.scss";
export default class HomeSearch extends Component { class HomeSearch extends Component {
state = {
filters: {
levels: [],
search: null,
},
};
componentDidUpdate(prevProps, prevState) {
if (
prevState.filters.levels !== this.state.filters.levels ||
prevState.filters.search !== this.state.filters.search
) {
this.props.filterNewProducts(this.state.filters);
}
}
render() { render() {
const { height, data } = this.props; const { height, levels } = this.props;
return ( return (
<div className="home-search d-flex"> <div className="home-search d-flex">
<input <input
@ -14,9 +32,14 @@ export default class HomeSearch extends Component {
className="home-search__input d-flex" className="home-search__input d-flex"
type="text" type="text"
name="search" name="search"
onChange={(e) =>
this.setState({
filters: { ...this.state.filters, search: e.target.value },
})
}
/> />
<div className="home-search__select"> <div className="home-search__select">
<Select options={data} /> <Select options={levels} name="levels" parent={this} />
<img src={dropdown} alt="فلش" /> <img src={dropdown} alt="فلش" />
</div> </div>
<button className="home-search__submit">جستجو</button> <button className="home-search__submit">جستجو</button>
@ -24,3 +47,10 @@ export default class HomeSearch extends Component {
); );
} }
} }
export default connect(
(state) => ({
levels: state.publicApi.levels,
}),
{ filterNewProducts: publicApi.filterNewProducts }
)(HomeSearch);

@ -4,7 +4,7 @@
box-shadow: 0px 0px 5px rgb(200, 200, 200); box-shadow: 0px 0px 5px rgb(200, 200, 200);
border-radius: 7px; border-radius: 7px;
justify-content: space-between; justify-content: space-between;
align-items:center; align-items: center;
flex: 1; flex: 1;
margin-top: 20px; margin-top: 20px;
font-family: numeralLight; font-family: numeralLight;
@ -51,7 +51,7 @@
&__select { &__select {
position: relative; position: relative;
margin-left: 20px; margin-left: 20px;
& img{ & img {
position: absolute; position: absolute;
left: 27px; left: 27px;
top: 12px; top: 12px;
@ -64,6 +64,6 @@
background-color: #7dc241; background-color: #7dc241;
color: white; color: white;
border-radius: 5px; border-radius: 5px;
padding : 7px 50px; padding: 7px 50px;
} }
} }

@ -1,8 +1,9 @@
import React, { Component } from "react"; import React, { Component } from "react";
import Input from "./Input/index"; import Input from "./Input/index";
import "./index.scss"; import "./index.scss";
export default class Membership extends Component { class Membership extends Component {
render() { render() {
return ( return (
<> <>
@ -44,3 +45,5 @@ export default class Membership extends Component {
); );
} }
} }
export default Membership;

@ -46,7 +46,6 @@ export default class SingleBlog extends Component {
const Identifier = (props) => { const Identifier = (props) => {
const { data } = props; const { data } = props;
console.log(data);
return ( return (
<> <>
{data.type === "audio" ? ( {data.type === "audio" ? (

@ -38,6 +38,7 @@ import Loader from "~/components/Loader/index";
import "./index.scss"; import "./index.scss";
class Home extends Component { class Home extends Component {
componentDidMount() { componentDidMount() {
window.scrollTo(0, 0);
if (window.innerWidth < 1000) { if (window.innerWidth < 1000) {
this.props.getHomeData({ device: 2 }); this.props.getHomeData({ device: 2 });
} else { } else {

@ -28,59 +28,78 @@ const fontSize = {
class MyBooks extends React.Component { class MyBooks extends React.Component {
componentDidMount() { componentDidMount() {
this.props.getList(); this.props.getList();
window.scrollTo(0, 0);
} }
render() { render() {
const { list, checkEmpty } = this.props; const { list, checkEmpty, loading } = this.props;
return ( return (
<> <>
{window.innerWidth > 1000 ? ( {window.innerWidth > 1000 ? (
<> !loading ? (
<div className="mybooks d-flex flex-column"> <>
<Navbar /> <div className="mybooks d-flex flex-column">
<BreadCrumbs /> <Navbar />
<div className="mybooks__list d-flex flex-wrap p-1"> <BreadCrumbs />
{!checkEmpty ? ( <div className="mybooks__list d-flex flex-wrap p-1">
list.map((item, i) => <Item data={item} key={i} id={i} />) {!checkEmpty ? (
) : ( list.map((item, i) => <Item data={item} key={i} id={i} />)
<div ) : (
className="mybooks__list--empty d-flex flex-column justify-content-center align-items-center" <div
style={{ width: "100vw", height: "calc(100vh - 400px)" }} className="mybooks__list--empty d-flex flex-column justify-content-center align-items-center"
> style={{ width: "100vw", height: "calc(100vh - 400px)" }}
<p style={{ fontSize: fontSize.desktop.p }}> >
برای استفاده از این بخش باید یک کتاب فعال خریداری کرده <p style={{ fontSize: fontSize.desktop.p }}>
باشید برای استفاده از این بخش باید یک کتاب فعال خریداری کرده
</p> باشید
<Link to="/products">فروشگاه</Link> </p>
</div> <Link to="/products">فروشگاه</Link>
)} </div>
)}
</div>
</div> </div>
<Footer />
</>
) : (
<div
className="d-flex justify-content-center align-items-center"
style={{ height: "100vh", width: "100vw" }}
>
<Loader />
</div> </div>
<Footer /> )
</>
) : null} ) : null}
{window.innerWidth < 1000 ? ( {window.innerWidth < 1000 ? (
<> !loading ? (
<div className="mobile-products d-flex flex-column"> <>
<Navbar /> <div className="mobile-products d-flex flex-column">
<div className="d-flex flex-wrap p-1"> <Navbar />
{!checkEmpty ? ( <div className="d-flex flex-wrap p-1">
list.map((item, i) => <Item data={item} key={i} id={i} />) {!checkEmpty ? (
) : ( list.map((item, i) => <Item data={item} key={i} id={i} />)
<div ) : (
className="mobile-products__empty d-flex flex-column justify-content-center align-items-center text-center" <div
style={{ height: "calc(100vh - 100px)", width: "100vw" }} className="mobile-products__empty d-flex flex-column justify-content-center align-items-center text-center"
> style={{ height: "calc(100vh - 100px)", width: "100vw" }}
<p style={{ fontSize: fontSize.mobile.p }}> >
برای استفاده از این بخش باید یک کتاب فعال خریداری کرده <p style={{ fontSize: fontSize.mobile.p }}>
باشید برای استفاده از این بخش باید یک کتاب فعال خریداری کرده
</p> باشید
<Link to="/products">فروشگاه</Link> </p>
</div> <Link to="/products">فروشگاه</Link>
)} </div>
)}
</div>
</div> </div>
</>
) : (
<div
className="d-flex justify-content-center align-items-center"
style={{ height: "100vh", width: "100vw" }}
>
<Loader />
</div> </div>
</> )
) : null} ) : null}
</> </>
); );

@ -1,4 +1,6 @@
import React, { Component } from "react"; import React, { Component } from "react";
import proxy from "~/Redux/proxy";
import { toast } from "react-toastify";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { userProduct } from "~/Redux/actions"; import { userProduct } from "~/Redux/actions";
@ -72,14 +74,16 @@ function AddToCart(props) {
style={{ fontSize: fontSize.desktop.button }} style={{ fontSize: fontSize.desktop.button }}
className="product-addtocart__box--addButton" className="product-addtocart__box--addButton"
onClick={() => onClick={() =>
props.pushToCart({ proxy.status()
productId: ? props.pushToCart({
page === "digital" productId:
? info.product[0].id page === "digital"
: info.product[1].id, ? info.product[0].id
userId: props.id, : info.product[1].id,
count: 1, userId: props.id,
}) count: 1,
})
: toast.info("ابتدا وارد حساب کاربری خود شوید.")
} }
> >
افزودن به سبد خرید افزودن به سبد خرید

@ -38,7 +38,7 @@
img { img {
position: absolute; position: absolute;
left: 13px; left: 13px;
top: 13px; top: 10px;
transform: scale(0.9); transform: scale(0.9);
} }
} }

@ -1,5 +1,6 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { ToastContainer, toast } from "react-toastify"; import { toast } from "react-toastify";
import proxy from "~/Redux/proxy";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { connect } from "react-redux"; import { connect } from "react-redux";
@ -53,6 +54,7 @@ class Product extends Component {
]; ];
componentDidMount() { componentDidMount() {
window.scrollTo(0, 0);
this.props.getInfo({ this.props.getInfo({
id: window.location.pathname.slice( id: window.location.pathname.slice(
window.location.pathname.lastIndexOf("/") + 1, window.location.pathname.lastIndexOf("/") + 1,
@ -186,14 +188,16 @@ class Product extends Component {
</div> </div>
<button <button
onClick={() => onClick={() =>
this.props.pushToCart({ proxy.status()
productId: ? this.props.pushToCart({
page === "digital" productId:
? info.product[0].id page === "digital"
: info.product[1].id, ? info.product[0].id
userId: this.props.id, : info.product[1].id,
count: 1, userId: this.props.id,
}) count: 1,
})
: toast.info("ابتدا وارد حساب کاربری خود شوید.")
} }
className="mobile-product__header--sampleButton" className="mobile-product__header--sampleButton"
style={{ fontSize: fontSize.mobile.a }} style={{ fontSize: fontSize.mobile.a }}
@ -297,17 +301,6 @@ class Product extends Component {
</div> </div>
) )
) : null} ) : null}
<ToastContainer
position="top-right"
autoClose={2000}
hideProgressBar={true}
newestOnTop={true}
closeOnClick
rtl={true}
pauseOnFocusLoss
draggable
pauseOnHover
/>
</> </>
); );
} }
@ -358,17 +351,6 @@ const Identifier = (props) => {
data={props.item} data={props.item}
/> />
) : null} ) : null}
<ToastContainer
position="bottom-right"
autoClose={1500}
hideProgressBar={true}
newestOnTop={true}
closeOnClick
rtl={true}
pauseOnFocusLoss
draggable
pauseOnHover
/>
</> </>
); );
}; };

@ -12,10 +12,10 @@ class List extends React.Component {
} }
render() { render() {
const { list, search, searchResult, filterResult } = this.props; const { list, filterResult, loading } = this.props;
return window.innerWidth > 1000 ? ( return window.innerWidth > 1000 ? (
<div className="products-list d-flex flex-wrap"> <div className="products-list d-flex flex-wrap">
{list.length > 0 ? ( {!loading ? (
filterResult.length > 0 || localStorage.getItem("filter") ? ( filterResult.length > 0 || localStorage.getItem("filter") ? (
filterResult.map((item, i) => <Product product={item} key={i} />) filterResult.map((item, i) => <Product product={item} key={i} />)
) : ( ) : (
@ -33,7 +33,7 @@ class List extends React.Component {
) : ( ) : (
<> <>
<div className="mobile-products-list d-flex flex-wrap"> <div className="mobile-products-list d-flex flex-wrap">
{list.length > 0 ? ( {!loading ? (
filterResult.length > 0 || localStorage.getItem("filter") ? ( filterResult.length > 0 || localStorage.getItem("filter") ? (
filterResult.map((item, i) => <Product product={item} key={i} />) filterResult.map((item, i) => <Product product={item} key={i} />)
) : ( ) : (

@ -15,6 +15,7 @@ import Filters from "./Filters/index";
import navbarSearch from "../../assets/icons/navbarSearch.png"; import navbarSearch from "../../assets/icons/navbarSearch.png";
import "./index.scss"; import "./index.scss";
import { toast } from "react-toastify";
const maxMobileSize = 1250; const maxMobileSize = 1250;
@ -54,7 +55,16 @@ class Products extends Component {
} }
componentDidMount() { componentDidMount() {
window.scrollTo(0, 0);
localStorage.removeItem("filter"); localStorage.removeItem("filter");
if (
window.location.search.slice(
window.location.search.lastIndexOf("?") + 1,
window.location.search.length
) === "cart"
) {
toast.info("ابتدا یک محصول به سبد خریدتان اضافه کنید.");
}
} }
render() { render() {

@ -35,7 +35,6 @@ export default function QRImage(props) {
}; };
const closeModal = (val) => { const closeModal = (val) => {
console.log(val);
setOpen(false); setOpen(false);
}; };

@ -63,6 +63,7 @@ class QR extends Component {
}; };
componentDidMount() { componentDidMount() {
window.scrollTo(0, 0);
if (window.location.search) { if (window.location.search) {
let tail = window.location.search.slice( let tail = window.location.search.slice(
window.location.search.lastIndexOf("=") + 1, window.location.search.lastIndexOf("=") + 1,

Loading…
Cancel
Save