update 107 files

temp
amir hosein gorji 2 years ago
parent 06fca1f6e1
commit 7d62a62556
  1. 14
      src/components/Checkbox/index.js
  2. 4
      src/components/Footer/index.js
  3. 1
      src/components/Navbar/index.js
  4. 5
      src/components/ProductImage/index.js
  5. 18
      src/components/StarRating/index.js
  6. 38
      src/redux/proxy.js
  7. 12
      src/views/Dashboard/layouts/Mobile/List.js
  8. 4
      src/views/Dashboard/layouts/Mobile/ProfileBookmark/index.js
  9. 6
      src/views/Home/Desktop/Part2/index.js
  10. 9
      src/views/Home/Desktop/Part4/index.js
  11. 18
      src/views/Products/layouts/Desktop/Main.js
  12. 10
      src/views/ShoppingCart/index.js
  13. 5
      src/views/Video/components/Desktop/Videos.js

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import './index.css'; import "./index.css";
export default function Checkbox(props) { export default function Checkbox(props) {
return ( return (
@ -16,8 +16,16 @@ export default function Checkbox(props) {
</svg> </svg>
<div className="checkbox-container"> <div className="checkbox-container">
<input className="checkbox-input" name={props.name} id={"ch"+props.name} type="checkbox" checked={props.checked} onClick={props.onclick} onChange={props.onChange}/> <input
<label className="checkbox" htmlFor={"ch"+props.name}> className="checkbox-input"
name={props.name}
id={"ch" + props.name}
type="checkbox"
checked={props.checked}
onClick={props.onclick}
onChange={props.onChange}
/>
<label className="checkbox" htmlFor={"ch" + props.name}>
<span> <span>
<svg width="12px" height="10px"> <svg width="12px" height="10px">
<use xlinkHref="#check"></use> <use xlinkHref="#check"></use>

@ -59,7 +59,7 @@ const FooterDesign1 = ({ color, bg, items, hasHeader }) => {
<strong className="text-xl text-gray70">{item.name}</strong> <strong className="text-xl text-gray70">{item.name}</strong>
<ul className="flex flex-col mt-0"> <ul className="flex flex-col mt-0">
{item.links.map((link, index) => ( {item.links.map((link, index) => (
<li className="mt-6"> <li className="mt-6" key={index}>
<Link <Link
className="text-gray70 text-base" className="text-gray70 text-base"
to={link.link} to={link.link}
@ -174,5 +174,5 @@ FooterDesign1.defaultProps = {
], ],
bg: "bg-white", bg: "bg-white",
color: "text-gray-600", color: "text-gray-600",
hasHeader : true hasHeader: true,
}; };

@ -62,6 +62,7 @@ function Navbar({
useEffect(() => { useEffect(() => {
if (!isMobile && isLogin) { if (!isMobile && isLogin) {
console.log(111)
getCartProducts(); getCartProducts();
} }
}, [isLogin]); }, [isLogin]);

@ -20,7 +20,10 @@ const ProductImage = ({ images }) => {
> >
{list?.slice(0, 4)?.map((image, index) => ( {list?.slice(0, 4)?.map((image, index) => (
<div <div
className={`relative flex justify-center items-center ${ activeImage === image ? 'bg-green-200' : 'bg-gray-200'}`} key={index}
className={`relative flex justify-center items-center ${
activeImage === image ? "bg-green-200" : "bg-gray-200"
}`}
style={{ style={{
width: "calc(100vw / 5 / 4 - 4px)", width: "calc(100vw / 5 / 4 - 4px)",
height: "calc(100vw / 5 / 4 - 4px)", height: "calc(100vw / 5 / 4 - 4px)",

@ -1,4 +1,4 @@
import React from "react"; import React, { useMemo } from "react";
import StarRatingComponent from "react-star-rating-component"; import StarRatingComponent from "react-star-rating-component";
import { userVote, userProduct } from "../../redux/actions"; import { userVote, userProduct } from "../../redux/actions";
import { connect } from "react-redux"; import { connect } from "react-redux";
@ -8,11 +8,18 @@ import location from "../../utils/location";
import starGrayIcon from "../../assets/icons/starGray.svg"; import starGrayIcon from "../../assets/icons/starGray.svg";
import starYellowIcon from "../../assets/icons/starYellow.svg"; import starYellowIcon from "../../assets/icons/starYellow.svg";
function StarRating({ value, size, addVote, userProducts, getUserProducts }) { function StarRating({
value,
size,
addVote,
userProducts,
getUserProducts,
isLogin,
}) {
const [rate, setRating] = React.useState(null); const [rate, setRating] = React.useState(null);
React.useEffect(() => { useMemo(() => {
getUserProducts(); if (isLogin) getUserProducts();
}, []); }, []);
React.useEffect(() => { React.useEffect(() => {
@ -55,11 +62,12 @@ function StarRating({ value, size, addVote, userProducts, getUserProducts }) {
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
userProducts: state.userProduct.list, userProducts: state.userProduct.list,
isLogin: state.user.status,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {
addVote: userVote.add, addVote: userVote.add,
getUserProducts: userProduct.list, getUserProducts: userProduct.list || [],
}; };
export default connect(mapStateToProps, mapDispatchToProps)(StarRating); export default connect(mapStateToProps, mapDispatchToProps)(StarRating);

@ -19,21 +19,21 @@ class Proxy {
async () => await Axios.get(url, { params, ...opt }), async () => await Axios.get(url, { params, ...opt }),
data || params data || params
); );
post = async (url, params, opt, data ) => post = async (url, params, opt, data) =>
await this.check( await this.check(
url, url,
opt, opt,
async () => await Axios.post(url, params, opt), async () => await Axios.post(url, params, opt),
data || params data || params
); );
put = async (url , params , opt , data ) => put = async (url, params, opt, data) =>
await this.check( await this.check(
url, url,
opt, opt,
async () => await Axios.put(url, params, opt), async () => await Axios.put(url, params, opt),
data || params data || params
); );
delete = async (url , params , opt , data ) => { delete = async (url, params, opt, data) => {
await this.check( await this.check(
url, url,
opt, opt,
@ -42,7 +42,7 @@ class Proxy {
); );
}; };
check = async (url , { dispatch } , fetch , params ) => { check = async (url, { dispatch }, fetch, params) => {
dispatch = dispatch || (() => {}); dispatch = dispatch || (() => {});
dispatch({ type: url.split("/")[0] + "/" + "loading" }); dispatch({ type: url.split("/")[0] + "/" + "loading" });
let response = await fetch(); let response = await fetch();
@ -51,7 +51,8 @@ class Proxy {
dispatch({ type: url, data: response.data.data, params }); dispatch({ type: url, data: response.data.data, params });
return response.data.data; return response.data.data;
case 401: case 401:
if (await this.refresh()) { let refresh = localStorage.getItem("refresh");
if (refresh && (await this.refresh(refresh))) {
let response = await fetch(); let response = await fetch();
dispatch({ type: url, data: response.data.data, params }); dispatch({ type: url, data: response.data.data, params });
return response.data.data; return response.data.data;
@ -69,17 +70,20 @@ class Proxy {
refresh = async () => { refresh = async () => {
let refresh = localStorage.getItem("refresh"); let refresh = localStorage.getItem("refresh");
if (!refresh) window.location.href = "/";
let login = await this.login( if (!refresh) return false;
"user/login", //window.location.href = "/";
{}, // let login = await this.login(
{ headers: { Authorization: `Bearer ${refresh}` } } // "user/login",
); // {},
return login ? true : false; // { headers: { Authorization: `Bearer ${refresh}` } }
// );
// return login ? true : false;
return false;
}; };
login = async (url , params , { dispatch } ) => login = async (url, params, { dispatch }) =>
this.post(url, params, { this.post(url, params, {
dispatch: (obj ) => { dispatch: (obj) => {
let login = obj.data; let login = obj.data;
if (!login || !login.refreshToken) return false; if (!login || !login.refreshToken) return false;
localStorage.setItem("refresh", login.refreshToken); localStorage.setItem("refresh", login.refreshToken);
@ -91,9 +95,9 @@ class Proxy {
}, },
}); });
logout = async (url , params , { dispatch } ) => { logout = async (url, params, { dispatch }) => {
this.post(url, params, { this.post(url, params, {
dispatch: (obj ) => { dispatch: (obj) => {
localStorage.removeItem("refresh"); localStorage.removeItem("refresh");
localStorage.removeItem("access"); localStorage.removeItem("access");
localStorage.removeItem("userData"); localStorage.removeItem("userData");
@ -112,7 +116,7 @@ class Proxy {
return false; return false;
} }
return JSON.parse(userData || ''); return JSON.parse(userData || "");
}; };
} }
const _proxy = new Proxy(); const _proxy = new Proxy();

@ -4,12 +4,12 @@ import { Link } from "react-router-dom";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
//assets //assets
import userGreenIcon from '../../../../assets/icons/user-green.svg'; import userGreenIcon from "../../../../assets/icons/user-green.svg";
import videoGreenIcon from '../../../../assets/icons/video-green.svg'; import videoGreenIcon from "../../../../assets/icons/video-green.svg";
import cartGreenIcon from '../../../../assets/icons/cart-green.svg'; import cartGreenIcon from "../../../../assets/icons/cart-green.svg";
import bookmarkGreenIcon from '../../../../assets/icons/bookmark-green.svg'; import bookmarkGreenIcon from "../../../../assets/icons/bookmark-green.svg";
import bookGreenIcon from '../../../../assets/icons/book-green.svg'; import bookGreenIcon from "../../../../assets/icons/book-green.svg";
import addressGreenIcon from '../../../../assets/icons/address-green.svg'; import addressGreenIcon from "../../../../assets/icons/address-green.svg";
const List = ({ mobile }) => { const List = ({ mobile }) => {
const pages = [ const pages = [

@ -83,7 +83,9 @@ const Bookmark = ({ bookmark }) => {
return ( return (
<Pressable <Pressable
style={[ style={[
tw("flex flex-row-reverse rounded-md justify-between px-3.5 py-2 bg-red-100"), tw(
"flex flex-row-reverse rounded-md justify-between px-3.5 py-2 bg-red-100"
),
{ {
borderWidth: 1.5, borderWidth: 1.5,
borderColor: Colors.theme1[colorScheme].greenCF, borderColor: Colors.theme1[colorScheme].greenCF,

@ -42,9 +42,9 @@ const Part2 = ({ books }) => {
transform="translate(4.08 8.95)" transform="translate(4.08 8.95)"
fill="none" fill="none"
stroke="#55A630" stroke="#55A630"
stroke-linecap="round" strokeLinecap="round"
stroke-linejoin="round" strokeLinejoin="round"
stroke-width="2.5" strokeWidth="2.5"
/> />
<path <path
id="Vector-2" id="Vector-2"

@ -34,9 +34,9 @@ const Part4 = ({ books, grades }) => {
transform="translate(4.08 8.95)" transform="translate(4.08 8.95)"
fill="none" fill="none"
stroke="#55A630" stroke="#55A630"
stroke-linecap="round" strokeLinecap="round"
stroke-linejoin="round" strokeLinejoin="round"
stroke-width="2.5" strokeWidth="2.5"
/> />
<path <path
id="Vector-2" id="Vector-2"
@ -57,8 +57,9 @@ const Part4 = ({ books, grades }) => {
style={{}} style={{}}
> >
<ul className="flex flex-wrap justify-center "> <ul className="flex flex-wrap justify-center ">
{books?.slice(0,6)?.map((video, index) => ( {books?.slice(0, 6)?.map((video, index) => (
<li <li
key={index}
className={`flex flex-col border-solid border-gray-200 ${ className={`flex flex-col border-solid border-gray-200 ${
index != 3 && index != 4 && index != 5 ? "border-b" : null index != 3 && index != 4 && index != 5 ? "border-b" : null
} video ${index != 0 && index != 3 ? "border-r" : null}`} } video ${index != 0 && index != 3 ? "border-r" : null}`}

@ -146,9 +146,9 @@ export const Main = ({
transform="translate(632.13 710)" transform="translate(632.13 710)"
fill="none" fill="none"
stroke="rgba(6, 186, 206" stroke="rgba(6, 186, 206"
stroke-linecap="round" strokeLinecap="round"
stroke-linejoin="round" strokeLinejoin="round"
stroke-width="1.5" strokeWidth="1.5"
/> />
<path <path
id="Vector-2" id="Vector-2"
@ -157,9 +157,9 @@ export const Main = ({
transform="translate(635.03 713.58)" transform="translate(635.03 713.58)"
fill="none" fill="none"
stroke="rgba(6, 186, 206" stroke="rgba(6, 186, 206"
stroke-linecap="round" strokeLinecap="round"
stroke-linejoin="round" strokeLinejoin="round"
stroke-width="1.5" strokeWidth="1.5"
/> />
<path <path
id="Vector-3" id="Vector-3"
@ -177,9 +177,9 @@ export const Main = ({
transform="translate(623.31 702)" transform="translate(623.31 702)"
fill="none" fill="none"
stroke="rgba(6, 186, 206" stroke="rgba(6, 186, 206"
stroke-linecap="round" strokeLinecap="round"
stroke-linejoin="round" strokeLinejoin="round"
stroke-width="1.5" strokeWidth="1.5"
/> />
</g> </g>
</g> </g>

@ -36,11 +36,12 @@ function ShoppingCart({
payFactor, payFactor,
loading, loading,
setDialog, setDialog,
isLogin,
}) { }) {
const [phase, setPhase] = useState("products"); const [phase, setPhase] = useState("products");
const navigation = useNavigate(); const navigation = useNavigate();
useEffect(() => { useEffect(() => {
getList(); if (isLogin) getList();
getFactorInfo({ userId: user?.id }); getFactorInfo({ userId: user?.id });
setHeaderOptions(headerOptions); setHeaderOptions(headerOptions);
}, []); }, []);
@ -216,7 +217,9 @@ function ShoppingCart({
جمع کل سبد خرید جمع کل سبد خرید
</strong> </strong>
<p className="font-medium text-greenBA text-lg dark:text-white"> <p className="font-medium text-greenBA text-lg dark:text-white">
{separate(productsLength ? factorInfo?.payPrice : 0) + " " + "تومان"} {separate(productsLength ? factorInfo?.payPrice : 0) +
" " +
"تومان"}
</p> </p>
</div> </div>
<div <div
@ -256,7 +259,7 @@ function ShoppingCart({
<Empty <Empty
text="سبد خرید شما خالی است." text="سبد خرید شما خالی است."
buttonText="فروشگاه" buttonText="فروشگاه"
buttonAction={() => navigation('/products')} buttonAction={() => navigation("/products")}
/> />
)} )}
</div> </div>
@ -387,6 +390,7 @@ const mapStateToProps = (state) => ({
desktopContentTransform: state.publicApi.desktopContentTransform, desktopContentTransform: state.publicApi.desktopContentTransform,
userProducts: state.userProduct.list, userProducts: state.userProduct.list,
loading: state.userProduct.loading, loading: state.userProduct.loading,
isLogin: state.user.status,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {

@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react";
import "../../../../components/ProductImage/index.scss"; import "../../../../components/ProductImage/index.scss";
import productImg from "../../../../components/ProductImage/product-image.jpg"; // import productImg from "../../../../components/ProductImage/product-image.jpg";
const Videos = ({ videos }) => { const Videos = ({ videos }) => {
const [list, setList] = useState([]); const [list, setList] = useState([]);
@ -20,8 +20,7 @@ const Videos = ({ videos }) => {
<div <div
className="flex flex-row w-full bg-gray-300" className="flex flex-row w-full bg-gray-300"
style={{ height: "calc(100vh / 1.5)" }} style={{ height: "calc(100vh / 1.5)" }}
> ></div>
</div>
); );
}; };

Loading…
Cancel
Save