Compare commits
No commits in common. "d5ad2a68ff78201e88b0909d3a44c8159f41cba8" and "2421bce5f7552c8bbb5c62e74f0f5ff65bba5b3e" have entirely different histories.
d5ad2a68ff
...
2421bce5f7
Binary file not shown.
|
Before Width: | Height: | Size: 22 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.5 KiB |
|
|
@ -19,12 +19,12 @@ const App = () => {
|
||||||
|
|
||||||
}
|
}
|
||||||
}, [data]);
|
}, [data]);
|
||||||
const randomtoken = Math.random()
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fn_firebase = (async () => {
|
const fn_firebase = (async () => {
|
||||||
// const token = await requestPermission()
|
const token = await requestPermission()
|
||||||
if (!Guest) {
|
if (!Guest) {
|
||||||
mutate({ fcm_token: randomtoken });
|
mutate({ fcm_token: token });
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
fn_firebase()
|
fn_firebase()
|
||||||
|
|
|
||||||
|
|
@ -19,18 +19,14 @@ const CartWithDrawer = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { Cart, calculateTotalPrice, calculateTotalQuantity, removeCart } =
|
const { Cart, calculateTotalPrice, calculateTotalQuantity, removeCart } =
|
||||||
useCartState();
|
useCartState();
|
||||||
const { user ,isAuthenticated} = useAuthState();
|
const { user } = useAuthState();
|
||||||
const { mutate, isLoading, isSuccess } = useAddOrder();
|
const { mutate, isLoading, isSuccess } = useAddOrder();
|
||||||
const products = Cart?.map((item: any) => ({
|
const products = Cart?.map((item: any) => ({
|
||||||
quantity: item?.quantity,
|
quantity: item?.quantity,
|
||||||
id: item?.id,
|
id: item?.id,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const addOrder = () => {
|
const addOrder = () => {
|
||||||
if (!isAuthenticated) {
|
|
||||||
toast.error("sorry you need to be authenticated");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mutate({
|
mutate({
|
||||||
email: user?.email,
|
email: user?.email,
|
||||||
products: products,
|
products: products,
|
||||||
|
|
@ -65,7 +61,7 @@ const CartWithDrawer = () => {
|
||||||
open={open}
|
open={open}
|
||||||
key={placement}
|
key={placement}
|
||||||
width={550}
|
width={550}
|
||||||
style={{maxHeight:"60%", minHeight:"500px"}}
|
style={{maxHeight:"90%"}}
|
||||||
>
|
>
|
||||||
<div className="cart_first_section">
|
<div className="cart_first_section">
|
||||||
<span>{t("Cart")}</span>
|
<span>{t("Cart")}</span>
|
||||||
|
|
@ -80,7 +76,6 @@ const CartWithDrawer = () => {
|
||||||
<CardItem key={index} data={item} />
|
<CardItem key={index} data={item} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{Cart?.length > 0 ? (
|
{Cart?.length > 0 ? (
|
||||||
<div className="ViewCart_Button">
|
<div className="ViewCart_Button">
|
||||||
|
|
@ -102,10 +97,7 @@ const CartWithDrawer = () => {
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="EmptyCard">
|
<div></div>
|
||||||
<img src="/Cart/empty_card.gif" alt="" />
|
|
||||||
<p>{t('You have not placed any orders yet')}</p>
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Drawer>
|
</Drawer>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import ProductSwiper from "./ProductSwiper";
|
import ProductSwiper from "./ProductSwiper";
|
||||||
import { useGetBaseProduct } from "../../api/baseProduct";
|
|
||||||
|
|
||||||
const Products = () => {
|
const Products = () => {
|
||||||
const {t} = useTranslation();
|
const {t} = useTranslation();
|
||||||
|
|
@ -10,10 +9,6 @@ const Products = () => {
|
||||||
const handelSeeAll = () => {
|
const handelSeeAll = () => {
|
||||||
navigate(`/categories?type=best_sale`);
|
navigate(`/categories?type=best_sale`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data,isLoading } = useGetBaseProduct({
|
|
||||||
mostOrderd: "asc",
|
|
||||||
})
|
|
||||||
return (
|
return (
|
||||||
<div className="Products">
|
<div className="Products">
|
||||||
<header>
|
<header>
|
||||||
|
|
@ -21,7 +16,7 @@ const Products = () => {
|
||||||
<h5 className="pointer" onClick={handelSeeAll}> {t("View all")} </h5>
|
<h5 className="pointer" onClick={handelSeeAll}> {t("View all")} </h5>
|
||||||
</header>
|
</header>
|
||||||
<main className="ProductCards">
|
<main className="ProductCards">
|
||||||
<ProductSwiper data={data} isLoading={isLoading} />
|
<ProductSwiper/>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,10 @@ const ProductCard = ({ item }: { item: Product }) => {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
const handelChangeFavorite = (item: Product) => {
|
const handelChangeFavorite = (item: Product) => {
|
||||||
// if (!isAuthenticated) {
|
if (!isAuthenticated) {
|
||||||
// toast.error("sorry you need to be authenticated");
|
toast.error("sorry you need to be authenticated");
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (item?.favorite) {
|
if (item?.favorite) {
|
||||||
|
|
||||||
|
|
@ -55,8 +55,6 @@ const ProductCard = ({ item }: { item: Product }) => {
|
||||||
id: item?.id,
|
id: item?.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
queryClient.invalidateQueries('mainProduct');
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -73,11 +71,11 @@ const ProductCard = ({ item }: { item: Product }) => {
|
||||||
}, [Delete]);
|
}, [Delete]);
|
||||||
|
|
||||||
const handelAddToCart = (item: Product) => {
|
const handelAddToCart = (item: Product) => {
|
||||||
// if (!isAuthenticated) {
|
if (!isAuthenticated) {
|
||||||
|
|
||||||
// toast.error("sorry you need to be authenticated");
|
toast.error("sorry you need to be authenticated");
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
setCart(item);
|
setCart(item);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,16 @@ import { Spin } from 'antd';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const ProductSwiper = ({data,isLoading}:any) => {
|
const ProductSwiper = () => {
|
||||||
const language = localStorage.getItem('language') ;
|
const language = localStorage.getItem('language') ;
|
||||||
console.log(language);
|
console.log(language);
|
||||||
|
|
||||||
const [swiperDirection, setSwiperDirection] = useState(language === "ar" ? "rtl" : "ltr");
|
const [swiperDirection, setSwiperDirection] = useState(language === "ar" ? "rtl" : "ltr");
|
||||||
const swiperRef = useRef<any>(null);
|
const swiperRef = useRef<any>(null);
|
||||||
|
|
||||||
|
const { data, isLoading } = useGetBaseProduct({
|
||||||
|
mostOrderd: "asc",
|
||||||
|
});
|
||||||
const BaseProducts = (data?.products as Product[]) || ([] as []);
|
const BaseProducts = (data?.products as Product[]) || ([] as []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import ProductSwiper from "./ProductSwiper";
|
import ProductSwiper from "./ProductSwiper";
|
||||||
import { useGetBaseProduct } from "../../api/baseProduct";
|
|
||||||
|
|
||||||
const Products = () => {
|
const Products = () => {
|
||||||
const {t} = useTranslation();
|
const {t} = useTranslation();
|
||||||
|
|
@ -11,11 +10,6 @@ const Products = () => {
|
||||||
navigate(`/categories?type=new_product`);
|
navigate(`/categories?type=new_product`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const { data,isLoading } = useGetBaseProduct({
|
|
||||||
lastProducts:"asc"
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="Products">
|
<div className="Products">
|
||||||
<header>
|
<header>
|
||||||
|
|
@ -23,7 +17,7 @@ const Products = () => {
|
||||||
<h5 className="pointer" onClick={handelSeeAll}> {t("View all")} </h5>
|
<h5 className="pointer" onClick={handelSeeAll}> {t("View all")} </h5>
|
||||||
</header>
|
</header>
|
||||||
<main className="ProductCards">
|
<main className="ProductCards">
|
||||||
<ProductSwiper data={data} isLoading={isLoading} />
|
<ProductSwiper/>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
import React from 'react'
|
|
||||||
import { useTranslation } from 'react-i18next'
|
|
||||||
|
|
||||||
const Empty = () => {
|
|
||||||
const [t] = useTranslation()
|
|
||||||
return (
|
|
||||||
<div className='Empty'>
|
|
||||||
<img src="/icon/notfound_search.png" alt="" />
|
|
||||||
<h1>{t("There are no suitable products")}</h1>
|
|
||||||
<p>
|
|
||||||
{t("Please try using other keywords to find the product name")}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Empty
|
|
||||||
|
|
@ -104,9 +104,4 @@
|
||||||
border-radius: 5px 0 0 5px;
|
border-radius: 5px 0 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.search_comp{
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
}
|
||||||
|
|
@ -18,7 +18,6 @@ const LoginForm = ({ setOpen }: any) => {
|
||||||
const { mutate, isLoading, isSuccess, data } = useLogin();
|
const { mutate, isLoading, isSuccess, data } = useLogin();
|
||||||
const { login } = useAuthState();
|
const { login } = useAuthState();
|
||||||
const FCM = localStorage.getItem(FCM_TOKEN_KEY)
|
const FCM = localStorage.getItem(FCM_TOKEN_KEY)
|
||||||
const random_token = Math.random()
|
|
||||||
|
|
||||||
const handelSubmit = (values: any) => {
|
const handelSubmit = (values: any) => {
|
||||||
if (!values.email || !values.password) {
|
if (!values.email || !values.password) {
|
||||||
|
|
@ -26,7 +25,7 @@ const LoginForm = ({ setOpen }: any) => {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mutate({ ...values, fcm_token: random_token });
|
mutate({ ...values, fcm_token: FCM });
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ const Page = () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
<Similar category_id={product?.category?.id} />
|
<Similar/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
import { useGetBaseProduct } from "../../api/baseProduct";
|
import { useGetBaseProduct } from "../../api/baseProduct";
|
||||||
import ProductSwiper from "../../Components/Home/ProductSwiper";
|
import ProductSwiper from "../../Components/Home/ProductSwiper";
|
||||||
|
|
||||||
const Similar = ({category_id}:any) => {
|
const Similar = () => {
|
||||||
const { data,isLoading } = useGetBaseProduct({
|
const { data } = useGetBaseProduct();
|
||||||
category_id:category_id
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="Products">
|
<div className="Products">
|
||||||
|
|
@ -12,7 +10,7 @@ const Similar = ({category_id}:any) => {
|
||||||
<h1>Similar Products</h1>
|
<h1>Similar Products</h1>
|
||||||
</header>
|
</header>
|
||||||
<main className="ProductCards">
|
<main className="ProductCards">
|
||||||
<ProductSwiper data={data} isLoading={isLoading} />
|
<ProductSwiper/>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
.active{
|
.active{
|
||||||
|
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
border-bottom: .1vw solid var(--primary);
|
// border-bottom: .1vw solid var(--primary);
|
||||||
color: var(--primary);
|
color: var(--primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,19 +113,4 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.EmptyCard{
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
margin-top: 5%;
|
|
||||||
gap: 20px;
|
|
||||||
img{
|
|
||||||
width: 40%;
|
|
||||||
}
|
|
||||||
p{
|
|
||||||
font-size: max(1.5vw,15px);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user