update 42 files

front
amir hosein gorji 2 years ago
parent 8681b95b7e
commit 08e6ff0bbe
  1. 6
      public/index.html
  2. 8
      src/App.js
  3. 82
      src/AppRouter.js
  4. 29
      src/QRScan/LastQr/index.js
  5. 4
      src/Redux/actions/public.js
  6. 16
      src/Redux/proxy.js
  7. 45
      src/Redux/reducers/book.js
  8. 33
      src/Redux/reducers/public.js
  9. 6
      src/Redux/reducers/userFactor.js
  10. 106
      src/views/About/index.js
  11. 2
      src/views/Auth/Login/Code/index.js
  12. 3
      src/views/Auth/Profile/Birthdate/index.js
  13. 3
      src/views/Auth/Profile/TextArea/index.js
  14. 1
      src/views/Auth/Profile/index.js
  15. 2
      src/views/Auth/index.js
  16. 4
      src/views/Callback/index.js
  17. 1
      src/views/Cart/Discount/index.js
  18. 46
      src/views/Cart/Table/index.js
  19. 17
      src/views/Cart/index.js
  20. 1
      src/views/Checkout/Discount/index.js
  21. 4
      src/views/Checkout/Table/index.js
  22. 6
      src/views/Checkout/index.js
  23. 2
      src/views/Contact/Input/index.js
  24. 7
      src/views/Contact/index.js
  25. 31
      src/views/Download/Item/index.js
  26. 5
      src/views/Faq/index.js
  27. 50
      src/views/Home/Footer/index.js
  28. 79
      src/views/Home/Navbar/Laptop/index.js
  29. 33
      src/views/Home/Navbar/Mobile/index.js
  30. 31
      src/views/MyBooks/index.js
  31. 2
      src/views/NewProfile/index.js
  32. 31
      src/views/Orders/index.js
  33. 2
      src/views/PDF/index.js
  34. 59
      src/views/Product/index.js
  35. 4
      src/views/Products/List/index.js
  36. 30
      src/views/Products/Product/index.js
  37. 5
      src/views/Products/Sort/index.js
  38. 4
      src/views/Products/index.js
  39. 2
      src/views/QR/index.js
  40. 31
      src/views/QRScan/LastQr/index.js
  41. 7
      src/views/Reset.js
  42. 5
      src/views/Support/Upload/index.js
  43. 39
      src/views/Support/index.js

