master
amir hosein gorji 3 years ago
parent 4e66f2d8c9
commit 09bb0f0ed6
  1. BIN
      public/favicon.ico
  2. 80
      public/index.html
  3. BIN
      public/logo192.png
  4. BIN
      public/logo512.png
  5. 4
      public/manifest.json
  6. 2
      src/AppRouter.js
  7. 8
      src/views/AR/index.js
  8. 6
      src/views/Auth/Login/Cellphone/index.scss
  9. 9
      src/views/Auth/Profile/Birthdate/index.js
  10. 59
      src/views/Auth/Profile/Document/index.js
  11. 8
      src/views/Auth/Profile/Select/index.js
  12. 80
      src/views/Auth/Profile/index.js
  13. 2
      src/views/Contact/Input/index.js
  14. 9
      src/views/Contact/Select/index.js
  15. 6
      src/views/Contact/index.js
  16. 2
      src/views/Contact/index.scss
  17. 60
      src/views/Home/HomeSlider/Header/index.scss
  18. 17
      src/views/Home/Navbar/Laptop/index.js
  19. 3
      src/views/Home/Navbar/Laptop/index.scss
  20. 9
      src/views/Home/Navbar/Mobile/NavbarDrawer/NavbarDrawer.js
  21. 24
      src/views/Product/AddToCart/index.js
  22. 26
      src/views/Product/index.js
  23. 8
      src/views/Products/Product/index.js

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 15 KiB

@ -1,45 +1,41 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta
name="viewport"
content="width=device-width, initial-scale=1"
user-scalable="false"
/>
<meta name="theme-color" content="#000000" />
<meta name="description" content="فروشگاه کتاب دانوین" />
<link
href="https://api.mapbox.com/mapbox-gl-js/v1.10.1/mapbox-gl.css"
rel="stylesheet"
/>
<meta name="mobile-web-app-capable" content="yes" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>دانوین</title> <head>
</head> <meta charset="utf-8" />
<body> <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<div id="root"></div> <meta name="viewport" content="width=device-width, initial-scale=1" user-scalable="false" />
<script> <meta name="theme-color" content="#000000" />
if ("serviceWorker" in navigator) { <meta name="description" content="دانوین" />
window.addEventListener("load", function () { <link href="https://api.mapbox.com/mapbox-gl-js/v1.10.1/mapbox-gl.css" rel="stylesheet" />
navigator.serviceWorker <meta name="mobile-web-app-capable" content="yes" />
.register("./serviceworker.js") <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
.then((registration) => { <meta name="apple-mobile-web-app-capable" content="yes" />
// Registration was successful <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
console.log(
"ServiceWorker registration successful with scope: ", <title>دانوین</title>
registration.scope </head>
);
}) <body>
.catch((err) => { <div id="root"></div>
console.log(err); <script>
}); if ("serviceWorker" in navigator) {
}); window.addEventListener("load", function () {
} navigator.serviceWorker
</script> .register("./serviceworker.js")
</body> .then((registration) => {
</html> // Registration was successful
console.log(
"ServiceWorker registration successful with scope: ",
registration.scope
);
})
.catch((err) => {
console.log(err);
});
});
}
</script>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 35 KiB

