diff --git a/src/App.js b/src/App.js index 48c40aa..db96b54 100644 --- a/src/App.js +++ b/src/App.js @@ -1,4 +1,5 @@ import React, { Component } from "react"; +import { ToastContainer } from "react-toastify"; import AppRouter from "./AppRouter"; import store from "./Redux/store"; import { Provider } from "react-redux"; @@ -10,6 +11,17 @@ class App extends Component { return ( + ); } diff --git a/src/AppRouter.js b/src/AppRouter.js index a669cbc..dd5ab02 100644 --- a/src/AppRouter.js +++ b/src/AppRouter.js @@ -8,6 +8,7 @@ import { } from "react-router-dom"; import { connect } from "react-redux"; import { user } from "~/Redux/actions"; +import { userProduct } from "~/Redux/actions"; import proxy from "./Redux/proxy"; import Home from "./views/Home/index"; @@ -35,10 +36,33 @@ class AppRouter extends Component { constructor(props) { super(props); window.router = this; + this.state = { + cartControll: false, + }; } 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() { const mobile = window.innerWidth < 1000 ? true : false; let home = mobile ? ( @@ -70,12 +94,18 @@ class AppRouter extends Component { ) : ( ) - ) : ( + ) : proxy.status() ? ( + ) : ( + )} @@ -85,7 +115,7 @@ class AppRouter extends Component { ) : ( ) @@ -93,32 +123,126 @@ class AppRouter extends Component { )} - - - + {mobile ? ( + proxy.status() ? ( + + ) : ( + + ) + ) : ( + + )} - + {mobile ? ( + proxy.status() ? ( + + ) : ( + + ) + ) : ( + + )} - + {mobile ? ( + proxy.status() ? ( + + ) : ( + + ) + ) : ( + + )} - + {mobile ? ( + proxy.status() ? ( + + ) : ( + + ) + ) : ( + + )} - + {mobile ? ( + proxy.status() ? ( + + ) : ( + + ) + ) : ( + + )} - + {mobile ? ( + proxy.status() ? ( + + ) : ( + + ) + ) : ( + + )} - + {mobile ? ( + proxy.status() ? ( + + ) : ( + + ) + ) : ( + + )} - + {mobile ? ( + proxy.status() ? ( + + ) : ( + + ) + ) : ( + + )} @@ -135,22 +259,150 @@ class AppRouter extends Component { )} - + {mobile ? ( + proxy.status() ? ( + + ) : ( + + ) + ) : proxy.status() ? ( + + ) : ( + + )} - + {mobile ? ( + proxy.status() ? ( + + ) : ( + + ) + ) : proxy.status() ? ( + + ) : ( + + )} - + {mobile ? ( + proxy.status() ? ( + + ) : ( + + ) + ) : proxy.status() ? ( + + ) : ( + + )} - + {mobile ? ( + proxy.status() ? ( + + ) : ( + + ) + ) : proxy.status() ? ( + + ) : ( + + )} - + {mobile ? ( + proxy.status() ? ( + this.props.userProductList.length > 0 || + !this.state.cartControll ? ( + + ) : ( + + ) + ) : ( + + ) + ) : proxy.status() ? ( + !this.state.cartControll || + this.props.userProductList.length > 0 ? ( + + ) : ( + + ) + ) : ( + + )} - + {mobile ? ( + proxy.status() ? ( + + ) : ( + + ) + ) : proxy.status() ? ( + + ) : ( + + )} {mobile ? ( @@ -159,27 +411,41 @@ class AppRouter extends Component { ) : ( ) - ) : ( + ) : proxy.status() ? ( + ) : ( + )} - {mobile ? ( - - {proxy.status() ? ( + + {mobile ? ( + proxy.status() ? ( ) : ( - )} - - ) : null} + ) + ) : proxy.status() ? ( + + ) : ( + + )} + {proxy.status() ? ( ({ profile: state.user.status, + userProductList: state.userProduct.list, // status: state.user.status, }), - { getProfile: user.getProfile } + { getProfile: user.getProfile, getUserProductList: userProduct.list } )(AppRouter); diff --git a/src/Redux/actions/public.js b/src/Redux/actions/public.js index 42b44e3..1cd07ae 100644 --- a/src/Redux/actions/public.js +++ b/src/Redux/actions/public.js @@ -3,7 +3,7 @@ const publicApi = { getHomeData: (data, history) => async (dispatch) => await proxy.get("public/homePage", data, { history, 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) => await dispatch({ type: "public/faq/activate", data: data }), searchFaq: (data) => async (dispatch) => @@ -18,6 +18,8 @@ const publicApi = { await proxy.get("public/blogList", data, { history, dispatch }), getBlogInfo: (data, history) => async (dispatch) => await proxy.get("public/blogInfo", data, { history, dispatch }), + filterNewProducts: (data, history) => async (dispatch) => + await dispatch({ type: "public/filter", data: data }), }; export default publicApi; diff --git a/src/Redux/actions/transport.js b/src/Redux/actions/transport.js index d75ad2d..8b7b3b9 100644 --- a/src/Redux/actions/transport.js +++ b/src/Redux/actions/transport.js @@ -26,7 +26,6 @@ const transport = { await proxy.post("transport/setTransport", data); await proxy.get("userFactor/info", data3, { dispatch }); await proxy.get("transport/list", data2, { dispatch }); - console.log(data); }, del: (data = {}, data2 = {}) => diff --git a/src/Redux/actions/userFactor.js b/src/Redux/actions/userFactor.js index f88b7fe..e579261 100644 --- a/src/Redux/actions/userFactor.js +++ b/src/Redux/actions/userFactor.js @@ -12,7 +12,11 @@ const userFactor = { (data = {}, data2 = {}) => async (dispatch) => { 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: (data = {}, data2 = {}) => diff --git a/src/Redux/actions/userProduct.js b/src/Redux/actions/userProduct.js index ddac3f5..2436d7f 100644 --- a/src/Redux/actions/userProduct.js +++ b/src/Redux/actions/userProduct.js @@ -2,8 +2,9 @@ import proxy from "../proxy"; const userProduct = { list: (data = {}) => - async (dispatch) => - await proxy.get("userProduct/list", data, { dispatch }), + async (dispatch) => { + await proxy.get("userProduct/list", data, { dispatch }); + }, info: (data = {}) => async (dispatch) => @@ -15,10 +16,11 @@ const userProduct = { await proxy.get("userProduct/list", data2, { dispatch }); }, add: - (data = {}, data2 = {}) => + (data = {}, data2 = {}, data3 = {}) => async (dispatch) => { await proxy.post("userProduct/add", data, { dispatch }); await proxy.get("userProduct/list", data2, { dispatch }); + await proxy.get("userFactor/info", data3, { dispatch }); }, del: (data = {}, data2 = {}) => diff --git a/src/Redux/reducers/book.js b/src/Redux/reducers/book.js index 40c8415..3a01caf 100644 --- a/src/Redux/reducers/book.js +++ b/src/Redux/reducers/book.js @@ -1,5 +1,5 @@ const initialState = { - loading: true, + loading: false, error: null, list: [], info: null, diff --git a/src/Redux/reducers/public.js b/src/Redux/reducers/public.js index 57908d8..e444d63 100644 --- a/src/Redux/reducers/public.js +++ b/src/Redux/reducers/public.js @@ -1,8 +1,9 @@ const initialState = { homeData: [], + newProducts: [], levels: [], faqList: [], - loading: true, + loading: false, error: null, searchResult: [], contactData: null, @@ -50,13 +51,35 @@ export default function publicApi(state = initialState, action) { homeData: data, }; case "public/filter": - const realList = state.homeData.filter( - (item) => item.title === "جدیدترین کتاب‌های دانوین" - ).data; - const level = data.level; + const realList = + state.newProducts.length === 0 + ? state.homeData.filter( + (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; if (level.length > 0 || search) { 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 = []; if (level.length > 0) { @@ -87,7 +110,6 @@ export default function publicApi(state = initialState, action) { const bySearchFilter = search ? byLevelFilter.filter((item1) => item1.name.indexOf(search) !== -1) : byLevelFilter; - // if (sort === "گران ترین") { // finalSort = bySearchFilter.sort((item1, item2) => { // return item1.product[0].price - item2.product[0].price; @@ -95,13 +117,18 @@ export default function publicApi(state = initialState, action) { // } else { // finalSort = bySearchFilter; // } + return { ...state, loading: false, 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 }; case "public/faq/activate": return { @@ -115,7 +142,6 @@ export default function publicApi(state = initialState, action) { ), }; case "public/faq/search": - console.log(data); return { ...state, loading: false, diff --git a/src/Redux/reducers/transport.js b/src/Redux/reducers/transport.js index 95125dd..d98ee1a 100644 --- a/src/Redux/reducers/transport.js +++ b/src/Redux/reducers/transport.js @@ -1,6 +1,6 @@ import { toast } from "react-toastify"; const initialState = { - loading: true, + loading: false, error: null, list: [], info: null, diff --git a/src/Redux/reducers/user.js b/src/Redux/reducers/user.js index 825cfab..4dca89f 100644 --- a/src/Redux/reducers/user.js +++ b/src/Redux/reducers/user.js @@ -1,5 +1,5 @@ import proxy from "../proxy"; -import { ToastContainer, toast } from "react-toastify"; +import { toast } from "react-toastify"; const initialState = { status: proxy.status(), loading: false, @@ -41,13 +41,14 @@ export default function user(state = initialState, action) { return { ...state, loading: false, mothers: data, error: null }; case "user/setProfile": toast.success("تغییرات اعمال شد."); - window.location = "/"; + setTimeout(() => { + window.location = "/"; + }, 500); return { ...state, loading: false, error: null }; - ///////////// case "loading": return { ...state, loading: true }; case "error": - toast.error(data.message); + // toast.error(data.message); return { ...state, loading: false, error: data.message }; default: return state; diff --git a/src/Redux/reducers/userFactor.js b/src/Redux/reducers/userFactor.js index 43278ac..0866c5e 100644 --- a/src/Redux/reducers/userFactor.js +++ b/src/Redux/reducers/userFactor.js @@ -27,16 +27,17 @@ export default function userFactor(state = initialState, action) { case "userFactor/update": return { ...state, loading: false, error: null }; case "userFactor/add": - console.log(data); toast.success("درخواست شما با موفقیت انجام شد."); return { ...state, loading: false, error: null, sum: data.payPrice }; case "userFactor/delete": return { ...state, loading: false, error: null }; - ///////////// + case "userFactor/payment": + window.location.replace(data); + return { ...state, loading: false, error: null }; case "loading": return { ...state, loading: true }; case "error": - toast.error(data.message); + // toast.error(data.message); return { ...state, loading: false, error: data.message }; default: return state; diff --git a/src/Redux/reducers/userProduct.js b/src/Redux/reducers/userProduct.js index 6edacb2..24a67bf 100644 --- a/src/Redux/reducers/userProduct.js +++ b/src/Redux/reducers/userProduct.js @@ -7,6 +7,7 @@ const initialState = { info: null, sum: null, checkEmpty: false, + hasPhysical: false, }; export default function userProduct(state = initialState, action) { let { type, data, message } = action; @@ -15,28 +16,32 @@ export default function userProduct(state = initialState, action) { const checkEmpty = data.filter( (item) => item.condition === 2 && item.product.productType === (1 || 3) ); + const hasPhysical = + data.filter((item) => item.product.productType === 2).length > 0 + ? true + : false; return { ...state, loading: false, list: data, checkEmpty: checkEmpty.length > 0 ? false : true, error: null, + hasPhysical: hasPhysical, }; case "userProduct/info": return { ...state, loading: false, info: data, error: null }; case "userProduct/update": return { ...state, loading: false, error: null }; case "userProduct/add": - console.log(data); - toast.success("درخواست شما با موفقیت انجام شد."); + if (window.location.pathname.indexOf("products") !== -1) { + toast.success("درخواست شما با موفقیت انجام شد."); + } return { ...state, loading: false, error: null, sum: data.payPrice }; case "userProduct/delete": return { ...state, loading: false, error: null }; - ///////////// case "loading": return { ...state, loading: true }; case "error": - toast.error(data.message); return { ...state, loading: false, error: data.message }; default: return state; diff --git a/src/views/AR/index.js b/src/views/AR/index.js index b952c4a..ff9428c 100644 --- a/src/views/AR/index.js +++ b/src/views/AR/index.js @@ -21,6 +21,7 @@ const fontSize = { class AR extends Component { componentDidMount() { + window.scrollTo(0, 0); this.props.getArList(); } @@ -29,7 +30,7 @@ class AR extends Component { return ( <> {window.innerWidth > 1000 ? ( - arList ? ( + arList.length > 0 ? ( <>
@@ -48,7 +49,7 @@ class AR extends Component { ) ) : null} {window.innerWidth < 1000 ? ( - arList ? ( + arList.length ? (
diff --git a/src/views/Activation/index.js b/src/views/Activation/index.js index 8380450..7677511 100644 --- a/src/views/Activation/index.js +++ b/src/views/Activation/index.js @@ -60,7 +60,7 @@ class Activation extends Component {
console.log()} + // onSubmit={() => console.log()} > console.log()} + // onSubmit={() => console.log()} > ) ) : null} - ); } diff --git a/src/views/Auth/index.js b/src/views/Auth/index.js index 4c2222c..004dc47 100644 --- a/src/views/Auth/index.js +++ b/src/views/Auth/index.js @@ -1,5 +1,4 @@ import React, { Component } from "react"; -import { ToastContainer } from "react-toastify"; import Profile from "./Profile/index"; import Login from "./Login/index"; @@ -17,17 +16,6 @@ export default class Auth extends Component {
{this.state.page === "login" ? : null} {this.state.page === "profile" ? : null} -
); } diff --git a/src/views/Blog/index.js b/src/views/Blog/index.js index 2bb9171..fc08269 100644 --- a/src/views/Blog/index.js +++ b/src/views/Blog/index.js @@ -16,6 +16,7 @@ const maxDesktopSize = 1250; class Blog extends Component { componentDidMount() { + window.scrollTo(0, 0); this.props.getBlogInfo({ id: window.location.pathname.slice( window.location.pathname.lastIndexOf("/") + 1, @@ -123,7 +124,6 @@ export default connect( const Identifier = (props) => { const { data } = props; - console.log(data); return ( <> {data.type === "audio" ? ( diff --git a/src/views/Blogs/index.js b/src/views/Blogs/index.js index 85603ff..c9d034d 100644 --- a/src/views/Blogs/index.js +++ b/src/views/Blogs/index.js @@ -15,6 +15,7 @@ import "./index.scss"; class Blogs extends Component { componentDidMount() { + window.scrollTo(0, 0); this.props.getBlogList(); } render() { diff --git a/src/views/Callback/index.js b/src/views/Callback/index.js index c732f98..34db163 100644 --- a/src/views/Callback/index.js +++ b/src/views/Callback/index.js @@ -1,7 +1,6 @@ import React, { Component } from "react"; import { connect } from "react-redux"; import { userProduct } from "~/Redux/actions"; -import { ToastContainer } from "react-toastify"; import Navbar from "../Home/Navbar/index"; import Footer from "../Home/Footer/index"; @@ -261,17 +260,6 @@ class Callback extends Component {
) ) : null} - ); } diff --git a/src/views/Cart/DeliveryMethod/index.js b/src/views/Cart/DeliveryMethod/index.js index 9ca6aee..4d1d7d6 100644 --- a/src/views/Cart/DeliveryMethod/index.js +++ b/src/views/Cart/DeliveryMethod/index.js @@ -35,9 +35,18 @@ class DeliveryMethod extends Component {
parent.setState({ selectedDelivery: data })} + onClick={() => + setTransport( + { + factorId: factorInfo.id, + transportId: data.id, + }, + {}, + { id: list[0].factorId } + ) + } > {data.name} diff --git a/src/views/Cart/DeliveryMethod/index.scss b/src/views/Cart/DeliveryMethod/index.scss index f72dbfb..169fad3 100644 --- a/src/views/Cart/DeliveryMethod/index.scss +++ b/src/views/Cart/DeliveryMethod/index.scss @@ -31,6 +31,7 @@ margin-top: 10px; flex: 1; max-width: 45%; + cursor: pointer; h3, strong, span { diff --git a/src/views/Cart/Discount/index.js b/src/views/Cart/Discount/index.js index 66885da..13b4243 100644 --- a/src/views/Cart/Discount/index.js +++ b/src/views/Cart/Discount/index.js @@ -21,10 +21,10 @@ const fontSize = { }, }; -const DiscoutCode = ({ codeId, setCodeId }) => { +const DiscoutCode = ({ codeId, setCodeId, userId, factorId }) => { const [value, setValue] = React.useState(codeId || ""); function setOff() { - setCodeId({ codeId: value }); + setCodeId({ offCodeValue: value, userId: userId, id: factorId }); } return ( <> @@ -75,6 +75,13 @@ const DiscoutCode = ({ codeId, setCodeId }) => { ); }; -export default connect((state) => ({ codeId: state.userFactor.codeId }), { - setCodeId: userFactor.update, -})(DiscoutCode); +export default connect( + (state) => ({ + codeId: state.userFactor.info.codeId, + userId: state.user.status.id, + factorId: state.userFactor.info.id, + }), + { + setCodeId: userFactor.update, + } +)(DiscoutCode); diff --git a/src/views/Cart/Factor/index.js b/src/views/Cart/Factor/index.js index 34fbf14..0d48a39 100644 --- a/src/views/Cart/Factor/index.js +++ b/src/views/Cart/Factor/index.js @@ -1,4 +1,5 @@ import React, { Component } from "react"; +import { connect } from "react-redux"; import "./index.scss"; const maxDesktopSize = 1250; @@ -33,26 +34,25 @@ const Factor = (props) => { } return total; }; + const { factorInfo } = props; return ( <> {window.innerWidth < 1000 ? (
مبلغ سبد خرید - {totalPrice()} تومان + {factorInfo.sumPrice} تومان
هزینه ارسال - {props.parent.props.list.length - ? props.parent.state.selectedDelivery.price - : 0}{" "} + {factorInfo.transportPrice} تومان
میزان تخفیف - {props.parent.state.discount} تومان + {factorInfo.offPrice} تومان
) : null} @@ -63,7 +63,7 @@ const Factor = (props) => { مبلغ سبد خرید
- {totalPrice()} تومان + {factorInfo.sumPrice} تومان
@@ -71,9 +71,7 @@ const Factor = (props) => { هزینه ارسال - {props.parent.props.list.length - ? props.parent.state.selectedDelivery.price - : 0}{" "} + {factorInfo.transportPrice} تومان
@@ -82,7 +80,7 @@ const Factor = (props) => { میزان تخفیف - {props.parent.state.discount} تومان + {factorInfo.offPrice} تومان @@ -91,4 +89,9 @@ const Factor = (props) => { ); }; -export default Factor; +export default connect( + (state) => ({ + factorInfo: state.userFactor.info, + }), + {} +)(Factor); diff --git a/src/views/Cart/Table/index.js b/src/views/Cart/Table/index.js index 7ddf21d..315f4ff 100644 --- a/src/views/Cart/Table/index.js +++ b/src/views/Cart/Table/index.js @@ -61,7 +61,7 @@ const fontSize = { function BasicTable(props) { const classes = useStyles(); - const { list, handleCounter, handleDelete, route } = props; + const { list, handleCounter, handleDelete, route, factorInfo } = props; const sum = () => { let total = 0; for (let i = 0; i < list.length; i++) { @@ -96,13 +96,14 @@ function BasicTable(props) { id={props.id} handleDelete={handleDelete} route={route} + factorInfo={factorInfo} /> ))} - {route === "cart" ? ( + {route === "cart" && factorInfo ? ( - مبلغ کل {Math.round(props.payPrice)} + مبلغ کل {factorInfo.sumPrice} @@ -136,24 +137,27 @@ function BasicTable(props) { id={props.id} handleDelete={handleDelete} route={route} + factorInfo={factorInfo} /> ))} - - - - - - - مبلغ کل {Math.round(props.payPrice)} - - - - {sum()} محصول - - - - - + {factorInfo ? ( + + + + + + + مبلغ کل {factorInfo.sumPrice} + + + + {sum()} محصول + + + + + + ) : null} @@ -163,7 +167,7 @@ function BasicTable(props) { } const Item = (props) => { - const { data, pushToCart, handleDelete, info, id, route } = props; + const { data, pushToCart, id, route, factorInfo } = props; return ( <> {window.innerWidth < 1000 ? ( @@ -236,11 +240,15 @@ const Item = (props) => {
+
@@ -184,7 +210,7 @@ class Cart extends Component { ) ) : null} {window.innerWidth < 1000 ? ( - list ? ( + list.length > 0 ? (

سبد خرید

@@ -215,19 +241,24 @@ class Cart extends Component {
- -
+ {factorInfo ? : null} + +

جمع کل
سبد خرید

-
- - {payPrice} - - تومان -
+ {factorInfo ? ( +
+ + {factorInfo.sumPrice + + factorInfo.transportPrice - + factorInfo.offPrice} + + تومان +
+ ) : null}
{/*

روشهای ارسال

@@ -252,17 +283,6 @@ class Cart extends Component {
) ) : null} - ); } @@ -274,11 +294,14 @@ export default connect( payPrice: state.userProduct.sum, payMethods: state.transport.list, factorInfo: state.userFactor.info, + userId: state.user.status.id, + hasPhysical: state.userProduct.hasPhysical, }), { getList: userProduct.list, getInfo: userProduct.info, getTransportList: transport.list, getFactorInfo: userFactor.info, + payFactor: userFactor.payment, } )(Cart); diff --git a/src/views/Cart/index.scss b/src/views/Cart/index.scss index 67650f6..9aa7315 100644 --- a/src/views/Cart/index.scss +++ b/src/views/Cart/index.scss @@ -2,7 +2,7 @@ width: 100vw; max-width: 1250px; margin: 0px auto; - padding: 0px; + padding: 0px 10px; font-family: numeralLight; padding-top: 85px; &__totalPrice { diff --git a/src/views/ChatRoom/Body/Emoji/index.js b/src/views/ChatRoom/Body/Emoji/index.js index 0b5f1e3..1b6f2d3 100644 --- a/src/views/ChatRoom/Body/Emoji/index.js +++ b/src/views/ChatRoom/Body/Emoji/index.js @@ -1,133 +1,330 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { makeStyles } from '@material-ui/core/styles'; -import AppBar from '@material-ui/core/AppBar'; -import Tabs from '@material-ui/core/Tabs'; -import Tab from '@material-ui/core/Tab'; -import Typography from '@material-ui/core/Typography'; -import Box from '@material-ui/core/Box'; +import React from "react"; +import PropTypes from "prop-types"; +import { makeStyles } from "@material-ui/core/styles"; +import AppBar from "@material-ui/core/AppBar"; +import Tabs from "@material-ui/core/Tabs"; +import Tab from "@material-ui/core/Tab"; +import Typography from "@material-ui/core/Typography"; +import Box from "@material-ui/core/Box"; -import './index.scss'; +import "./index.scss"; const Smileys = [ - '😃', - '😃', - '😄', - '😁', - '😆', - '😅', - '😂', - '🤣', - '🥲', - '☺️', - '😊', - '😇', - '🙂', - '🙃', - '😉', - '😌', - '😍', - '🥰', - '😘', - '😗', - '😙', - '😚', - '😋', - '😛', - '😝', - '😜', - '🤪', - '🤨', - '🧐', - '🤓', - '😎', - '🥸', - '🤩', - '🥳', - '😏', - '😒', - '😞', - '😔', - '😟', - '😕', - '🙁', - '☹️', - '😣', - '😖', - '😫', - '😩', - '🥺', - '😢', - '😭', - '😤', - '😠', - '😡', - '🤬', - '🤯', - '😳', - '🥵', - '🥶', - '😱', - '😨', - '😰', - '😥', - '😓', - '🤗', - '🤔', - '🤭', - '🤫', - '🤥', - '😶', - '😐', - '😑', - '😬', - '🙄', - '😯', - '😦', - '😧', - '😮', - '😲', - '🥱', - '😴', - '🤤', - '😪', - '😵', - '🤐', - '🥴', - '🤢', - '🤮', - '🤧', - '😷', - '🤒', - '🤕', - '🤑', - '🤠', - '😈', - '👿', - '👹', - '👺', - '🤡', - '💩', - '👻', - '💀', - '☠️', - '👽', - '👾', - '🤖', - '🎃', - '😺', - '😸', - '😹', - '😻', - '😼', - '😽', - '🙀', - '😿', - '😾', + "😃", + "😃", + "😄", + "😁", + "😆", + "😅", + "😂", + "🤣", + "🥲", + "☺️", + "😊", + "😇", + "🙂", + "🙃", + "😉", + "😌", + "😍", + "🥰", + "😘", + "😗", + "😙", + "😚", + "😋", + "😛", + "😝", + "😜", + "🤪", + "🤨", + "🧐", + "🤓", + "😎", + "🥸", + "🤩", + "🥳", + "😏", + "😒", + "😞", + "😔", + "😟", + "😕", + "🙁", + "☹️", + "😣", + "😖", + "😫", + "😩", + "🥺", + "😢", + "😭", + "😤", + "😠", + "😡", + "🤬", + "🤯", + "😳", + "🥵", + "🥶", + "😱", + "😨", + "😰", + "😥", + "😓", + "🤗", + "🤔", + "🤭", + "🤫", + "🤥", + "😶", + "😐", + "😑", + "😬", + "🙄", + "😯", + "😦", + "😧", + "😮", + "😲", + "🥱", + "😴", + "🤤", + "😪", + "😵", + "🤐", + "🥴", + "🤢", + "🤮", + "🤧", + "😷", + "🤒", + "🤕", + "🤑", + "🤠", + "😈", + "👿", + "👹", + "👺", + "🤡", + "💩", + "👻", + "💀", + "☠️", + "👽", + "👾", + "🤖", + "🎃", + "😺", + "😸", + "😹", + "😻", + "😼", + "😽", + "🙀", + "😿", + "😾", ]; const animals = [ - '🐶', '🐱', '🐭', '🐹', '🐰', '🦊', '🐻', '🐼', '🐻‍❄️', '🐨', '🐯', '🦁', '🐮', '🐷', '🐽', '🐸', '🐵', '🙈', '🙉', '🙊', '🐒', '🐔', '🐧', '🐦', '🐤', '🐣', '🐥', '🦆', '🦅', '🦉', '🦇', '🐺', '🐗', '🐴', '🦄', '🐝', '🪱', '🐛', '🦋', '🐌', '🐞', '🐜', '🪰', '🪲', '🪳', '🦟', '🦗', '🕷', '🕸', '🦂', '🐢', '🐍', '🦎', '🦖', '🦕', '🐙', '🦑', '🦐', '🦞', '🦀', '🐡', '🐠', '🐟', '🐬', '🐳', '🐋', '🦈', '🐊', '🐅', '🐆', '🦓', '🦍', '🦧', '🦣', '🐘', '🦛', '🦏', '🐪', '🐫', '🦒', '🦘', '🦬', '🐃', '🐂', '🐄', '🐎', '🐖', '🐏', '🐑', '🦙', '🐐', '🦌', '🐕', '🐩', '🦮', '🐕‍🦺', '🐈', '🐈‍⬛', '🪶', '🐓', '🦃', '🦤', '🦚', '🦜', '🦢', '🦩', '🕊', '🐇', '🦝', '🦨', '🦡', '🦫', '🦦', '🦥', '🐁', '🐀', '🐿', '🦔', '🐾', '🐉', '🐲', '🌵', '🎄', '🌲', '🌳', '🌴', '🪵', '🌱', '🌿', '☘️', '🍀', '🎍', '🪴', '🎋', '🍃', '🍂', '🍁', '🍄', '🐚', '🪨', '🌾', '💐', '🌷', '🌹', '🥀', '🌺', '🌸', '🌼', '🌻', '🌞', '🌝', '🌛', '🌜', '🌚', '🌕', '🌖', '🌗', '🌘', '🌑', '🌒', '🌓', '🌔', '🌙', '🌎', '🌍', '🌏', '🪐 ', '💫', '⭐️', '🌟', '✨', '⚡️', '☄️', '💥', '🔥', '🌪', '🌈', '☀️', '🌤', '⛅️', '🌥', '☁️', '🌦', '🌧', '⛈', '🌩', '🌨', '❄️', '☃️', '⛄️', '🌬', '💨', '💧', '💦', '☔️', '☂️', '🌊', '🌫' + "🐶", + "🐱", + "🐭", + "🐹", + "🐰", + "🦊", + "🐻", + "🐼", + "🐻‍❄️", + "🐨", + "🐯", + "🦁", + "🐮", + "🐷", + "🐽", + "🐸", + "🐵", + "🙈", + "🙉", + "🙊", + "🐒", + "🐔", + "🐧", + "🐦", + "🐤", + "🐣", + "🐥", + "🦆", + "🦅", + "🦉", + "🦇", + "🐺", + "🐗", + "🐴", + "🦄", + "🐝", + "🪱", + "🐛", + "🦋", + "🐌", + "🐞", + "🐜", + "🪰", + "🪲", + "🪳", + "🦟", + "🦗", + "🕷", + "🕸", + "🦂", + "🐢", + "🐍", + "🦎", + "🦖", + "🦕", + "🐙", + "🦑", + "🦐", + "🦞", + "🦀", + "🐡", + "🐠", + "🐟", + "🐬", + "🐳", + "🐋", + "🦈", + "🐊", + "🐅", + "🐆", + "🦓", + "🦍", + "🦧", + "🦣", + "🐘", + "🦛", + "🦏", + "🐪", + "🐫", + "🦒", + "🦘", + "🦬", + "🐃", + "🐂", + "🐄", + "🐎", + "🐖", + "🐏", + "🐑", + "🦙", + "🐐", + "🦌", + "🐕", + "🐩", + "🦮", + "🐕‍🦺", + "🐈", + "🐈‍⬛", + "🪶", + "🐓", + "🦃", + "🦤", + "🦚", + "🦜", + "🦢", + "🦩", + "🕊", + "🐇", + "🦝", + "🦨", + "🦡", + "🦫", + "🦦", + "🦥", + "🐁", + "🐀", + "🐿", + "🦔", + "🐾", + "🐉", + "🐲", + "🌵", + "🎄", + "🌲", + "🌳", + "🌴", + "🪵", + "🌱", + "🌿", + "☘️", + "🍀", + "🎍", + "🪴", + "🎋", + "🍃", + "🍂", + "🍁", + "🍄", + "🐚", + "🪨", + "🌾", + "💐", + "🌷", + "🌹", + "🥀", + "🌺", + "🌸", + "🌼", + "🌻", + "🌞", + "🌝", + "🌛", + "🌜", + "🌚", + "🌕", + "🌖", + "🌗", + "🌘", + "🌑", + "🌒", + "🌓", + "🌔", + "🌙", + "🌎", + "🌍", + "🌏", + "🪐 ", + "💫", + "⭐️", + "🌟", + "✨", + "⚡️", + "☄️", + "💥", + "🔥", + "🌪", + "🌈", + "☀️", + "🌤", + "⛅️", + "🌥", + "☁️", + "🌦", + "🌧", + "⛈", + "🌩", + "🌨", + "❄️", + "☃️", + "⛄️", + "🌬", + "💨", + "💧", + "💦", + "☔️", + "☂️", + "🌊", + "🌫", ]; function TabPanel(props) { @@ -159,21 +356,21 @@ TabPanel.propTypes = { function a11yProps(index) { return { id: `scrollable-force-tab-${index}`, - 'aria-controls': `scrollable-force-tabpanel-${index}`, + "aria-controls": `scrollable-force-tabpanel-${index}`, }; } const useStyles = makeStyles((theme) => ({ root: { flexGrow: 1, - width: '100%', + width: "100%", backgroundColor: theme.palette.background.paper, - flexDirection: 'row-reverse' + flexDirection: "row-reverse", }, list: { flex: 1, - width: '100%', - flexDirection: 'row-reverse' + width: "100%", + flexDirection: "row-reverse", }, })); @@ -184,7 +381,6 @@ export default function ScrollableTabsButtonForce(props) { const handleChange = (event, newValue) => { setValue(newValue); }; - console.log(props.emojies[0]); return (
@@ -205,8 +401,15 @@ export default function ScrollableTabsButtonForce(props) { {props.emojies.map((item) => (
- {item.list.map((jojo,i) => ( - props.typeText('emoji',jojo)} style={{fontSize: 24, width: 30, height:30 }} className="m-1">{jojo} + {item.list.map((jojo, i) => ( + props.typeText("emoji", jojo)} + style={{ fontSize: 24, width: 30, height: 30 }} + className="m-1" + > + {jojo} + ))}
@@ -217,8 +420,7 @@ export default function ScrollableTabsButtonForce(props) { ScrollableTabsButtonForce.defaultProps = { emojies: [ - { type: 'Smileys', list: Smileys, id: 0 }, - { type: 'Animals', list: animals, id: 1 }, + { type: "Smileys", list: Smileys, id: 0 }, + { type: "Animals", list: animals, id: 1 }, ], }; - diff --git a/src/views/ChatRoom/Body/index.js b/src/views/ChatRoom/Body/index.js index 42ffd46..1ac9661 100644 --- a/src/views/ChatRoom/Body/index.js +++ b/src/views/ChatRoom/Body/index.js @@ -5,7 +5,6 @@ import Keyboard from "./Keyboard"; import { RecordState } from "audio-react-recorder"; import ReactPlayer from "react-player"; import ReactAudioPlayer from "react-audio-player"; -import { ToastContainer } from "react-toastify"; // import { list, send, sendKeys } from "../../../Redux/actions/message"; import { chat } from "../../../Redux/actions"; import { connect } from "react-redux"; @@ -506,17 +505,6 @@ class List extends Component {
) : null}
- ) : null} {window.innerWidth > 1000 ? ( @@ -629,17 +617,6 @@ class List extends Component { ) : null} - ) : null} @@ -655,5 +632,5 @@ export default connect( last: state.message.list.slice(-1)[0] || {}, }; }, - { info : chat.info , bio : chat.bio } + { info: chat.info, bio: chat.bio } )(List); diff --git a/src/views/ChatRoom/Drawer/index.js b/src/views/ChatRoom/Drawer/index.js index 293f32b..0cb74c3 100644 --- a/src/views/ChatRoom/Drawer/index.js +++ b/src/views/ChatRoom/Drawer/index.js @@ -1,13 +1,16 @@ -import React from 'react'; -import Info from '../Info/index'; +import React from "react"; +import Info from "../Info/index"; -import './index.scss'; +import "./index.scss"; export default function PersistentDrawerLeft(props) { - console.log(props.open); return ( -
+
); -} \ No newline at end of file +} diff --git a/src/views/Contact/index.js b/src/views/Contact/index.js index cd547ec..47ed3c3 100644 --- a/src/views/Contact/index.js +++ b/src/views/Contact/index.js @@ -46,11 +46,11 @@ class Contact extends Component { } render() { - const { contactData } = this.props; + const { contactData, loading } = this.props; return ( <> {window.innerWidth > 1000 ? ( - contactData ? ( + !loading ? ( <>
@@ -117,7 +117,7 @@ class Contact extends Component { ) ) : null} {window.innerWidth < 1000 ? ( - contactData ? ( + !loading ? (
@@ -209,6 +209,7 @@ export default connect( loading: state.publicApi.loading, contactData: state.publicApi.contactData, list: state.userProduct.list, + loading: state.publicApi.loading, }), { getContactData: publicApi.getContactData, getList: userProduct.list } )(Contact); diff --git a/src/views/Faq/index.js b/src/views/Faq/index.js index ff17836..fe4ab0c 100644 --- a/src/views/Faq/index.js +++ b/src/views/Faq/index.js @@ -1,4 +1,6 @@ import React, { Component } from "react"; +import proxy from "~/Redux/proxy"; +import { toast } from "react-toastify"; import { connect } from "react-redux"; import { publicApi } from "~/Redux/actions"; @@ -83,11 +85,11 @@ class Faq extends Component { }; render() { - const { faqList, searchResult, loading } = this.props; + const { faqList, searchResult } = this.props; return ( <> {window.innerWidth > 1000 ? ( - !loading ? ( + faqList.length > 0 ? ( <>
diff --git a/src/views/Home/HomeSearch/Select/index.js b/src/views/Home/HomeSearch/Select/index.js index 6de4ffe..92625ec 100644 --- a/src/views/Home/HomeSearch/Select/index.js +++ b/src/views/Home/HomeSearch/Select/index.js @@ -46,16 +46,20 @@ const useStyles = makeStyles((theme) => ({ export default function CustomizedSelects(props) { const classes = useStyles(); const [age, setAge] = React.useState(""); - const handleChange = (event) => { - setAge(event.target.value); - }; + const { name, parent, options } = props; return (
+ parent.setState({ + filters: { + ...parent.state.filters, + [name]: e.target.value === "همه" ? [] : [e.target.value], + }, + }) + } input={} > {props.options.map((item, i) => ( diff --git a/src/views/Home/HomeSearch/index.js b/src/views/Home/HomeSearch/index.js index e927753..5256339 100644 --- a/src/views/Home/HomeSearch/index.js +++ b/src/views/Home/HomeSearch/index.js @@ -1,12 +1,30 @@ import React, { Component } from "react"; +import { connect } from "react-redux"; +import { publicApi } from "~/Redux/actions"; import Select from "./Select/index"; import dropdown from "../../../assets/icons/dropdown.png"; 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() { - const { height, data } = this.props; + const { height, levels } = this.props; return (
+ this.setState({ + filters: { ...this.state.filters, search: e.target.value }, + }) + } />
- فلش
@@ -24,3 +47,10 @@ export default class HomeSearch extends Component { ); } } + +export default connect( + (state) => ({ + levels: state.publicApi.levels, + }), + { filterNewProducts: publicApi.filterNewProducts } +)(HomeSearch); diff --git a/src/views/Home/HomeSearch/index.scss b/src/views/Home/HomeSearch/index.scss index 65615f7..85cc2ff 100644 --- a/src/views/Home/HomeSearch/index.scss +++ b/src/views/Home/HomeSearch/index.scss @@ -4,7 +4,7 @@ box-shadow: 0px 0px 5px rgb(200, 200, 200); border-radius: 7px; justify-content: space-between; - align-items:center; + align-items: center; flex: 1; margin-top: 20px; font-family: numeralLight; @@ -51,7 +51,7 @@ &__select { position: relative; margin-left: 20px; - & img{ + & img { position: absolute; left: 27px; top: 12px; @@ -64,6 +64,6 @@ background-color: #7dc241; color: white; border-radius: 5px; - padding : 7px 50px; + padding: 7px 50px; } } diff --git a/src/views/Home/Membership/index.js b/src/views/Home/Membership/index.js index d334c1b..3ce84e5 100644 --- a/src/views/Home/Membership/index.js +++ b/src/views/Home/Membership/index.js @@ -1,8 +1,9 @@ import React, { Component } from "react"; + import Input from "./Input/index"; import "./index.scss"; -export default class Membership extends Component { +class Membership extends Component { render() { return ( <> @@ -44,3 +45,5 @@ export default class Membership extends Component { ); } } + +export default Membership; diff --git a/src/views/Home/SingleBlog/index.js b/src/views/Home/SingleBlog/index.js index d47ac2b..10823b9 100644 --- a/src/views/Home/SingleBlog/index.js +++ b/src/views/Home/SingleBlog/index.js @@ -46,7 +46,6 @@ export default class SingleBlog extends Component { const Identifier = (props) => { const { data } = props; - console.log(data); return ( <> {data.type === "audio" ? ( diff --git a/src/views/Home/index.js b/src/views/Home/index.js index 76477c0..8924800 100644 --- a/src/views/Home/index.js +++ b/src/views/Home/index.js @@ -38,6 +38,7 @@ import Loader from "~/components/Loader/index"; import "./index.scss"; class Home extends Component { componentDidMount() { + window.scrollTo(0, 0); if (window.innerWidth < 1000) { this.props.getHomeData({ device: 2 }); } else { diff --git a/src/views/MyBooks/index.js b/src/views/MyBooks/index.js index b333794..694d443 100644 --- a/src/views/MyBooks/index.js +++ b/src/views/MyBooks/index.js @@ -28,59 +28,78 @@ const fontSize = { class MyBooks extends React.Component { componentDidMount() { this.props.getList(); + window.scrollTo(0, 0); } render() { - const { list, checkEmpty } = this.props; + const { list, checkEmpty, loading } = this.props; return ( <> {window.innerWidth > 1000 ? ( - <> -
- - -
- {!checkEmpty ? ( - list.map((item, i) => ) - ) : ( -
-

- برای استفاده از این بخش باید یک کتاب فعال خریداری کرده - باشید -

- فروشگاه -
- )} + !loading ? ( + <> +
+ + +
+ {!checkEmpty ? ( + list.map((item, i) => ) + ) : ( +
+

+ برای استفاده از این بخش باید یک کتاب فعال خریداری کرده + باشید +

+ فروشگاه +
+ )} +
+