diff --git a/.env.production b/.env.production index c46feb0..e05e401 100644 --- a/.env.production +++ b/.env.production @@ -6,4 +6,4 @@ NEXT_PUBLIC_PUBLIC_URL=https://api.vesmeh.com NEXT_PUBLIC_API_URL=https://api.vesmeh.com/api NEXT_PUBLIC_STORAGE_URL=http://storage.vesmeh.com STORAGE_URL=http://storage.vesmeh.com -NEXT_PUBLIC_PACKAGE_VERSION=0.2.9 \ No newline at end of file +NEXT_PUBLIC_PACKAGE_VERSION=0.3.0 \ No newline at end of file diff --git a/components/AppsComponent/CheckoutData/page.jsx b/components/AppsComponent/CheckoutData/page.jsx index 0bdcef2..f559f99 100644 --- a/components/AppsComponent/CheckoutData/page.jsx +++ b/components/AppsComponent/CheckoutData/page.jsx @@ -111,9 +111,7 @@ const CheckoutData = () => { GetShippingData(); } - if (CTX.state.addressData <= 0) { - CTX.fetchAddressUser(); - } + CTX.fetchAddressUser(); }, [checkOutData]); useEffect(() => { diff --git a/components/LandingPage/BetweenSexualSection/page.jsx b/components/LandingPage/BetweenSexualSection/page.jsx index 6d49c6e..513ea53 100644 --- a/components/LandingPage/BetweenSexualSection/page.jsx +++ b/components/LandingPage/BetweenSexualSection/page.jsx @@ -53,7 +53,7 @@ const BetweenSexualSection = () => {

- بهداشت مصرفی و روزانه بانوان + بهداشت روزانه بانوان

@@ -79,7 +79,7 @@ const BetweenSexualSection = () => {

- بهداشت مصرفی و روزانه آقایان + بهداشت روزانه آقایان

diff --git a/components/Navbar/CartNavbar/page.jsx b/components/Navbar/CartNavbar/page.jsx index 534ae15..776b625 100644 --- a/components/Navbar/CartNavbar/page.jsx +++ b/components/Navbar/CartNavbar/page.jsx @@ -5,25 +5,43 @@ import Link from "next/link"; import PersianNumber from "plugins/PersianNumber"; import { useContext, useState } from "react"; -const CartNavbar = (props) => { +const CartNavbar = ({ isScrolled }) => { const CTX = useContext(AppContext); const cart = CTX.state.cart; const [smallBasket, setSmallBasket] = useState(false); return ( -

+
setSmallBasket(true)} - onClick={() => setSmallBasket(false)} + className={`bg-secondary-600 rounded-xl text-sm flex cursor-pointer px-5 ${ + isScrolled ? "p-1" : "py-2" + } `} + onClick={() => setSmallBasket(!smallBasket)} >

سبد خرید

-
-
- {" "} +
+
+ {" "}
@@ -33,8 +51,6 @@ const CartNavbar = (props) => { className={`relative !z-[100] tr03 ${ smallBasket ? "opacity-100" : "opacity-0" } `} - onMouseEnter={() => setSmallBasket(true)} - onMouseLeave={() => setSmallBasket(false)} >
diff --git a/components/Navbar/page.jsx b/components/Navbar/page.jsx index 70b03fc..89494e1 100644 --- a/components/Navbar/page.jsx +++ b/components/Navbar/page.jsx @@ -82,7 +82,7 @@ const Navbar = ({ theme }) => {
-
+
{profile?.length <= 0 ? (
@@ -168,7 +168,7 @@ const Navbar = ({ theme }) => {
)} - +
@@ -194,7 +194,7 @@ const Navbar = ({ theme }) => {
{dataNav?.map((e, index) => (

{ ))}

-
{ const element = document.getElementById("offer"); if (element) { @@ -222,10 +222,10 @@ const Navbar = ({ theme }) => { } }} > -
+

بمب امروز

-
+
*/}
{
-
-
+
+
{`${dataNav[navItemHover]?.name}
@@ -474,10 +474,10 @@ const Navbar = ({ theme }) => {
CTX.setBottomSheetCartOpen(true)} > -
+ {/*
{cart?.length > 0 && (
{ stroke-linecap="round" stroke-linejoin="round" /> - + */} + +
+ {cart?.length > 0 && ( +
+ +
+ )} +
+
CTX.setBottomSheetCartOpen(true)} + > +

سبد خرید

+
diff --git a/plugins/bottomSheet/BottomSheetDiscount.jsx b/plugins/bottomSheet/BottomSheetDiscount.jsx index 305d333..5f0419d 100644 --- a/plugins/bottomSheet/BottomSheetDiscount.jsx +++ b/plugins/bottomSheet/BottomSheetDiscount.jsx @@ -7,26 +7,34 @@ import { BottomSheet } from "react-spring-bottom-sheet"; import { toast } from "react-toastify"; const BottomSheetDiscount = ({ orderId }) => { + // const [item, setItem] = useState(); const CTX = useContext(AppContext); const [discountCode, setDiscountCode] = useState(null); const body = { orderId, discountCode }; + // Function to handle discount operation asynchronously const handleDiscount = async () => { + // Retrieve token from localStorage asynchronously + const token = localStorage.getItem("token"); try { + // Send a POST request to the API endpoint to apply discount const data = await Chapar.post( `${process.env.NEXT_PUBLIC_API_URL}/order/bag/discount/${orderId}?discountCode=${discountCode}`, - { + // Include the token in the Authorization header headers: { - Authorization: localStorage.getItem("token"), + Authorization: token, }, } ); + // Update the checkout data with the response CTX.setCheckOutData(data); + // Close the bottom sheet for discount CTX.setBottomSheetDiscountOpen(false); } catch ({ error, status }) { + // If there's an error, display an error message using toast toast.error(`${error?.response?.data?.message}`, { position: "bottom-right", closeOnClick: true, diff --git a/public/images/between1.png b/public/images/between1.png index 7cc2644..a56a048 100644 Binary files a/public/images/between1.png and b/public/images/between1.png differ diff --git a/public/images/between2.png b/public/images/between2.png index 8cf0c86..b4842ba 100644 Binary files a/public/images/between2.png and b/public/images/between2.png differ