@ -23,10 +23,10 @@
window.ar = ar; window.ar = ar;
window.en = en; window.en = en;
const ratio = (lang == "en" || lang == "ar") ? (1 / 15000) : 1 window.ratio = (lang == "en" || lang == "ar") ? (1 / 15000) : 1
window.tr = (price) => Math.round(ratio * price * 100) / 100 window.tr = (price) => Math.round(window.ratio * price * 100) / 100
function t(val) { function t(val) {
const lang_ = window[lang]; const lang_ = window[window.lang];
if (!lang_) return val; if (!lang_) return val;
if (!lang_[val]) console.error(val); if (!lang_[val]) console.error(val);
return lang_[val] || "*" + val; return lang_[val] || "*" + val;

@ -7,10 +7,16 @@ import "bootstrap/dist/css/bootstrap.min.css";
import "react-toastify/dist/ReactToastify.css"; import "react-toastify/dist/ReactToastify.css";
class App extends Component { class App extends Component {
state = { lang: window.lang };
componentDidMount() {
window.forceUpdate = () => {
this.setState({ lang: window.lang });
};
}
render() { render() {
return ( return (
<Provider store={store}> <Provider store={store}>
<AppRouter /> <AppRouter lang={this.state.lang} />
<ToastContainer <ToastContainer
position="top-right" position="top-right"
autoClose={2000} autoClose={2000}

@ -17,6 +17,7 @@ import About from "./views/About/index";
import Products from "./views/Products/index"; import Products from "./views/Products/index";
import Product from "./views/Product/index"; import Product from "./views/Product/index";
import QR from "./views/QR/index"; import QR from "./views/QR/index";
import Reset from "./views/Reset";
import Auth from "./views/Auth/index"; import Auth from "./views/Auth/index";
import QRScan from "./views/QRScan/index"; import QRScan from "./views/QRScan/index";
import Activation from "./views/Activation/index"; import Activation from "./views/Activation/index";
@ -75,7 +76,7 @@ class AppRouter extends Component {
let home = ( let home = (
<Route exact path={"/"}> <Route exact path={"/"}>
{status && status.status === 0 ? ( {status && status.status === 0 ? (
<Auth page={"profile"} /> <Auth page={"profile"} lang={this.props.lang} />
) : afterLogin ? ( ) : afterLogin ? (
<> <>
<Redirect <Redirect
@ -85,60 +86,64 @@ class AppRouter extends Component {
/> />
</> </>
) : ( ) : (
<Home status={status} /> <Home status={status} lang={this.props.lang} />
)} )}
</Route> </Route>
); );
return ( return (
<div <div
className={`flex-1 ${ className={` ${
localStorage.getItem("language") === "en" ? "ltr" : "rtl" localStorage.getItem("language") === "en" ? "ltr" : "rtl"
}`} }`}
style={{ height: "100%" }}
> >
<Router> <Router>
<Switch> <Switch>
{home} {home}
<Route exact path={"/reset"}>
<Reset lang={this.props.lang} />
</Route>
<Route exact path={"/faq"}> <Route exact path={"/faq"}>
<Faq /> <Faq lang={this.props.lang} />
</Route> </Route>
<Route exact path={"/contact"}> <Route exact path={"/contact"}>
<Contact /> <Contact lang={this.props.lang} />
</Route> </Route>
<Route exact path={"/download"}> <Route exact path={"/download"}>
<Download /> <Download lang={this.props.lang} />
</Route> </Route>
<Route exact path={"/blogs"}> <Route exact path={"/blogs"}>
<Blogs /> <Blogs lang={this.props.lang} />
</Route> </Route>
<Route exact path={"/blogs/:id"}> <Route exact path={"/blogs/:id"}>
<Blog /> <Blog lang={this.props.lang} />
</Route> </Route>
<Route exact path={"/page/:name"}> <Route exact path={"/page/:name"}>
<Blog /> <Blog lang={this.props.lang} />
</Route> </Route>
<Route exact path={"/about"}> <Route exact path={"/about"}>
<About /> <About lang={this.props.lang} />
</Route> </Route>
<Route exact path={"/products"}> <Route exact path={"/products"}>
<Products /> <Products lang={this.props.lang} />
</Route> </Route>
<Route exact path="/orders"> <Route exact path="/orders">
<Orders /> <Orders lang={this.props.lang} />
</Route> </Route>
<Route exact path="/mybooks"> <Route exact path="/mybooks">
<MyBooks /> <MyBooks lang={this.props.lang} />
</Route> </Route>
{/* <Route path={"/sample"}> {/* <Route path={"/sample"}>
<Sample /> <Sample />
</Route> */} </Route> */}
<Route path={"/pdf"}> <Route path={"/pdf"}>
<PDF /> <PDF lang={this.props.lang} />
</Route> </Route>
<Route exact path={"/newProfile"}> <Route exact path={"/newProfile"}>
{mobile ? ( {mobile ? (
status ? ( status ? (
<NewProfile /> <NewProfile lang={this.props.lang} />
) : ( ) : (
<Redirect <Redirect
to={{ to={{
@ -153,7 +158,7 @@ class AppRouter extends Component {
<Route exact path={"/support"}> <Route exact path={"/support"}>
{mobile ? ( {mobile ? (
status ? ( status ? (
<Support /> <Support lang={this.props.lang} />
) : ( ) : (
<Redirect <Redirect
to={{ to={{
@ -166,13 +171,13 @@ class AppRouter extends Component {
)} )}
</Route> </Route>
<Route exact path={"/products/digital/:id"}> <Route exact path={"/products/digital/:id"}>
<Product page="digital" /> <Product page="digital" lang={this.props.lang} />
</Route> </Route>
<Route exact path={"/products/physical/:id"}> <Route exact path={"/products/physical/:id"}>
<Product page="physical" /> <Product page="physical" lang={this.props.lang} />
</Route> </Route>
<Route exact path={"/qr"}> <Route exact path={"/qr"}>
<QR /> <QR lang={this.props.lang} />
</Route> </Route>
<Route exact path={"/auth"}> <Route exact path={"/auth"}>
{proxy.status() ? ( {proxy.status() ? (
@ -182,11 +187,11 @@ class AppRouter extends Component {
}} }}
/> />
) : ( ) : (
<NewProfile /> <Auth lang={this.props.lang} />
)} )}
</Route> </Route>
<Route exact path={"/support"}> <Route exact path={"/support"}>
<Support /> <Support lang={this.props.lang} />
{/* {mobile ? ( {/* {mobile ? (
status ? ( status ? (
<Support /> <Support />
@ -202,13 +207,13 @@ class AppRouter extends Component {
)} */} )} */}
</Route> </Route>
<Route exact path={"/products/digital/:id"}> <Route exact path={"/products/digital/:id"}>
<Product page="digital" /> <Product page="digital" lang={this.props.lang} />
</Route> </Route>
<Route exact path={"/products/physical/:id"}> <Route exact path={"/products/physical/:id"}>
<Product page="physical" /> <Product page="physical" lang={this.props.lang} />
</Route> </Route>
<Route exact path={"/qr"}> <Route exact path={"/qr"}>
<QR /> <QR lang={this.props.lang} />
</Route> </Route>
<Route exact path={"/auth"}> <Route exact path={"/auth"}>
{proxy.status() ? ( {proxy.status() ? (
@ -218,16 +223,16 @@ class AppRouter extends Component {
}} }}
/> />
) : ( ) : (
<Auth /> <Auth lang={this.props.lang} />
)} )}
</Route> </Route>
<Route exact path={"/profile"}> <Route exact path={"/profile"}>
{status ? <Auth page={"profile"} /> : null} {status ? <Auth page={"profile"} lang={this.props.lang} /> : null}
</Route> </Route>
<Route exact path={"/qr-scan"}> <Route exact path={"/qr-scan"}>
{mobile ? ( {mobile ? (
status ? ( status ? (
<QRScan /> <QRScan lang={this.props.lang} />
) : ( ) : (
<Redirect <Redirect
to={{ to={{
@ -236,7 +241,7 @@ class AppRouter extends Component {
/> />
) )
) : status ? ( ) : status ? (
<QRScan /> <QRScan lang={this.props.lang} />
) : ( ) : (
<Redirect <Redirect
to={{ to={{
@ -248,7 +253,7 @@ class AppRouter extends Component {
<Route exact path={"/activation"}> <Route exact path={"/activation"}>
{mobile ? ( {mobile ? (
status ? ( status ? (
<Activation /> <Activation lang={this.props.lang} />
) : ( ) : (
<Redirect <Redirect
to={{ to={{
@ -257,7 +262,7 @@ class AppRouter extends Component {
/> />
) )
) : status ? ( ) : status ? (
<Activation /> <Activation lang={this.props.lang} />
) : ( ) : (
<Redirect <Redirect
to={{ to={{
@ -269,7 +274,7 @@ class AppRouter extends Component {
<Route exact path={"/chatroom"}> <Route exact path={"/chatroom"}>
{mobile ? ( {mobile ? (
status ? ( status ? (
<ChatList /> <ChatList lang={this.props.lang} />
) : ( ) : (
<Redirect <Redirect
to={{ to={{
@ -278,7 +283,7 @@ class AppRouter extends Component {
/> />
) )
) : status ? ( ) : status ? (
<ChatList /> <ChatList lang={this.props.lang} />
) : ( ) : (
<Redirect <Redirect
to={{ to={{
@ -288,7 +293,7 @@ class AppRouter extends Component {
)} )}
</Route> </Route>
<Route exact path={"/cart"}> <Route exact path={"/cart"}>
<Cart /> <Cart lang={this.props.lang} />
{/* {status ? ( {/* {status ? (
<Cart /> <Cart />
) : ( ) : (
@ -301,7 +306,7 @@ class AppRouter extends Component {
</Route> </Route>
<Route exact path={"/checkout"}> <Route exact path={"/checkout"}>
{status ? ( {status ? (
<Checkout /> <Checkout lang={this.props.lang} />
) : ( ) : (
<Redirect <Redirect
to={{ to={{
@ -334,7 +339,7 @@ class AppRouter extends Component {
<Route exact path={"/ar"}> <Route exact path={"/ar"}>
{mobile ? ( {mobile ? (
status ? ( status ? (
<AR /> <AR lang={this.props.lang} />
) : ( ) : (
<Redirect <Redirect
to={{ to={{
@ -343,7 +348,7 @@ class AppRouter extends Component {
/> />
) )
) : status ? ( ) : status ? (
<AR /> <AR lang={this.props.lang} />
) : ( ) : (
<Redirect <Redirect
to={{ to={{
@ -356,7 +361,7 @@ class AppRouter extends Component {
<Route exact path={"/chatroom/:id"}> <Route exact path={"/chatroom/:id"}>
{mobile ? ( {mobile ? (
status ? ( status ? (
<Chatroom /> <Chatroom lang={this.props.lang} />
) : ( ) : (
<Redirect <Redirect
to={{ to={{
@ -365,7 +370,7 @@ class AppRouter extends Component {
/> />
) )
) : status ? ( ) : status ? (
<Chatroom /> <Chatroom lang={this.props.lang} />
) : ( ) : (
<Redirect <Redirect
to={{ to={{
@ -399,6 +404,7 @@ export default connect(
profile: state.user.status, profile: state.user.status,
userProductList: state.userProduct.list, userProductList: state.userProduct.list,
config: state.publicApi.config, config: state.publicApi.config,
lang: state.publicApi.lang,
// status: state.user.status, // status: state.user.status,
}), }),
{ getProfile: user.getProfile, getUserProductList: userProduct.list } { getProfile: user.getProfile, getUserProductList: userProduct.list }

@ -3,23 +3,22 @@ import { Link } from "react-router-dom";
import "./index.scss"; 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("دوازدهم"),
];
export default function LastQR(props) { export default function LastQR(props) {
const { data } = props; const { data } = 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("دوازدهم"),
];
return ( return (
<> <>
{window.innerWidth > 1000 ? <div className="last-qr"></div> : null} {window.innerWidth > 1000 ? <div className="last-qr"></div> : null}

@ -24,6 +24,10 @@ const publicApi = {
await proxy.get("public/province", data, { history, dispatch }), await proxy.get("public/province", data, { history, dispatch }),
getCity: (data, history) => async (dispatch) => getCity: (data, history) => async (dispatch) =>
await proxy.get("public/city", data, { history, dispatch }), await proxy.get("public/city", data, { history, dispatch }),
changeLanguage:
(data = {}) =>
async (dispatch) =>
await dispatch({ type: "public/changeLanguage", data }),
}; };
export default publicApi; export default publicApi;

@ -5,13 +5,23 @@ let { baseUrl } = ApiConfig;
window.baseURL = baseUrl; window.baseURL = baseUrl;
baseUrl = baseUrl + "/"; baseUrl = baseUrl + "/";
const Axios = axios.create({ let Axios = axios.create({
withCredentials: true, withCredentials: true,
validateStatus: null, validateStatus: null,
baseURL: baseUrl, baseURL: baseUrl,
headers: { lang: window.lang }, headers: { lang: window.lang },
}); });
window.reLang = (lang) => {
window.lang = lang;
window.ratio = lang == "en" || lang == "ar" ? 1 / 15000 : 1;
Axios = axios.create({
withCredentials: true,
validateStatus: null,
baseURL: baseUrl,
headers: { lang: window.lang },
});
window.forceUpdate();
};
class Proxy { class Proxy {
get = async (url, params, opt = {}, data) => get = async (url, params, opt = {}, data) =>
await this.check( await this.check(
@ -71,7 +81,7 @@ class Proxy {
refresh = async () => { refresh = async () => {
let refresh = localStorage.getItem("refresh"); let refresh = localStorage.getItem("refresh");
if (!refresh) window.location.href = "/"; if (!refresh) window.location.reload();
let login = await this.login( let login = await this.login(
"user/login", "user/login",
{}, {},

@ -16,22 +16,22 @@ const initialState = {
], ],
}; };
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("دوازدهم"),
];
export default function book(state = initialState, action) { export default function book(state = initialState, action) {
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 { type, data } = action; let { type, data } = action;
switch (type) { switch (type) {
case "book/list": case "book/list":
@ -125,6 +125,21 @@ export default function book(state = initialState, action) {
case "book/error": case "book/error":
toast.error(data.message); toast.error(data.message);
return { ...state, loading: false, error: data.message }; return { ...state, loading: false, error: data.message };
case "public/changeLanguage":
return {
...state,
sortFilters: [
window.t("مرتب سازی"),
window.t("محبوب ترین"),
window.t("جدیدترین"),
],
info: null,
searchResult: [],
filterResult: [],
subjects: [],
levels: [],
list: [],
};
default: default:
return state; return state;
} }

@ -18,22 +18,22 @@ const initialState = {
}, },
}; };
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("دوازدهم"),
];
export default function publicApi(state = initialState, action) { export default function publicApi(state = initialState, action) {
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 { type, data } = action; let { type, data } = action;
switch (type) { switch (type) {
case "public/direction": case "public/direction":
@ -185,7 +185,8 @@ export default function publicApi(state = initialState, action) {
case "public/error": case "public/error":
toast.error(data.message); toast.error(data.message);
return { ...state, loading: false, error: data.message }; return { ...state, loading: false, error: data.message };
case "public/changeLanguage":
return { ...state, lang: window.lang, contactData: null, faqList: [] };
default: default:
return state; return state;
} }

@ -33,7 +33,13 @@ export default function userFactor(state = initialState, action) {
return { ...state, loading: true }; return { ...state, loading: true };
case "userFactor/error": case "userFactor/error":
toast.error(data.message); toast.error(data.message);
return { ...state, loading: false, error: data.message }; return { ...state, loading: false, error: data.message };
case "public/changeLanguage":
return {
...state,
info: null,
};
default: default:
return state; return state;
} }

@ -26,61 +26,61 @@ const fontSize = {
}; };
export default class About extends Component { export default class About extends Component {
state = { render() {
first: { const state = {
title: window.t("درباره ما"), first: {
text: window.t( title: window.t("درباره ما"),
"ما در دانوین با هدف ایجاد زیرساخت تعاملی و آموزشی با تولید محتوایی جذاب بصورت کتاب با کمک پلتفرم دانوین، قصد تغییراتی بنیادین در نظام آموزش و پرورش کشور داریم. دانوین پلتفرمی شامل کتاب، محتوای الکترونیکی، رویه های آموزشی، پشتیبانی علمی و نرم افزار ارائه خدمات با رویکرد مخاطب محور است." text: window.t(
), "ما در دانوین با هدف ایجاد زیرساخت تعاملی و آموزشی با تولید محتوایی جذاب بصورت کتاب با کمک پلتفرم دانوین، قصد تغییراتی بنیادین در نظام آموزش و پرورش کشور داریم. دانوین پلتفرمی شامل کتاب، محتوای الکترونیکی، رویه های آموزشی، پشتیبانی علمی و نرم افزار ارائه خدمات با رویکرد مخاطب محور است."
},
fury: {
title: window.t("ماموریت ما در دانوین چیست ؟"),
text: window.t(
"ارتقای سطح کیفیت و جذابیت آموزش در مدارس بصورت سازگار با نظام رسمی و کنونی آ.پ در راستای نیل به اهداف سند تحول"
),
},
keywords: {
title: window.t("کیفیت آموزش را بالا میبریم"),
list: [
window.t(
"شایستگی در ایجاد فهم علمی در موضوع هدف و در موضوعات وابسته به آن"
),
window.t(
"شایستگی در ایجاد زمینه ی معرفتی- ارزشی موثر برای محتواهای آموزشی"
),
],
},
keywords2: {
title: window.t("جذابیت کلید بهبود یادگیری"),
list: [
window.t(
"بکارگیری عوامل متنوع سازگار با ارزشها برای علاقمندی دانش آموز و معلم به استفاده از محتوای دانوین"
),
window.t(
"سازگار با نظام آ.پ : بطوریکه بتواند در مدارس فعلی مورد استفاده قرار گرفته و با نظام رسمی فعلی در تضاد نباشد"
),
window.t(
"در راستای نیل به سند تحول : تلاش برای نزدیکی گام به گام به آرمانها و اهداف سند تحول"
), ),
], },
}, fury: {
advantages: { title: window.t("ماموریت ما در دانوین چیست ؟"),
title: window.t("مزیت رقابتی دانوین"), text: window.t(
list: [ "ارتقای سطح کیفیت و جذابیت آموزش در مدارس بصورت سازگار با نظام رسمی و کنونی آ.پ در راستای نیل به اهداف سند تحول"
window.t(
"بکارگیری بروز ترین تکنولوژی های تولید و مدیریت محتوای آموزشی-تربیتی (مانند واقعیت افزوده)"
), ),
window.t("دارای رویکرد آموزش سرگرم کننده"), },
window.t("بستر تعاملی و اشتراک گذاری فیلم و محتوای آموزشی"),
window.t("رویکرد معرفتی-ارزشی"), keywords: {
window.t("ویدئو های منحصر بفرد"), title: window.t("کیفیت آموزش را بالا میبریم"),
window.t("متن گفتگو محور ، روایی ، قابل فهم ،جذاب و سرگرم کننده"), list: [
], window.t(
}, "شایستگی در ایجاد فهم علمی در موضوع هدف و در موضوعات وابسته به آن"
}; ),
render() { window.t(
const { fury, advantages, keywords, keywords2, first } = this.state; "شایستگی در ایجاد زمینه ی معرفتی- ارزشی موثر برای محتواهای آموزشی"
),
],
},
keywords2: {
title: window.t("جذابیت کلید بهبود یادگیری"),
list: [
window.t(
"بکارگیری عوامل متنوع سازگار با ارزشها برای علاقمندی دانش آموز و معلم به استفاده از محتوای دانوین"
),
window.t(
"سازگار با نظام آ.پ : بطوریکه بتواند در مدارس فعلی مورد استفاده قرار گرفته و با نظام رسمی فعلی در تضاد نباشد"
),
window.t(
"در راستای نیل به سند تحول : تلاش برای نزدیکی گام به گام به آرمانها و اهداف سند تحول"
),
],
},
advantages: {
title: window.t("مزیت رقابتی دانوین"),
list: [
window.t(
"بکارگیری بروز ترین تکنولوژی های تولید و مدیریت محتوای آموزشی-تربیتی (مانند واقعیت افزوده)"
),
window.t("دارای رویکرد آموزش سرگرم کننده"),
window.t("بستر تعاملی و اشتراک گذاری فیلم و محتوای آموزشی"),
window.t("رویکرد معرفتی-ارزشی"),
window.t("ویدئو های منحصر بفرد"),
window.t("متن گفتگو محور ، روایی ، قابل فهم ،جذاب و سرگرم کننده"),
],
},
};
const { fury, advantages, keywords, keywords2, first } = state;
return ( return (
<> <>
{window.innerWidth > 1000 ? ( {window.innerWidth > 1000 ? (

@ -96,7 +96,7 @@ export default class Code extends Component {
style={{ width: "48%", height: "100%" }} style={{ width: "48%", height: "100%" }}
className="d-flex flex-column justify-content-center align-items-center p-5" className="d-flex flex-column justify-content-center align-items-center p-5"
> >
<img src={logo} alt={window.test("دانوین")} /> <img src={logo} alt={window.t("دانوین")} />
<div className="auth-code__box--codes d-flex justify-content-around"> <div className="auth-code__box--codes d-flex justify-content-around">
<label htmlFor="code1"> <label htmlFor="code1">
<input <input

@ -6,7 +6,8 @@ import moment from "jalali-moment";
export default function Birthdate(props) { export default function Birthdate(props) {
const { defaultValue, parent, name } = props; const { defaultValue, parent, name } = props;
let momentDate = moment(defaultValue[name]); console.log({ defaultValue });
let momentDate = moment((defaultValue || {})[name]);
let isvalid = momentDate?.isValid(); let isvalid = momentDate?.isValid();
const day = isvalid ? momentDate?.format("jDD") : null, const day = isvalid ? momentDate?.format("jDD") : null,
month = isvalid ? momentDate?.format("jMM") : null, month = isvalid ? momentDate?.format("jMM") : null,

@ -13,7 +13,8 @@ const useStyles = makeStyles((theme) => ({
export default function MultilineTextFields(props) { export default function MultilineTextFields(props) {
const classes = useStyles(); const classes = useStyles();
const { parent, defaultValue } = props; let { parent, defaultValue } = props;
defaultValue = defaultValue || {};
return ( return (
<form className={classes.root} noValidate autoComplete="off"> <form className={classes.root} noValidate autoComplete="off">
<TextField <TextField

@ -178,6 +178,7 @@ class Profile extends Component {
window.t("دوازدهم"), window.t("دوازدهم"),
]; ];
const { profile } = this.props; const { profile } = this.props;
console.log({ profile });
return ( return (
<> <>
{window.innerWidth > 1000 ? ( {window.innerWidth > 1000 ? (

@ -15,7 +15,7 @@ export default class Auth extends Component {
return ( return (
<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}
</div> </div>
); );
} }

@ -160,7 +160,7 @@ class Callback extends Component {
</h3> </h3>
<div className="d-flex align-items-center"> <div className="d-flex align-items-center">
<strong style={{ fontSize: fontSize.mobile.h1 }}> <strong style={{ fontSize: fontSize.mobile.h1 }}>
{window.tr(payPrice)} {window.tr(payPrice || 0)}
</strong> </strong>
<span style={{ fontSize: fontSize.mobile.h3 }}> <span style={{ fontSize: fontSize.mobile.h3 }}>
{window.t("تومان")} {window.t("تومان")}
@ -241,7 +241,7 @@ class Callback extends Component {
</h3> </h3>
<div className="d-flex align-items-center"> <div className="d-flex align-items-center">
<strong style={{ fontSize: fontSize.mobile.h1 }}> <strong style={{ fontSize: fontSize.mobile.h1 }}>
{window.tr(payPrice)} {window.tr(payPrice || 0)}
</strong> </strong>
<span style={{ fontSize: fontSize.mobile.h3 }}> <span style={{ fontSize: fontSize.mobile.h3 }}>
{window.t("تومان")} {window.t("تومان")}

@ -156,6 +156,7 @@ export default connect(
code: state.userFactor.info?.offCode?.code, code: state.userFactor.info?.offCode?.code,
userId: state.user.status.id, userId: state.user.status.id,
factorId: state.userFactor.info?.id, factorId: state.userFactor.info?.id,
lang: state.publicApi.lang,
}), }),
{ {
setCodeId: userFactor.update, setCodeId: userFactor.update,

@ -16,21 +16,7 @@ import "./index.scss";
const useStyles = makeStyles({ const useStyles = makeStyles({
table: {}, table: {},
}); });
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 maxMobileSize = 550; const maxMobileSize = 550;
const maxDesktopSize = 1250; const maxDesktopSize = 1250;
@ -117,7 +103,7 @@ function BasicTable(props) {
<TableRow> <TableRow>
<TableCell align="center"> <TableCell align="center">
<span style={{ color: "grey" }}> <span style={{ color: "grey" }}>
{window.t("مبلغ کل")} {factorInfo.sumPrice} {window.t("مبلغ کل")} {window.tr(factorInfo.sumPrice)}
</span> </span>
</TableCell> </TableCell>
<TableCell align="right" component="th" scope="row"> <TableCell align="right" component="th" scope="row">
@ -163,7 +149,7 @@ function BasicTable(props) {
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center">
<span style={{ color: "grey" }}> <span style={{ color: "grey" }}>
{window.t("مبلغ کل")} {factorInfo.sumPrice} {window.t("مبلغ کل")} {window.tr(factorInfo.sumPrice)}
</span> </span>
</TableCell> </TableCell>
<TableCell align="center" component="th" scope="row"> <TableCell align="center" component="th" scope="row">
@ -185,6 +171,21 @@ function BasicTable(props) {
} }
const Item = (props) => { const Item = (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 { data, pushToCart, id, route } = props; const { data, pushToCart, id, route } = props;
if (!data.product) return null; if (!data.product) return null;
return ( return (
@ -266,11 +267,12 @@ const Item = (props) => {
<div className="mobile-cart-table-price d-flex flex-column align-items-center"> <div className="mobile-cart-table-price d-flex flex-column align-items-center">
<div className="mobile-cart-table-price__price d-flex flex-column justify-content-center align-items-center"> <div className="mobile-cart-table-price__price d-flex flex-column justify-content-center align-items-center">
<strong style={{ fontSize: fontSize.mobile.price.strong }}> <strong style={{ fontSize: fontSize.mobile.price.strong }}>
{data.product.price * data.count || "1000"} {window.tr(data.product.price * data.count || 1000)}
</strong> </strong>
{route !== "callback" ? ( {route !== "callback" ? (
<span style={{ fontSize: fontSize.mobile.price.span }}> <span style={{ fontSize: fontSize.mobile.price.span }}>
{data.product.price || "100"} {window.t("قیمت هر واحد")}{" "} {window.tr(data.product.price || "100")}{" "}
{window.t("قیمت هر واحد")}{" "}
</span> </span>
) : null} ) : null}
</div> </div>
@ -336,7 +338,7 @@ const Item = (props) => {
/> />
<div className="d-flex flex-column justify-content-center"> <div className="d-flex flex-column justify-content-center">
<strong style={{ fontSize: fontSize.desktop.info.strong }}> <strong style={{ fontSize: fontSize.desktop.info.strong }}>
{`نسخه ${ {`${window.t("نسخه")} ${
+data.product?.productType === 1 +data.product?.productType === 1
? window.t("الکترونیکی") ? window.t("الکترونیکی")
: window.t("چاپی") : window.t("چاپی")
@ -356,7 +358,8 @@ const Item = (props) => {
<TableCell> <TableCell>
<div className="cart-item__price d-flex flex-column justify-content-center align-items-center"> <div className="cart-item__price d-flex flex-column justify-content-center align-items-center">
<strong style={{ fontSize: fontSize.desktop.price.strong }}> <strong style={{ fontSize: fontSize.desktop.price.strong }}>
{data.product.price * data.count || "1000"} {window.t("تومان")} {window.tr(data.product.price * data.count || "1000")}{" "}
{window.t("تومان")}
</strong> </strong>
<span style={{ fontSize: fontSize.desktop.price.span }}> <span style={{ fontSize: fontSize.desktop.price.span }}>
{window.t("قیمت هر عدد")}{" "} {window.t("قیمت هر عدد")}{" "}
@ -454,6 +457,7 @@ export default connect(
info: state.book.info, info: state.book.info,
id: state.user.status.id, id: state.user.status.id,
factorInfo: state.userFactor.info, factorInfo: state.userFactor.info,
lang: state.publicApi.lang,
}), }),
{ pushToCart: userProduct.add } { pushToCart: userProduct.add }
)(BasicTable); )(BasicTable);

@ -49,6 +49,10 @@ class Cart extends Component {
}; };
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
// if (this.props.factorInfo === null && !this.props.loading) {
// this.props.getFactorInfo({});
// }
if (window.location.search) if (window.location.search)
if (!window.location.search.includes("NOK") && !window.location.hash) { if (!window.location.search.includes("NOK") && !window.location.hash) {
let Authority = window.location.search let Authority = window.location.search
@ -214,8 +218,9 @@ class Cart extends Component {
</h3> </h3>
<div className="d-flex align-items-center"> <div className="d-flex align-items-center">
<strong style={{ fontSize: fontSize.mobile.h1 }}> <strong style={{ fontSize: fontSize.mobile.h1 }}>
{(factorInfo.payPrice - factorInfo.transportPrice) * {window.tr(
window.ratio} factorInfo.payPrice - factorInfo.transportPrice
)}
</strong> </strong>
<span style={{ fontSize: fontSize.mobile.h3 }}> <span style={{ fontSize: fontSize.mobile.h3 }}>
{window.t("تومان")} {window.t("تومان")}
@ -325,8 +330,9 @@ class Cart extends Component {
{factorInfo ? ( {factorInfo ? (
<div className="d-flex align-items-center"> <div className="d-flex align-items-center">
<strong style={{ fontSize: fontSize.mobile.h1 }}> <strong style={{ fontSize: fontSize.mobile.h1 }}>
{(factorInfo.payPrice - factorInfo.transportPrice) * {window.tr(
window.ratio} factorInfo.payPrice - factorInfo.transportPrice
)}
{/* // factorInfo.transportPrice - // factorInfo.offPrice} */} {/* // factorInfo.transportPrice - // factorInfo.offPrice} */}
</strong> </strong>
<span style={{ fontSize: fontSize.mobile.h3 }}> <span style={{ fontSize: fontSize.mobile.h3 }}>
@ -410,8 +416,9 @@ 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,
loading: state.userFactor.loading,
userId: state.user.status.id, userId: state.user.status.id,
lang: state.publicApi.lang,
isVerified: state.userFactor.isVerified, isVerified: state.userFactor.isVerified,
}), }),
{ {

@ -84,6 +84,7 @@ export default connect(
codeId: state.userFactor.info?.codeId, codeId: state.userFactor.info?.codeId,
userId: state.user.status.id, userId: state.user.status.id,
factorId: state.userFactor.info?.id, factorId: state.userFactor.info?.id,
lang: state.publicApi.lang,
}), }),
{ {
setCodeId: userFactor.update, setCodeId: userFactor.update,

@ -157,7 +157,7 @@ const Item = (props) => {
/> />
<div className="mobile-cart-table-product__info d-flex flex-column p-1"> <div className="mobile-cart-table-product__info d-flex flex-column p-1">
<strong style={{ fontSize: fontSize.mobile.info.strong }}> <strong style={{ fontSize: fontSize.mobile.info.strong }}>
{`نسخه ${ {`${window.t("نسخه")} ${
+data.product.productType === 1 +data.product.productType === 1
? window.t("الکترونیکی") ? window.t("الکترونیکی")
: window.t("چاپی") : window.t("چاپی")
@ -215,7 +215,7 @@ const Item = (props) => {
</strong> </strong>
<span style={{ fontSize: 12 }}> <span style={{ fontSize: 12 }}>
{" "} {" "}
{`نسخه ${ {`${window.t("نسخه")} ${
+data.product.productType === 1 +data.product.productType === 1
? window.t("الکترونیکی") ? window.t("الکترونیکی")
: window.t("چاپی") : window.t("چاپی")

@ -229,7 +229,7 @@ class Cart extends Component {
<div className="mt-2"> <div className="mt-2">
<TextArea <TextArea
parent={this} parent={this}
label={"آدرس "} label={window.t("آدرس")}
name="recieverAddress" name="recieverAddress"
defaultValue={factorInfo.recieverAddress} defaultValue={factorInfo.recieverAddress}
required required
@ -289,7 +289,7 @@ class Cart extends Component {
list={list} list={list}
handleCounter={this.handleCounter} handleCounter={this.handleCounter}
handleDelete={this.handleDelete} handleDelete={this.handleDelete}
payPrice={payPrice} payPrice={window.tr(payPrice)}
route={"cart"} route={"cart"}
/> />
{factorInfo ? <Factor parent={this} list={list} /> : null} {factorInfo ? <Factor parent={this} list={list} /> : null}
@ -431,7 +431,7 @@ class Cart extends Component {
<div className="mt-2"> <div className="mt-2">
<TextArea <TextArea
parent={this} parent={this}
label={"آدرس "} label={window.t("آدرس")}
name="recieverAddress" name="recieverAddress"
defaultValue={factorInfo.recieverAddress} defaultValue={factorInfo.recieverAddress}
required required

@ -9,6 +9,7 @@ const useStyles = makeStyles((theme) => ({
// maxWidth: "400px", // maxWidth: "400px",
position: "relative", position: "relative",
marginTop: 20, marginTop: 20,
border: "1px solid #333333",
}, },
}, },
})); }));
@ -33,6 +34,7 @@ export default function FormPropsTextFields({
variant="outlined" variant="outlined"
onChange={(e) => parent.onChange(name, e.target.value)} onChange={(e) => parent.onChange(name, e.target.value)}
required={required} required={required}
style={{ border: "1px solid #44444455", borderRadius: "10px" }}
/> />
</div> </div>
</form> </form>

@ -39,8 +39,9 @@ class Contact extends Component {
text: null, text: null,
}; };
componentDidMount() { componentDidUpdate() {
if (!this.props.contactData?.address) this.props.getContactData(); if (!this.props.contactData?.address && !this.props.loading)
this.props.getContactData();
} }
render() { render() {
@ -165,7 +166,7 @@ export default connect(
loading: state.publicApi.loading, loading: state.publicApi.loading,
contactData: state.publicApi.contactData, contactData: state.publicApi.contactData,
list: state.userProduct.mylist || [], list: state.userProduct.mylist || [],
//loading: state.publicApi.loading, // loading: state.publicApi.loading,
}), }),
{ getContactData: publicApi.getContactData } { getContactData: publicApi.getContactData }
)(Contact); )(Contact);

@ -15,23 +15,24 @@ const fontSize = {
old: window.innerWidth > maxDesktopSize ? 9 : window.innerWidth / 120, old: window.innerWidth > maxDesktopSize ? 9 : window.innerWidth / 120,
}, },
}; };
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("دوازدهم"),
];
export default class Item extends Component { export default class Item extends Component {
render() { 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; const { data } = this.props;
return ( return (
<> <>

@ -39,6 +39,11 @@ class Faq extends Component {
componentDidMount() { componentDidMount() {
this.props.getFaqList(); this.props.getFaqList();
} }
componentDidUpdate() {
if (!this.props.faqList.length && !this.props.loading) {
this.props.getFaqList();
}
}
setMessageActive = (id, status) => { setMessageActive = (id, status) => {
if (this.state.searchedMessages) { if (this.state.searchedMessages) {

@ -7,7 +7,13 @@ import contact from "../../../assets/icons/contact.png";
import "./index.scss"; import "./index.scss";
export default class Footer extends Component { export default class Footer extends Component {
render() { render() {
const { fastAccess } = this.props; const fastAccess = [
{ name: window.t("صفحه اصلی"), link: "/" },
{ name: window.t("فروشگاه"), link: "/shop" },
{ name: window.t("سوالات متداول"), link: "/faq" },
{ name: window.t("درباره ما"), link: "/about" },
{ name: window.t("تماس با ما"), link: "/call" },
];
return ( return (
<> <>
{window.innerWidth > 1000 ? ( {window.innerWidth > 1000 ? (
@ -31,7 +37,13 @@ export default class Footer extends Component {
window.lang === "en" ? "ltr" : "" window.lang === "en" ? "ltr" : ""
}`} }`}
> >
<h1>{window.t("دانوین کجاست؟")}</h1> <h1
style={{
textAlign: window.lang == "en" ? "left" : "right",
}}
>
{window.t("دانوین کجاست؟")}
</h1>
<p <p
className="mt-2" className="mt-2"
style={{ style={{
@ -60,7 +72,11 @@ export default class Footer extends Component {
? "ltr" ? "ltr"
: "" : ""
} }
style={{ width: "55%", justifyContent: "space-between" }} style={{
width: "55%",
justifyContent: "space-between",
textAlign: window.lang == "en" ? "left" : "right",
}}
> >
<div <div
className={ className={
@ -68,20 +84,22 @@ export default class Footer extends Component {
? "ltr" ? "ltr"
: "" : ""
} }
style={{ fontFamily: "Arial !important" }}
> >
<img
src={contact}
alt={window.t("تماس")}
className="m-1"
/>{" "}
<a <a
href="tel:58795" href="tel:58795"
style={{ textDecoration: "none", color: "white" }} style={{
textDecoration: "none",
color: "white",
fontFamily: window.lang == "en" ? "Arial" : "",
}}
> >
58795 58795
</a> </a>
<img
src={contact}
alt={window.t("تماس")}
className="m-1"
/>
</div> </div>
{/* <div {/* <div
className="d-flex align-items-center" className="d-flex align-items-center"
@ -221,12 +239,4 @@ export default class Footer extends Component {
} }
} }
Footer.defaultProps = { Footer.defaultProps = {};
fastAccess: [
{ name: window.t("صفحه اصلی"), link: "/" },
{ name: window.t("فروشگاه"), link: "/shop" },
{ name: window.t("سوالات متداول"), link: "/faq" },
{ name: window.t("درباره ما"), link: "/about" },
{ name: window.t("تماس با ما"), link: "/call" },
],
};

@ -11,7 +11,7 @@ import Menu from "@material-ui/core/Menu";
import { connect } from "react-redux"; import { connect } from "react-redux";
import "./index.scss"; import "./index.scss";
import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import { user } from "~/Redux/actions"; import { user, publicApi } from "~/Redux/actions";
function Navigate({ path }) { function Navigate({ path }) {
let history = useHistory(); let history = useHistory();
return <>{history.push(path)}</>; return <>{history.push(path)}</>;
@ -25,39 +25,42 @@ const fontSize = {
}, },
}; };
const changeLanguage = (val) => { // const changeLanguage = (val) => {
if (val === "fa") { // if (val === "fa") {
localStorage.removeItem("language"); // localStorage.removeItem("language");
} else if (val === "en") { // } else if (val === "en") {
localStorage.setItem("language", "en"); // localStorage.setItem("language", "en");
} else { // } else {
localStorage.setItem("language", "ar"); // localStorage.setItem("language", "ar");
} // }
window.location.reload(); // window.location.reload();
}; // };
class LaptopNavbar extends Component { class LaptopNavbar extends Component {
state = {}; state = {};
render() { render() {
const { status } = this.props; const { status } = this.props;
if (this.state.navigatePath) return <Navigate path={this.navigatePath} />; if (this.state.navigatePath)
const { links } = this.props; return <Navigate path={this.state.navigatePath} />;
const 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" },
];
return ( return (
<nav <nav
className={`laptop-navbar d-flex ${ className={`laptop-navbar d-flex ${window.lang === "en" ? "ltr" : ""}`}
window.lang === "en" ? "flex-row-reverse" : ""
}`}
> >
<div <div className={`d-flex ${window.lang === "en" ? "ltr" : ""}`}>
className={`d-flex ${window.lang === "en" ? "flex-row-reverse" : ""}`}
>
<Link to="/" className="laptop-navbar__logo"> <Link to="/" className="laptop-navbar__logo">
<img src={logo} alt={window.t("لوگو")} /> <img src={logo} alt={window.t("لوگو")} />
</Link> </Link>
<ul <ul
className={`laptop-navbar__list d-flex ${ className={`laptop-navbar__list d-flex ${
window.lang === "en" ? "flex-row-reverse" : "" window.lang === "en" ? "ltr" : ""
}`} }`}
> >
{links.map((item, i) => ( {links.map((item, i) => (
@ -83,14 +86,14 @@ class LaptopNavbar extends Component {
color: "#6f7074", color: "#6f7074",
}} }}
> >
{window.t("دانلود")}{" "} {window.t("دانلود")}
</span> </span>
</li> </li>
</ul> </ul>
</div> </div>
<div <div
className={`d-flex align-items-center ${ className={`d-flex align-items-center ${
window.lang === "en" ? "flex-row-reverse" : "" window.lang === "en" ? "ltr" : ""
}`} }`}
> >
{proxy.status() ? ( {proxy.status() ? (
@ -158,7 +161,11 @@ class LaptopNavbar extends Component {
className="language-select" className="language-select"
onChange={(e) => { onChange={(e) => {
window.localStorage.setItem("language", e.target.value); 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" className="language-select"
onChange={(e) => { onChange={(e) => {
window.localStorage.setItem("language", e.target.value); 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)} {console.log(window.lang)}
@ -248,15 +258,12 @@ class LaptopNavbar extends Component {
); );
} }
} }
export default connect((state) => ({ status: state.user.status }), { export default connect(
logout: user.logout, (state) => ({ status: state.user.status, lang: state.publicApi.lang }),
})(LaptopNavbar); {
LaptopNavbar.defaultProps = { changeLanguage: publicApi.changeLanguage,
links: [
{ name: window.t("صفحه اصلی"), to: "/", page: "home" }, logout: user.logout,
{ name: window.t("فروشگاه"), to: "/products", page: "products" }, }
{ name: window.t("سوالات متداول"), to: "/faq", page: "faq" }, )(LaptopNavbar);
{ name: window.t("درباره ما"), to: "/about", page: "about" }, LaptopNavbar.defaultProps = {};
{ name: window.t("پشتیبانی"), to: "/contact", page: "contact" },
],
};

@ -12,8 +12,15 @@ import back from "../../../../assets/icons/back.png";
import hamburger from "../../../../assets/icons/hamburger.png"; import hamburger from "../../../../assets/icons/hamburger.png";
import search from "../../../../assets/icons/navbarSearch.png"; import search from "../../../../assets/icons/navbarSearch.png";
import proxy from "~/Redux/proxy"; import proxy from "~/Redux/proxy";
import { connect } from "react-redux";
import { publicApi } from "~/Redux/actions";
import "./index.scss"; import "./index.scss";
function Navigate({ path }) {
let history = useHistory();
return <>{history.push(path)}</>;
}
function BackButton({ children }) { function BackButton({ children }) {
let history = useHistory(); let history = useHistory();
return ( 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({ const useStyles = makeStyles({
list: { list: {
width: window.innerWidth * 0.8, 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 status = proxy.status();
const classes = useStyles(); const classes = useStyles();
const [state, setState] = useState({ const [state, setState] = useState({
@ -119,7 +115,10 @@ export default function MobileNavbar(props) {
className="language-select" className="language-select"
onChange={(e) => { onChange={(e) => {
window.localStorage.setItem("language", e.target.value); 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" className="language-select"
onChange={(e) => { onChange={(e) => {
window.localStorage.setItem("language", e.target.value); 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) {
</nav> </nav>
); );
} }
export default connect((state) => ({ lang: state.publicApi.lang }), {
changeLanguage: publicApi.changeLanguage,
})(MobileNavbar);

@ -5,27 +5,28 @@ import { userProduct } from "~/Redux/actions";
import moment from "jalali-moment"; import moment from "jalali-moment";
import "./index.scss"; import "./index.scss";
import { Link } from "react-router-dom"; 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 { class MyBooks extends Component {
componentDidMount() { componentDidMount() {
if (!this.props.mylist) this.props.getMyList(); if (!this.props.mylist) this.props.getMyList();
} }
render() { 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); const data = (this.props.myList || []).filter((e) => +e.productType === 3);
return ( return (
<div className="mybooks"> <div className="mybooks">

@ -264,7 +264,7 @@ class NewProfile extends Component {
/> />
</div> </div>
<div className="mb-2"> <div className="mb-2">
<Birthdate /> <Birthdate defaultValue={profile} name="birthdate" />
</div> </div>
{/* <div className="mb-2"> {/* <div className="mb-2">
<Input name="password" label="رمز عبور" parent={this} /> <Input name="password" label="رمز عبور" parent={this} />

@ -4,26 +4,27 @@ import Navbar from "../Home/Navbar";
import { userFactor } from "~/Redux/actions"; import { userFactor } from "~/Redux/actions";
import "./index.css"; import "./index.css";
import moment from "jalali-moment"; 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 { class Orders extends Component {
componentDidMount() { componentDidMount() {
if (!this.props.list) this.props.getList(); if (!this.props.list) this.props.getList();
} }
render() { 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(); // props.getList();
let data = this.props.list; let data = this.props.list;
return ( return (

@ -5,9 +5,11 @@ import Navbar from "../Home/Navbar/index";
export default class Test extends Component { export default class Test extends Component {
render() { render() {
const id = +window.location.pathname.split("/").slice(-1)[0]; const id = +window.location.pathname.split("/").slice(-1)[0];
console.log(1);
return ( return (
<div style={{ height: "100%" }}> <div style={{ height: "100%" }}>
<Navbar /> <Navbar />
<br /> <br />
<br /> <br />

@ -29,21 +29,7 @@ import "./index.scss";
const maxDesktopSize = 1250; const maxDesktopSize = 1250;
const maxMobileSize = 550; 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 = { const fontSize = {
desktop: { desktop: {
h1: window.innerWidth > maxDesktopSize ? 20 : window.innerWidth / 70, h1: window.innerWidth > maxDesktopSize ? 20 : window.innerWidth / 70,
@ -122,9 +108,39 @@ class Product extends Component {
}); });
this.props.getList(); 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() { 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 ( return (
<> <>
{window.innerWidth > 1000 ? ( {window.innerWidth > 1000 ? (
@ -406,17 +422,12 @@ export default connect(
loading: state.book.loading, loading: state.book.loading,
list: state.book.list, list: state.book.list,
id: state.user.status.id, id: state.user.status.id,
lang: state.publicApi.lang,
}), }),
{ getInfo: book.info, getList: book.list, pushToCart: userProduct.add } { getInfo: book.info, getList: book.list, pushToCart: userProduct.add }
)(Product); )(Product);
Product.defaultProps = { Product.defaultProps = {};
supportItems: [
{ title: window.t("ارسال سریع"), icon: product_shipping },
{ title: window.t("پشتیبانی 24 ساعته"), icon: product_support },
{ title: window.t("ضمانت بازگشت"), icon: product_cash_back },
],
};
const Identifier = (props) => { const Identifier = (props) => {
return ( return (

@ -11,6 +11,10 @@ class List extends React.Component {
componentDidMount() { componentDidMount() {
if (this.props.list?.length === 0) this.props.getList(); if (this.props.list?.length === 0) this.props.getList();
} }
componentDidUpdate() {
if (this.props.list?.length === 0 && !this.props.loading)
this.props.getList();
}
render() { render() {
let { filterResult, loading } = this.props; let { filterResult, loading } = this.props;

@ -9,21 +9,6 @@ import { connect } from "react-redux";
import { userProduct } from "~/Redux/actions"; import { userProduct } from "~/Redux/actions";
import "./index.scss"; 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) { function Product(props) {
let history = useHistory(); let history = useHistory();
@ -41,6 +26,21 @@ function Product(props) {
}); });
setTimeout(() => history.push("/cart"), 2000); 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 ( return (
<> <>
{window.innerWidth < 1000 ? ( {window.innerWidth < 1000 ? (

@ -13,6 +13,9 @@ const fontSize = {
export default class Sort extends React.Component { export default class Sort extends React.Component {
render() { render() {
const { parent, selectedSort } = this.props; const { parent, selectedSort } = this.props;
const sortItems = [window.t("پرفروش ترین"), window.t("جدیدترین")];
return ( return (
<div <div
className={`products-sort d-flex align-items-center ${ className={`products-sort d-flex align-items-center ${
@ -31,7 +34,7 @@ export default class Sort extends React.Component {
window.lang === "en" ? "flex-row-reverse" : "" window.lang === "en" ? "flex-row-reverse" : ""
}`} }`}
> >
{parent.props.sortItems.map((item, i) => ( {sortItems.map((item, i) => (
<Item <Item
data={item} data={item}
key={i} key={i}

@ -172,7 +172,3 @@ export default connect(
filterBook: book.filterBook, filterBook: book.filterBook,
} }
)(Products); )(Products);
Products.defaultProps = {
sortItems: [window.t("پرفروش ترین"), window.t("جدیدترین")],
};

@ -271,7 +271,7 @@ class QR extends Component {
</div> </div>
) : ( ) : (
<div className="mobile-qr__notAccess d-flex flex-column p-3"> <div className="mobile-qr__notAccess d-flex flex-column p-3">
<h1>{window.q("محتوایی برای این صفحه در دسترس نیست.!")}</h1> <h1>{window.t("محتوایی برای این صفحه در دسترس نیست.!")}</h1>
<div className="mobile-qr-scan__back d-flex mb-2"> <div className="mobile-qr-scan__back d-flex mb-2">
<Link to="/">{window.t("بازگشت")}</Link> <Link to="/">{window.t("بازگشت")}</Link>
</div> </div>

@ -3,23 +3,22 @@ import { Link } from "react-router-dom";
import "./index.scss"; 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) { 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; const { data } = props;
return ( return (
<> <>

@ -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 <>{""}</>;
}

@ -20,7 +20,10 @@ export default function Document(props) {
return ( return (
<> <>
{window.innerWidth < 1000 ? ( {window.innerWidth < 1000 ? (
<div className="support__document d-flex justify-content-center align-items-center mb-3"> <div
className="support__document d-flex justify-content-center align-items-center mb-3"
style={{ marginTop: 8 }}
>
<input <input
type="file" type="file"
name={name} name={name}

@ -10,21 +10,7 @@ import "./index.scss";
import { connect } from "react-redux"; import { connect } from "react-redux";
const maxDesktopSize = 1250; const maxDesktopSize = 1250;
const maxMobileSize = 550; 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 = { const fontSize = {
desktop: { desktop: {
h1: window.innerWidth > maxDesktopSize ? 30 : window.innerWidth / 40, h1: window.innerWidth > maxDesktopSize ? 30 : window.innerWidth / 40,
@ -80,6 +66,21 @@ class Support extends Component {
//todo redirectHome //todo redirectHome
} }
render() { 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 { status } = this.props;
let opt = [ let opt = [
window.t("واحد مورد نظر"), window.t("واحد مورد نظر"),
@ -92,7 +93,12 @@ class Support extends Component {
<> <>
<div className="mobile-support d-flex flex-column align-items-center"> <div className="mobile-support d-flex flex-column align-items-center">
<Navbar page={"support"} /> <Navbar page={"support"} />
<div className="mobile-support__form d-flex flex-column"> <div
className={
"mobile-support__form d-flex flex-column " +
(window.lang === "en" ? "ltr" : "")
}
>
<h1 style={{ fontSize: fontSize.mobile.h1 }}> <h1 style={{ fontSize: fontSize.mobile.h1 }}>
{window.t("پشتیبانی")} {window.t("پشتیبانی")}
</h1> </h1>
@ -177,6 +183,7 @@ export default connect(
myProductList: state.userProduct.myList, myProductList: state.userProduct.myList,
status: state.user.status, status: state.user.status,
uploadFileId: state.file.supportFileId, uploadFileId: state.file.supportFileId,
lang: state.publicApi.lang,
}), }),
{ {
getUserProductList: userProduct.myList, getUserProductList: userProduct.myList,

Loading…
Cancel
Save