update 107 files

temp
amir hosein gorji 2 years ago
parent 06fca1f6e1
commit 7d62a62556
  1. 16
      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 './index.css';
import "./index.css";
export default function Checkbox(props) {
return (
@ -16,8 +16,16 @@ export default function Checkbox(props) {
</svg>
<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}/>
<label className="checkbox" htmlFor={"ch"+props.name}>
<input
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>
<svg width="12px" height="10px">
<use xlinkHref="#check"></use>
@ -27,4 +35,4 @@ export default function Checkbox(props) {
</div>
</div>
);
}
}

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

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

@ -20,7 +20,10 @@ const ProductImage = ({ images }) => {
>
{list?.slice(0, 4)?.map((image, index) => (
<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={{
width: "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 { userVote, userProduct } from "../../redux/actions";
import { connect } from "react-redux";
@ -8,11 +8,18 @@ import location from "../../utils/location";
import starGrayIcon from "../../assets/icons/starGray.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);
React.useEffect(() => {
getUserProducts();
useMemo(() => {
if (isLogin) getUserProducts();
}, []);
React.useEffect(() => {
@ -55,11 +62,12 @@ function StarRating({ value, size, addVote, userProducts, getUserProducts }) {
const mapStateToProps = (state) => ({
userProducts: state.userProduct.list,
isLogin: state.user.status,
});
const mapDispatchToProps = {
addVote: userVote.add,
getUserProducts: userProduct.list,
getUserProducts: userProduct.list || [],
};
export default connect(mapStateToProps, mapDispatchToProps)(StarRating);

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

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

@ -83,7 +83,9 @@ const Bookmark = ({ bookmark }) => {
return (
<Pressable
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,
borderColor: Colors.theme1[colorScheme].greenCF,

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

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

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

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

@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react";
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 [list, setList] = useState([]);
@ -20,8 +20,7 @@ const Videos = ({ videos }) => {
<div
className="flex flex-row w-full bg-gray-300"
style={{ height: "calc(100vh / 1.5)" }}
>
</div>
></div>
);
};

Loading…
Cancel
Save