{proxy.status() ? (
@@ -158,7 +161,11 @@ class LaptopNavbar extends Component {
className="language-select"
onChange={(e) => {
window.localStorage.setItem("language", e.target.value);
- window.location.reload();
+ window.reLang(e.target.value);
+ this.props.changeLanguage();
+ this.setState({ navigatePath: "/reset" });
+
+ //window.location.reload();
}}
>
{[
@@ -213,7 +220,10 @@ class LaptopNavbar extends Component {
className="language-select"
onChange={(e) => {
window.localStorage.setItem("language", e.target.value);
- window.location.reload();
+ // window.location.reload();
+ window.reLang(e.target.value);
+ this.props.changeLanguage();
+ this.setState({ navigatePath: "/reset" });
}}
>
{console.log(window.lang)}
@@ -248,15 +258,12 @@ class LaptopNavbar extends Component {
);
}
}
-export default connect((state) => ({ status: state.user.status }), {
- logout: user.logout,
-})(LaptopNavbar);
-LaptopNavbar.defaultProps = {
- links: [
- { name: window.t("صفحه اصلی"), to: "/", page: "home" },
- { name: window.t("فروشگاه"), to: "/products", page: "products" },
- { name: window.t("سوالات متداول"), to: "/faq", page: "faq" },
- { name: window.t("درباره ما"), to: "/about", page: "about" },
- { name: window.t("پشتیبانی"), to: "/contact", page: "contact" },
- ],
-};
+export default connect(
+ (state) => ({ status: state.user.status, lang: state.publicApi.lang }),
+ {
+ changeLanguage: publicApi.changeLanguage,
+
+ logout: user.logout,
+ }
+)(LaptopNavbar);
+LaptopNavbar.defaultProps = {};
diff --git a/src/views/Home/Navbar/Mobile/index.js b/src/views/Home/Navbar/Mobile/index.js
index 0a7853b..6f3c54e 100644
--- a/src/views/Home/Navbar/Mobile/index.js
+++ b/src/views/Home/Navbar/Mobile/index.js
@@ -12,8 +12,15 @@ import back from "../../../../assets/icons/back.png";
import hamburger from "../../../../assets/icons/hamburger.png";
import search from "../../../../assets/icons/navbarSearch.png";
import proxy from "~/Redux/proxy";
+import { connect } from "react-redux";
+import { publicApi } from "~/Redux/actions";
import "./index.scss";
+
+function Navigate({ path }) {
+ let history = useHistory();
+ return <>{history.push(path)}>;
+}
function BackButton({ children }) {
let history = useHistory();
return (
@@ -27,17 +34,6 @@ function BackButton({ children }) {
);
}
-const changeLanguage = (val) => {
- if (val === "fa") {
- localStorage.removeItem("language");
- } else if (val === "en") {
- localStorage.setItem("language", "en");
- } else {
- localStorage.setItem("language", "ar");
- }
- window.location.reload();
-};
-
const useStyles = makeStyles({
list: {
width: window.innerWidth * 0.8,
@@ -49,7 +45,7 @@ const useStyles = makeStyles({
},
});
-export default function MobileNavbar(props) {
+function MobileNavbar(props) {
const status = proxy.status();
const classes = useStyles();
const [state, setState] = useState({
@@ -119,7 +115,10 @@ export default function MobileNavbar(props) {
className="language-select"
onChange={(e) => {
window.localStorage.setItem("language", e.target.value);
- window.location.reload();
+ // window.location.reload();
+ window.reLang(e.target.value);
+ props.changeLanguage();
+ Navigate("/reset");
}}
>
{[
@@ -196,7 +195,10 @@ export default function MobileNavbar(props) {
className="language-select"
onChange={(e) => {
window.localStorage.setItem("language", e.target.value);
- window.location.reload();
+ // window.location.reload();
+ window.reLang(e.target.value);
+ props.changeLanguage();
+ Navigate("/reset");
}}
>
{[
@@ -257,3 +259,6 @@ export default function MobileNavbar(props) {
);
}
+export default connect((state) => ({ lang: state.publicApi.lang }), {
+ changeLanguage: publicApi.changeLanguage,
+})(MobileNavbar);
diff --git a/src/views/MyBooks/index.js b/src/views/MyBooks/index.js
index be963a2..7ed67e5 100644
--- a/src/views/MyBooks/index.js
+++ b/src/views/MyBooks/index.js
@@ -5,27 +5,28 @@ import { userProduct } from "~/Redux/actions";
import moment from "jalali-moment";
import "./index.scss";
import { Link } from "react-router-dom";
-const grades = [
- window.t("پیش دبستان"),
- window.t("اول"),
- window.t("دوم"),
- window.t("سوم"),
- window.t("چهارم"),
- window.t("پنجم"),
- window.t("ششم"),
- window.t("هفتم"),
- window.t("هشتم"),
- window.t("نهم"),
- window.t("دهم"),
- window.t("یازدهم"),
- window.t("دوازدهم"),
-];
+
class MyBooks extends Component {
componentDidMount() {
if (!this.props.mylist) this.props.getMyList();
}
render() {
+ const grades = [
+ window.t("پیش دبستان"),
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+ ];
const data = (this.props.myList || []).filter((e) => +e.productType === 3);
return (
diff --git a/src/views/NewProfile/index.js b/src/views/NewProfile/index.js
index 4cfa7ee..1dd31a6 100644
--- a/src/views/NewProfile/index.js
+++ b/src/views/NewProfile/index.js
@@ -264,7 +264,7 @@ class NewProfile extends Component {
/>
-
+
{/*
diff --git a/src/views/Orders/index.js b/src/views/Orders/index.js
index 1c4c205..09775f0 100644
--- a/src/views/Orders/index.js
+++ b/src/views/Orders/index.js
@@ -4,26 +4,27 @@ import Navbar from "../Home/Navbar";
import { userFactor } from "~/Redux/actions";
import "./index.css";
import moment from "jalali-moment";
-const grades = [
- window.t("پیش دبستان"),
- window.t("اول"),
- window.t("دوم"),
- window.t("سوم"),
- window.t("چهارم"),
- window.t("پنجم"),
- window.t("ششم"),
- window.t("هفتم"),
- window.t("هشتم"),
- window.t("نهم"),
- window.t("دهم"),
- window.t("یازدهم"),
- window.t("دوازدهم"),
-];
+
class Orders extends Component {
componentDidMount() {
if (!this.props.list) this.props.getList();
}
render() {
+ const grades = [
+ window.t("پیش دبستان"),
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+ ];
// props.getList();
let data = this.props.list;
return (
diff --git a/src/views/PDF/index.js b/src/views/PDF/index.js
index 369ad6c..e751547 100644
--- a/src/views/PDF/index.js
+++ b/src/views/PDF/index.js
@@ -5,9 +5,11 @@ import Navbar from "../Home/Navbar/index";
export default class Test extends Component {
render() {
const id = +window.location.pathname.split("/").slice(-1)[0];
+ console.log(1);
return (
+
diff --git a/src/views/Product/index.js b/src/views/Product/index.js
index 608b25c..2129e90 100644
--- a/src/views/Product/index.js
+++ b/src/views/Product/index.js
@@ -29,21 +29,7 @@ import "./index.scss";
const maxDesktopSize = 1250;
const maxMobileSize = 550;
-const grades = [
- window.t("پیش دبستان"),
- window.t("اول"),
- window.t("دوم"),
- window.t("سوم"),
- window.t("چهارم"),
- window.t("پنجم"),
- window.t("ششم"),
- window.t("هفتم"),
- window.t("هشتم"),
- window.t("نهم"),
- window.t("دهم"),
- window.t("یازدهم"),
- window.t("دوازدهم"),
-];
+
const fontSize = {
desktop: {
h1: window.innerWidth > maxDesktopSize ? 20 : window.innerWidth / 70,
@@ -122,9 +108,39 @@ class Product extends Component {
});
this.props.getList();
}
-
+ componentDidUpdate() {
+ if (!this.props.loading && !this.props.list.length) {
+ this.props.getInfo({
+ id: window.location.pathname.slice(
+ window.location.pathname.lastIndexOf("/") + 1,
+ window.location.pathname.length
+ ),
+ });
+ this.props.getList();
+ }
+ }
render() {
- const { supportItems, info, page } = this.props;
+ const grades = [
+ window.t("پیش دبستان"),
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+ ];
+ const { info, page } = this.props;
+ const supportItems = [
+ { title: window.t("ارسال سریع"), icon: product_shipping },
+ { title: window.t("پشتیبانی 24 ساعته"), icon: product_support },
+ { title: window.t("ضمانت بازگشت"), icon: product_cash_back },
+ ];
return (
<>
{window.innerWidth > 1000 ? (
@@ -406,17 +422,12 @@ export default connect(
loading: state.book.loading,
list: state.book.list,
id: state.user.status.id,
+ lang: state.publicApi.lang,
}),
{ getInfo: book.info, getList: book.list, pushToCart: userProduct.add }
)(Product);
-Product.defaultProps = {
- supportItems: [
- { title: window.t("ارسال سریع"), icon: product_shipping },
- { title: window.t("پشتیبانی 24 ساعته"), icon: product_support },
- { title: window.t("ضمانت بازگشت"), icon: product_cash_back },
- ],
-};
+Product.defaultProps = {};
const Identifier = (props) => {
return (
diff --git a/src/views/Products/List/index.js b/src/views/Products/List/index.js
index 419dcbd..d719141 100644
--- a/src/views/Products/List/index.js
+++ b/src/views/Products/List/index.js
@@ -11,6 +11,10 @@ class List extends React.Component {
componentDidMount() {
if (this.props.list?.length === 0) this.props.getList();
}
+ componentDidUpdate() {
+ if (this.props.list?.length === 0 && !this.props.loading)
+ this.props.getList();
+ }
render() {
let { filterResult, loading } = this.props;
diff --git a/src/views/Products/Product/index.js b/src/views/Products/Product/index.js
index 33581eb..2ce0970 100644
--- a/src/views/Products/Product/index.js
+++ b/src/views/Products/Product/index.js
@@ -9,21 +9,6 @@ import { connect } from "react-redux";
import { userProduct } from "~/Redux/actions";
import "./index.scss";
-const grades = [
- window.t("پیش دبستان"),
- window.t("اول"),
- window.t("دوم"),
- window.t("سوم"),
- window.t("چهارم"),
- window.t("پنجم"),
- window.t("ششم"),
- window.t("هفتم"),
- window.t("هشتم"),
- window.t("نهم"),
- window.t("دهم"),
- window.t("یازدهم"),
- window.t("دوازدهم"),
-];
function Product(props) {
let history = useHistory();
@@ -41,6 +26,21 @@ function Product(props) {
});
setTimeout(() => history.push("/cart"), 2000);
}
+ const grades = [
+ window.t("پیش دبستان"),
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+ ];
return (
<>
{window.innerWidth < 1000 ? (
diff --git a/src/views/Products/Sort/index.js b/src/views/Products/Sort/index.js
index a8f848c..2a10ee9 100644
--- a/src/views/Products/Sort/index.js
+++ b/src/views/Products/Sort/index.js
@@ -13,6 +13,9 @@ const fontSize = {
export default class Sort extends React.Component {
render() {
const { parent, selectedSort } = this.props;
+
+ const sortItems = [window.t("پرفروش ترین"), window.t("جدیدترین")];
+
return (
- {parent.props.sortItems.map((item, i) => (
+ {sortItems.map((item, i) => (
-
) : (
-
{window.q("محتوایی برای این صفحه در دسترس نیست.!")}
+
{window.t("محتوایی برای این صفحه در دسترس نیست.!")}
{window.t("بازگشت")}
diff --git a/src/views/QRScan/LastQr/index.js b/src/views/QRScan/LastQr/index.js
index 4454dfc..bde0301 100644
--- a/src/views/QRScan/LastQr/index.js
+++ b/src/views/QRScan/LastQr/index.js
@@ -3,23 +3,22 @@ import { Link } from "react-router-dom";
import "./index.scss";
-const grades = [
- "0",
- window.t("اول"),
- window.t("دوم"),
- window.t("سوم"),
- window.t("چهارم"),
- window.t("پنجم"),
- window.t("ششم"),
- window.t("هفتم"),
- window.t("هشتم"),
- window.t("نهم"),
- window.t("دهم"),
- window.t("یازدهم"),
- window.t("دوازدهم"),
-];
-
export default function LastQR(props) {
+ const grades = [
+ "0",
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+ ];
const { data } = props;
return (
<>
diff --git a/src/views/Reset.js b/src/views/Reset.js
new file mode 100644
index 0000000..d71add7
--- /dev/null
+++ b/src/views/Reset.js
@@ -0,0 +1,7 @@
+import React from "react";
+import { useHistory } from "react-router-dom";
+export default function Reset() {
+ let history = useHistory();
+ setTimeout(() => history.goBack(), 100);
+ return <>{""}>;
+}
diff --git a/src/views/Support/Upload/index.js b/src/views/Support/Upload/index.js
index 3ead372..c1de022 100644
--- a/src/views/Support/Upload/index.js
+++ b/src/views/Support/Upload/index.js
@@ -20,7 +20,10 @@ export default function Document(props) {
return (
<>
{window.innerWidth < 1000 ? (
-
+
maxDesktopSize ? 30 : window.innerWidth / 40,
@@ -80,6 +66,21 @@ class Support extends Component {
//todo redirectHome
}
render() {
+ const grades = [
+ window.t("پیش دبستان"),
+ window.t("اول"),
+ window.t("دوم"),
+ window.t("سوم"),
+ window.t("چهارم"),
+ window.t("پنجم"),
+ window.t("ششم"),
+ window.t("هفتم"),
+ window.t("هشتم"),
+ window.t("نهم"),
+ window.t("دهم"),
+ window.t("یازدهم"),
+ window.t("دوازدهم"),
+ ];
let { status } = this.props;
let opt = [
window.t("واحد مورد نظر"),
@@ -92,7 +93,12 @@ class Support extends Component {
<>
-
+
{window.t("پشتیبانی")}
@@ -177,6 +183,7 @@ export default connect(
myProductList: state.userProduct.myList,
status: state.user.status,
uploadFileId: state.file.supportFileId,
+ lang: state.publicApi.lang,
}),
{
getUserProductList: userProduct.myList,