@ -1,6 +1,6 @@
{ {
"short_name": "دانوین", "short_name": "دانوین",
"name": "فروشگاه کتاب دانوین", "name": " دانوین",
"icons": [ "icons": [
{ {
"src": "favicon.ico", "src": "favicon.ico",
@ -25,4 +25,4 @@
"display": "standalone", "display": "standalone",
"theme_color": "#000000", "theme_color": "#000000",
"background_color": "#ffffff" "background_color": "#ffffff"
} }

@ -60,7 +60,7 @@ class AppRouter extends Component {
} }
componentDidMount() { componentDidMount() {
this.props.getUserProductList(); //sthis.props.getUserProductList();
} }
render() { render() {

@ -1,6 +1,6 @@
import React, { Component } from "react"; import React, { Component } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { publicApi } from "~/Redux/actions"; import { userProduct } from "~/Redux/actions";
import Navbar from "../Home/Navbar/index"; import Navbar from "../Home/Navbar/index";
import Footer from "../Home/Footer/index"; import Footer from "../Home/Footer/index";
@ -22,7 +22,7 @@ const fontSize = {
class AR extends Component { class AR extends Component {
componentDidMount() { componentDidMount() {
window.scrollTo(0, 0); window.scrollTo(0, 0);
this.props.getArList(); // this.props.getArList({ type: 3 });
} }
render() { render() {
@ -75,9 +75,9 @@ class AR extends Component {
export default connect( export default connect(
(state) => ({ (state) => ({
arList: state.publicApi.arList, arList: state.userProduct.list,
}), }),
{ {
getArList: publicApi.getArList, getArList: userProduct.list,
} }
)(AR); )(AR);

@ -32,10 +32,12 @@
text-align: right; text-align: right;
position: absolute; position: absolute;
left: 108px; left: 108px;
top: 23px; top: 19px;
height: 43px;
direction: ltr; direction: ltr;
color: #a5a5a5; color: #a5a5a5;
font-family: numeralLight; font-family: numeralLight;
display: block;
} }
input { input {
font-family: numeralLight; font-family: numeralLight;
@ -47,7 +49,7 @@
text-align: left; text-align: left;
background-color: #f2f2f2; background-color: #f2f2f2;
border: none; border: none;
padding: 8px 5px 8px 80px; padding: 8px 5px 8px 85px;
border-radius: 5px; border-radius: 5px;
&:focus { &:focus {
outline: 0px; outline: 0px;

@ -5,10 +5,11 @@ import "./index.scss";
import moment from "jalali-moment"; 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;
const momentDate = moment(defaultValue[name]); let momentDate = moment(defaultValue[name]);
const day = momentDate.format("jDD"), let isvalid = momentDate.isValid();
month = momentDate.format("jMM"), const day = isvalid ? momentDate.format("jDD") : null,
year = momentDate.format("jYYYY"); month = isvalid ? momentDate.format("jMM") : null,
year = isvalid ? momentDate.format("jYYYY") : null;
const [state, setState] = useState({ day, month, year }); const [state, setState] = useState({ day, month, year });
const onChange = (_name, value) => { const onChange = (_name, value) => {
let _state = { ...state, [_name]: value }; let _state = { ...state, [_name]: value };

@ -21,7 +21,7 @@ export default function Document(props) {
<> <>
{window.innerWidth < 1000 ? ( {window.innerWidth < 1000 ? (
<div className="mobile-auth-profile__document d-flex justify-content-center align-items-center mb-3"> <div className="mobile-auth-profile__document d-flex justify-content-center align-items-center mb-3">
{parent.state.docFileIds === "" ? ( {parent.state[name] === "" ? (
<> <>
<input <input
type="file" type="file"
@ -44,45 +44,66 @@ export default function Document(props) {
parent.onChange(e.target.name, e.target.files[0]) parent.onChange(e.target.name, e.target.files[0])
} }
/> />
<span style={{ color: "rgb(18,140,126)" }}> <span
{parent.state.docFileIds.name} style={{
fontSize: fontSize.mobile.span,
width: "100%",
textAlign: "center",
margin: "auto",
}}
>
{parent.state[name].name ||
"گواهی تدریس ثبت شده و درحال بررسی می باشد"}
</span> </span>
{/* <img src={parent.state.file} alt={"کاربر"} /> */}
</> </>
)} )}
</div> </div>
) : null} ) : null}
{window.innerWidth > 1000 ? ( {window.innerWidth > 1000 ? (
<div className="auth-profile__upload d-flex justify-content-center-align-items-center"> <div className="mobile-auth-profile__document d-flex justify-content-center-align-items-center">
{parent.state.file === null ? ( {parent.state[name] === "" ? (
<> <>
<input <input
label={props.label}
onChange={(e) => parent.onChange(e.target.name, e.target.value)}
name={props.name}
defaultValue=""
type="file" type="file"
// parent.onChange(e.target.name, e.target.value)
name={name}
onChange={(e) =>
parent.onChange(e.target.name, e.target.files[0])
}
/> />
<AddAPhotoIcon <span
style={{ style={{
width: 40, fontSize: fontSize.mobile.span,
height: 40, width: "100%",
color: "grey", textAlign: "center",
position: "absolute", margin: "auto",
left: "calc(50% - 20px)",
top: "calc(50% - 20px)",
}} }}
/> >
گواهی تدریس خود را آپلود کنید.
</span>
</> </>
) : ( ) : (
<> <>
<input <input
label={props.label} label={props.label}
onChange={(e) => parent.onChange(e.target.name, e.target.value)} onChange={(e) =>
parent.onChange(e.target.name, e.target.files[0])
}
name={props.name} name={props.name}
defaultValue="" defaultValue=""
type="file" type="file"
/> />
<span
style={{
fontSize: fontSize.mobile.span,
width: "100%",
textAlign: "center",
margin: "auto",
}}
>
{parent.state[name].name ||
"گواهی تدریس ثبت شده و درحال بررسی می باشد"}
</span>
</> </>
)} )}
</div> </div>

@ -34,8 +34,8 @@ export default function CustomizedSelects(props) {
> >
{/* 09366858119 */} {/* 09366858119 */}
{props.options.map((item, i) => ( {props.options.map((item, i) => (
<option key={i} value={i}> <option key={i} value={item.id || i}>
{item} {item.name || item}
</option> </option>
))} ))}
</Select> </Select>
@ -65,8 +65,8 @@ export default function CustomizedSelects(props) {
> >
{/* 09366858119 */} {/* 09366858119 */}
{props.options.map((item, i) => ( {props.options.map((item, i) => (
<option key={i} value={i}> <option key={i} value={item.id || i}>
{item} {item.name || item}
</option> </option>
))} ))}
</Select> </Select>

@ -1,6 +1,6 @@
import React, { Component } from "react"; import React, { Component } from "react";
import onInput from "~/util/onInput"; import onInput from "~/util/onInput";
import { user, file } from "~/Redux/actions"; import { user, file, publicApi } from "~/Redux/actions";
import { connect } from "react-redux"; import { connect } from "react-redux";
import Select from "./Select/index"; import Select from "./Select/index";
@ -14,8 +14,8 @@ import Loader from "~/components/Loader/index";
import Document from "./Document/index"; import Document from "./Document/index";
import logo from "../../../assets/icons/logo.png"; import logo from "../../../assets/icons/logo.png";
import pic from "../../../assets/images/pic.png"; import pic from "../../../assets/images/pic.png";
import { useHistory } from "react-router-dom";
import "./index.scss"; import "./index.scss";
import { useHistory } from "react-router-dom";
function Navigate({ path }) { function Navigate({ path }) {
let history = useHistory(); let history = useHistory();
return <>{history.push(path)}</>; return <>{history.push(path)}</>;
@ -47,7 +47,8 @@ class Profile extends Component {
file: this.props.uploads["file"] || this.props.profile.picFileId || null, file: this.props.uploads["file"] || this.props.profile.picFileId || null,
picFileId: picFileId:
this.props.uploads["file"] || this.props.profile.picFileId || null, this.props.uploads["file"] || this.props.profile.picFileId || null,
docFileIds: "", docFileIds:
this.props.uploads["docFileIds"] || this.props.profile.docFileIds || "",
firstName: "", firstName: "",
lastName: "", lastName: "",
password: "", password: "",
@ -58,13 +59,15 @@ class Profile extends Component {
gender: this.props.profile.gender || 1, gender: this.props.profile.gender || 1,
status: this.props.profile.status || 1, status: this.props.profile.status || 1,
nationalId: "", nationalId: "",
provinceId: "",
phone: "", phone: "",
cityId: "",
zoneId: "", zoneId: "",
schoolId: "", schoolId: "",
postalCode: "", postalCode: "",
gradeIds: this.props.profile.gradeIds, gradeIds: this.props.profile.gradeIds,
provinceId: this.props.profile.provinceId,
cityId: this.props.profile.cityId,
validation: { validation: {
firstName: "", firstName: "",
@ -78,20 +81,28 @@ class Profile extends Component {
}; };
componentDidMount() { componentDidMount() {
this.props.getProvince();
this.props.getCity({ provinceId: this.props.profile.provinceId });
// this.props.getProfile(); // this.props.getProfile();
} }
onChange = (name, value) => { onChange = (name, value) => {
// if (name === "gradeIds" && this.state.status == 2) { if (name === "provinceId") {
// this.setState((prevState) => ({ this.props.getCity({ provinceId: value });
// gradeIds: [...prevState.gradeIds.split(","), value], this.setState({
// })); cityId: null,
// } else [name]: value,
if (name === "status") { });
} else if (name === "status") {
this.setState((prevState) => ({ this.setState((prevState) => ({
gradeIds: prevState.gradeIds.slice(0, 1) || [], gradeIds: prevState.gradeIds.slice(0, 1) || [],
[name]: value, [name]: value,
})); }));
} else if (name === "docFileIds") {
this.props.upload({ file: value, target: name });
this.setState({
[name]: value,
});
} else if (name === "file") { } else if (name === "file") {
this.props.upload({ file: value, target: name }); this.props.upload({ file: value, target: name });
this.setState({ this.setState({
@ -122,6 +133,9 @@ class Profile extends Component {
schools, schools,
gradeIds, gradeIds,
status, status,
provinceId,
cityId,
docFileIds,
} = this.state; } = this.state;
const { profile, setProfile } = this.props; const { profile, setProfile } = this.props;
const data = { const data = {
@ -143,6 +157,11 @@ class Profile extends Component {
schools: schools || profile.schools, schools: schools || profile.schools,
gradeIds: String(gradeIds || profile.gradeIds), gradeIds: String(gradeIds || profile.gradeIds),
status: status || profile.status, status: status || profile.status,
provinceId: provinceId || profile.provinceId,
cityId: cityId || profile.cityId,
docFileIds: String(
this.props.uploads["docFileIds"] || docFileIds || profile.docFileIds
),
}; };
await setProfile(data); await setProfile(data);
}; };
@ -294,21 +313,23 @@ class Profile extends Component {
/> />
</div> </div>
) : null} ) : null}
{console.log(this.props.province)}
<div className="mb-2" style={{ minWidth: "100%" }}> <div className="mb-2" style={{ minWidth: "100%" }}>
<Select <Select
parent={this} parent={this}
options={["karaj", "tehran"]} options={this.props.provinceList}
name="province" name="provinceId"
label={"استان"} label={"استان"}
selectedOptions={this.state.provinceId}
/> />
</div> </div>
<div className="mb-2"> <div className="mb-2">
<Select <Select
parent={this} parent={this}
options={["karaj", "tehran"]} options={this.props.cityList}
name="city" name="cityId"
label={"شهرستان"} label={"شهرستان"}
selectedOptions={this.state.cityId}
/> />
</div> </div>
{/* <div className="mb-2"> {/* <div className="mb-2">
@ -319,7 +340,7 @@ class Profile extends Component {
label={"شهر/روستا"} label={"شهر/روستا"}
/> />
</div> */} </div> */}
{this.state.status === "دانش آموز" ? ( {this.state.status == 1 ? (
<div className="mb-2"> <div className="mb-2">
<Input <Input
parent={this} parent={this}
@ -330,7 +351,7 @@ class Profile extends Component {
/> />
</div> </div>
) : null} ) : null}
{this.state.status === "معلم" ? ( {this.state.status == 2 ? (
<div className="mb-2"> <div className="mb-2">
<Input <Input
parent={this} parent={this}
@ -341,6 +362,9 @@ class Profile extends Component {
/> />
</div> </div>
) : null} ) : null}
{this.state.status == 2 ? (
<Document parent={this} name="docFileIds" />
) : null}
<div className="mb-2"> <div className="mb-2">
<Input <Input
parent={this} parent={this}
@ -458,8 +482,7 @@ class Profile extends Component {
selectedOptions={this.state.gradeIds} selectedOptions={this.state.gradeIds}
/> />
) : null} ) : null}
{this.state.status === "دانش آموز" && {this.state.status == 1 && Number(this.state.gradeIds) > 9 ? (
Number(this.state.gradeIds) > 9 ? (
<Select <Select
parent={this} parent={this}
options={[ options={[
@ -478,15 +501,17 @@ class Profile extends Component {
<Select <Select
parent={this} parent={this}
options={["karaj", "tehran"]} options={this.props.provinceList}
name="provinceId" name="provinceId"
label={"استان"} label={"استان"}
selectedOptions={this.state.provinceId}
/> />
<Select <Select
parent={this} parent={this}
options={["karaj", "tehran"]} options={this.props.cityList}
name="cityId" name="cityId"
label={"شهرستان"} label={"شهرستان"}
selectedOptions={this.state.cityId}
/> />
{/* <Select {/* <Select
parent={this} parent={this}
@ -494,7 +519,7 @@ class Profile extends Component {
name="zoneId" name="zoneId"
label={"شهر/روستا"} label={"شهر/روستا"}
/> */} /> */}
{this.state.status === "دانش آموز" ? ( {this.state.status == 1 ? (
<Input <Input
parent={this} parent={this}
name="schools" name="schools"
@ -503,7 +528,7 @@ class Profile extends Component {
onInput={onInput.persianOnly} onInput={onInput.persianOnly}
/> />
) : null} ) : null}
{this.state.status === "معلم" ? ( {this.state.status == 2 ? (
<Input <Input
parent={this} parent={this}
name="schools" name="schools"
@ -512,7 +537,7 @@ class Profile extends Component {
onInput={onInput.persianOnly} onInput={onInput.persianOnly}
/> />
) : null} ) : null}
{this.state.status === "معلم" ? ( {this.state.status == 2 ? (
<Document parent={this} name="docFileIds" /> <Document parent={this} name="docFileIds" />
) : null} ) : null}
<Input <Input
@ -530,7 +555,6 @@ class Profile extends Component {
label={"آدرس محل سکونت"} label={"آدرس محل سکونت"}
name="address" name="address"
defaultValue={profile} defaultValue={profile}
defaultValue={profile}
/> />
<div className="mobile-auth-profile__footer d-flex justify-content-center"> <div className="mobile-auth-profile__footer d-flex justify-content-center">
<button onClick={() => this.onSubmit()}>ذخیره</button>{" "} <button onClick={() => this.onSubmit()}>ذخیره</button>{" "}
@ -557,11 +581,15 @@ export default connect(
loading: state.user.loading, loading: state.user.loading,
uploading: state.file.loading, uploading: state.file.loading,
uploads: state.file.uploads, uploads: state.file.uploads,
provinceList: state.publicApi.province,
cityList: state.publicApi.city,
}), }),
{ {
getProfile: user.getProfile, getProfile: user.getProfile,
setProfile: user.setProfile, setProfile: user.setProfile,
upload: file.upload, upload: file.upload,
getProvince: publicApi.getProvince,
getCity: publicApi.getCity,
} }
)(Profile); )(Profile);

@ -6,7 +6,7 @@ const useStyles = makeStyles((theme) => ({
root: { root: {
"& .MuiTextField-root": { "& .MuiTextField-root": {
width: "100%", width: "100%",
maxWidth: "400px", // maxWidth: "400px",
position: "relative", position: "relative",
marginTop: 20, marginTop: 20,
}, },

@ -12,8 +12,9 @@ const BootstrapInput = withStyles((theme) => ({
}, },
}, },
input: { input: {
width: "calc(100vw - 20px) !important", width: "100%",
maxWidth: "400px !important", // width: "calc(100vw - 20px) !important",
// maxWidth: "400px !important",
borderRadius: 4, borderRadius: 4,
position: "relative", position: "relative",
backgroundColor: theme.palette.background.paper, backgroundColor: theme.palette.background.paper,
@ -37,8 +38,8 @@ export default function CustomizedSelects(props) {
const [age, setAge] = React.useState(""); const [age, setAge] = React.useState("");
return ( return (
<div className="home-search__select mr-2"> <div className="home-search__select mr-2" style={{ width: "100%" }}>
<FormControl className={classes.margin}> <FormControl className={classes.margin} style={{ width: "100%" }}>
<NativeSelect <NativeSelect
id="demo-customized-select-native" id="demo-customized-select-native"
onChange={(e) => onChange={(e) =>

@ -79,7 +79,7 @@ class Contact extends Component {
<div className="contact__location d-flex align-items-center"> <div className="contact__location d-flex align-items-center">
<img src={location} alt="آدرس" className="m-1" /> <img src={location} alt="آدرس" className="m-1" />
<p style={{ fontSize: fontSize.desktop.p }}> <p style={{ fontSize: fontSize.desktop.p }}>
{contactData.address} {contactData?.address || ""}
</p> </p>
</div> </div>
<div <div
@ -88,13 +88,13 @@ class Contact extends Component {
> >
<div className="d-flex align-items-center"> <div className="d-flex align-items-center">
<span style={{ fontSize: fontSize.desktop.span }}> <span style={{ fontSize: fontSize.desktop.span }}>
{contactData.cellphone} {contactData?.cellphone || ""}
</span> </span>
<img src={contact} alt="تماس" className="m-1" /> <img src={contact} alt="تماس" className="m-1" />
</div> </div>
<div className="d-flex align-items-center"> <div className="d-flex align-items-center">
<span style={{ fontSize: fontSize.desktop.span }}> <span style={{ fontSize: fontSize.desktop.span }}>
{contactData.email} {contactData?.email || ""}
</span> </span>
<img src={home} alt="خانه" className="m-1" /> <img src={home} alt="خانه" className="m-1" />
</div> </div>

@ -89,7 +89,7 @@
} }
textarea { textarea {
width: 350px; // width: 350px;
font-family: numeralLight; font-family: numeralLight;
border-radius: 10px; border-radius: 10px;
font-size: calc(100vw / 90); font-size: calc(100vw / 90);

@ -1,95 +1,93 @@
.slider-header{ .slider-header {
width : 100%; width: 100%;
justify-content: flex-end; justify-content: flex-end;
&__right{ &__right {
width: 60%; width: 60%;
height: 100%; height: 100%;
& img{ & img {
} }
} }
&__left{ &__left {
width: 40%; width: 40%;
height: 100%; height: 100%;
justify-content : center; justify-content: center;
align-items: flex-end; align-items: flex-end;
padding-left: 70px; padding-left: 70px;
h1{ h1 {
font-size: calc(100vw / 55); font-size: calc(100vw / 55);
color: white; color: white;
font-family: numeralBold; font-family: numeralBold;
letter-spacing: -1px; letter-spacing: -1px;
} }
h2{ h2 {
margin-top: 5px; margin-top: 5px;
font-size: calc(100vw / 78); font-size: calc(100vw / 78);
color: white; color: white;
font-family: numeralBold; font-family: numeralBold;
} }
a{ a {
text-decoration: none; text-decoration: none;
color: white; color: white;
margin-top: 10px; margin-top: 10px;
font-size: calc(100vw / 90); font-size: calc(100vw / 90);
padding: 6px 10px; padding: 6px 10px;
border : 1px solid white; border: 1px solid white;
border-radius: 5px; border-radius: 5px;
font-family: numeralMedium; font-family: numeralMedium;
&:hover{ &:hover {
color: white; color: white;
} }
} }
} }
} }
.mobile-slider-header {
.mobile-slider-header{ width: 100%;
width : 100%;
justify-content: flex-end; justify-content: flex-end;
&__right{ &__right {
width: 50%; width: 0%;
height: 100%; height: 100%;
justify-content : center; justify-content: center;
align-items: center; align-items: center;
& img{ & img {
position: relative; position: relative;
width: 200%; // width: 200%;
height: 110%; height: 110%;
right: 40px; // right: 40px;
bottom: 10px; bottom: 10px;
} }
} }
&__left{ &__left {
width: 50%; width: 50%;
height: 100%; height: 100%;
justify-content : center; justify-content: center;
align-items: flex-end; align-items: flex-end;
padding-left: 30px; padding-left: 30px;
h1{ h1 {
font-size: calc(100vw / 37); font-size: calc(100vw / 37);
color: white; color: white;
font-family: numeralBold; font-family: numeralBold;
} }
h2{ h2 {
margin-top: 5px; margin-top: 5px;
font-size: calc(100vw / 48); font-size: calc(100vw / 48);
color: white; color: white;
font-family: numeralBold; font-family: numeralBold;
} }
a{ a {
text-decoration: none; text-decoration: none;
color: white; color: white;
margin-top: 10px; margin-top: 10px;
font-size: calc(100vw / 55); font-size: calc(100vw / 55);
padding: 6px 10px; padding: 6px 10px;
border : 1px solid white; border: 1px solid white;
border-radius: 5px; border-radius: 5px;
font-family: numeralMedium; font-family: numeralMedium;
&:hover{ &:hover {
color: white; color: white;
} }
} }
} }
} }

@ -7,7 +7,11 @@ import logo from "~/assets/icons/logo.png";
import basket from "~/assets/icons/basket.png"; import basket from "~/assets/icons/basket.png";
import "./index.scss"; import "./index.scss";
import { useHistory } from "react-router-dom";
function Navigate({ path }) {
let history = useHistory();
return <>{history.push(path)}</>;
}
const maxDesktopSize = 1250; const maxDesktopSize = 1250;
const fontSize = { const fontSize = {
@ -18,7 +22,9 @@ const fontSize = {
}; };
export default class LaptopNavbar extends Component { export default class LaptopNavbar extends Component {
state = {};
render() { render() {
if (this.state.navigatePath) return <Navigate path={this.navigatePath} />;
const { links } = this.props; const { links } = this.props;
return ( return (
<nav className="laptop-navbar d-flex"> <nav className="laptop-navbar d-flex">
@ -64,8 +70,15 @@ export default class LaptopNavbar extends Component {
<img width="30" height="35" src={basket} alt="سبد خرید" /> <img width="30" height="35" src={basket} alt="سبد خرید" />
</Link> </Link>
<div <div
to="/auth?logout"
style={{ fontSize: fontSize.desktop.a }} style={{ fontSize: fontSize.desktop.a }}
className="laptop-navbar__logout" className="laptop-navbar__logout"
onClick={() => {
localStorage.removeItem("refresh");
localStorage.removeItem("access");
localStorage.removeItem("userData");
this.setState({ navigatePath: "/auth" });
}}
> >
خروج خروج
</div> </div>
@ -90,7 +103,7 @@ export default class LaptopNavbar extends Component {
LaptopNavbar.defaultProps = { LaptopNavbar.defaultProps = {
links: [ links: [
{ name: "صفحه اصلی", to: "/", page: "home" }, { name: "صفحه اصلی", to: "/", page: "home" },
{ name: "سبد خرید ", to: "/cart", page: "cart" }, { name: "فروشگاه", to: "/products", page: "products" },
{ name: "سوالات متداول", to: "/faq", page: "faq" }, { name: "سوالات متداول", to: "/faq", page: "faq" },
{ name: "درباره ما", to: "/about", page: "about" }, { name: "درباره ما", to: "/about", page: "about" },
{ name: "تماس با ما", to: "/contact", page: "contact" }, { name: "تماس با ما", to: "/contact", page: "contact" },

@ -69,8 +69,9 @@
padding: 10px 20px; padding: 10px 20px;
border: 1px solid #6cbe44; border: 1px solid #6cbe44;
color: #6cbe44; color: #6cbe44;
cursor: pointer;
&:hover { &:hover {
color: white; color: #93bb52;
} }
} }
} }

@ -186,11 +186,16 @@ NavbarDrawer.defaultProps = {
}, },
{ {
name: "خروج", name: "خروج",
link: "/", link: "/auth",
icon: <img src={mobileLogout} alt="خروج" />, icon: <img src={mobileLogout} alt="خروج" />,
toast: "", toast: "",
message: "", message: "",
// onClick: this.props.logout, onClick: () => {
localStorage.removeItem("refresh");
localStorage.removeItem("access");
localStorage.removeItem("userData");
window.location.reload();
},
}, },
], ],
}; };

@ -53,18 +53,18 @@ function AddToCart(props) {
<img src={document_red} /> <img src={document_red} />
</button> </button>
<Link <Link
to={`/products/${ // to={`/products/${
page === "digital" // page === "digital"
? `physical/${window.location.pathname.slice( // ? `physical/${window.location.pathname.slice(
window.location.pathname.lastIndexOf("/") + 1, // window.location.pathname.lastIndexOf("/") + 1,
window.location.pathname.length // window.location.pathname.length
)}` // )}`
: `digital/${window.location.pathname.slice( // : `digital/${window.location.pathname.slice(
window.location.pathname.lastIndexOf("/") + 1, // window.location.pathname.lastIndexOf("/") + 1,
window.location.pathname.length // window.location.pathname.length
)}` // )}`
}`} // }`}
style={{ fontSize: fontSize.desktop.button }} style={{ fontSize: fontSize.desktop.button, opacity: 0.3 }}
className="product-addtocart__box--digitalButton" className="product-addtocart__box--digitalButton"
> >
{page === "digital" ? "کتاب فیزیکی" : "نسخه دیجیتال"} {page === "digital" ? "کتاب فیزیکی" : "نسخه دیجیتال"}

@ -160,19 +160,19 @@ class Product extends Component {
<div className="d-flex flex-column mt-3"> <div className="d-flex flex-column mt-3">
<div className="d-flex"> <div className="d-flex">
<Link <Link
to={`/products/${ // to={`/products/${
page === "digital" // page === "digital"
? `physical/${window.location.pathname.slice( // ? `physical/${window.location.pathname.slice(
window.location.pathname.lastIndexOf("/") + 1, // window.location.pathname.lastIndexOf("/") + 1,
window.location.pathname.length // window.location.pathname.length
)}` // )}`
: `digital/${window.location.pathname.slice( // : `digital/${window.location.pathname.slice(
window.location.pathname.lastIndexOf("/") + 1, // window.location.pathname.lastIndexOf("/") + 1,
window.location.pathname.length // window.location.pathname.length
)}` // )}`
}`} // }`}
className="mobile-product__header--digitalButton" className="mobile-product__header--digitalButton"
style={{ fontSize: fontSize.mobile.a }} style={{ fontSize: fontSize.mobile.a, opacity: 0.3 }}
> >
{page === "digital" ? "کتاب فیزیکی" : "نسخه دیجیتال"} {page === "digital" ? "کتاب فیزیکی" : "نسخه دیجیتال"}
</Link> </Link>
@ -319,7 +319,7 @@ export default connect(
Product.defaultProps = { Product.defaultProps = {
supportItems: [ supportItems: [
{ title: "ارسال رایگان", icon: product_shipping }, { title: "ارسال سریع", icon: product_shipping },
{ title: "پشتیبانی 24 ساعته ", icon: product_support }, { title: "پشتیبانی 24 ساعته ", icon: product_support },
{ title: "ضمانت بازگشت ", icon: product_cash_back }, { title: "ضمانت بازگشت ", icon: product_cash_back },
], ],

@ -51,8 +51,8 @@ export default class Product extends Component {
</span> </span>
</Link> </Link>
<Link <Link
to={`/products/digital/${product.id}`} // to={`/products/digital/${product.id}`}
style={{ fontSize: fontSize.mobile.a }} style={{ fontSize: fontSize.mobile.a, opacity: 0.3 }}
className="mobile-products-product__links--ar d-flex justify-content-between align-items-center" className="mobile-products-product__links--ar d-flex justify-content-between align-items-center"
> >
<h2 style={{ fontSize: fontSize.mobile.h2 }}>دیجیتال</h2> <h2 style={{ fontSize: fontSize.mobile.h2 }}>دیجیتال</h2>
@ -84,8 +84,8 @@ export default class Product extends Component {
) : null} */} ) : null} */}
</Link> </Link>
<Link <Link
to={`/products/digital/${product.id}`} // to={`/products/digital/${product.id}`}
style={{ fontSize: fontSize.mobile.a }} style={{ fontSize: fontSize.mobile.a, opacity: 0.3 }}
className="products-product--ar d-flex justify-content-between align-items-center" className="products-product--ar d-flex justify-content-between align-items-center"
> >
<h2 style={{ fontSize: fontSize.desktop.h2 }}>دیجیتال</h2> <h2 style={{ fontSize: fontSize.desktop.h2 }}>دیجیتال</h2>

Loading…
Cancel
Save