-
+
{e.name}
@@ -275,7 +277,7 @@ const Navbar = ({ theme }) => {
{e.children.map((child, index) => (
{
- const handleStyle = {
+ const handleStyleMin = {
borderColor: "#2189A8",
height: 25,
width: 25,
- marginLeft: 0,
marginTop: -9,
backgroundColor: "white",
+ // left: 0,
};
const trackStyle = [{ backgroundColor: "#2189A8", height: 8 }];
@@ -20,9 +20,9 @@ const RangeSlider = ({ min, max, onChange }) => {
min={min}
max={max}
allowCross={false}
- defaultValue={[min, max]}
+ // defaultValue={[min, max]}
onChange={onChange}
- handleStyle={[handleStyle, handleStyle]}
+ handleStyle={[handleStyleMin, handleStyleMin]}
trackStyle={trackStyle}
railStyle={railStyle}
/>
diff --git a/src/app/about-us/page.jsx b/src/app/about-us/page.jsx
index 831a473..985eafb 100644
--- a/src/app/about-us/page.jsx
+++ b/src/app/about-us/page.jsx
@@ -1,6 +1,10 @@
import Footer from "@comp/Footer/page";
import Navbar from "@comp/Navbar/page";
+export const metadata = {
+ title: "درباره ما ",
+};
+
const Page = () => {
const number = "02188195164";
return (
diff --git a/src/app/cart/checkout/page.jsx b/src/app/cart/checkout/page.jsx
index 6e4497a..964cd33 100644
--- a/src/app/cart/checkout/page.jsx
+++ b/src/app/cart/checkout/page.jsx
@@ -1,481 +1,14 @@
-"use client";
-import NavBarDownCart from "@comp/Carts/component/NavBarDownCart/page";
-import Navbar from "@comp/Navbar/page";
-import PersianNumber from "plugins/PersianNumber";
-import { useContext, useEffect, useState } from "react";
+import CheckoutData from "@comp/AppsComponent/CheckoutData/page";
+import React from "react";
-import AppContext from "@ctx/AppContext";
-import ap from "@img/ap.png";
-import zarin from "@img/zarin.png";
-import Image from "next/image";
-import { useRouter } from "next/navigation";
-import Chapar from "plugins/Chapar";
-import BottomSheetDiscount from "plugins/bottomSheet/BottomSheetDiscount";
-import { toast } from "react-toastify";
+export const metadata = {
+ title: "اعتبار سنجی خرید",
+};
const Page = () => {
- const CTX = useContext(AppContext);
- const [shippingData, setShippingData] = useState([]);
- const [shippingId, setShippingID] = useState(null);
- const [addressData, setAddressData] = useState([]);
- const [addressId, setAddressId] = useState(null);
- const [permissionGoPay, setPermissionGoPay] = useState(false);
-
- const router = useRouter();
- const checkOutData = CTX.state.checkOutData;
-
- const body = {
- addressId: addressData[addressId]?.id,
-
- orderId: checkOutData?.id,
- shippingId: shippingData[shippingId]?.id,
- };
-
- console.log(body);
-
- const GetShippingData = async () => {
- try {
- const data = await Chapar.get(
- `${process.env.NEXT_PUBLIC_API_URL}/warehouse/shipping?page=0`
- );
-
- setShippingData(data);
- } catch ({ error, status }) {
- toast.error(`${error?.response?.data?.message}`, {
- position: "bottom-right",
- closeOnClick: true,
- });
- }
- };
-
- const handleShippingID = async (index) => {
- if (addressId !== null) {
- setShippingID(index);
- try {
- const data = await Chapar.post(
- `${process.env.NEXT_PUBLIC_API_URL}/order/bag/shipping/${checkOutData?.id}`,
- JSON.stringify({
- addressId: addressData[addressId]?.id,
-
- orderId: checkOutData?.id,
- shippingId: shippingData[index]?.id,
- }),
- {
- headers: {
- Authorization: localStorage.getItem("token"),
- },
- }
- );
- CTX.setCheckOutData(data);
- setPermissionGoPay(true);
- console.log(data);
- } catch ({ error, status }) {
- toast.error(`${error?.response?.data?.message}`, {
- position: "bottom-right",
- closeOnClick: true,
- });
- }
- } else {
- toast.error(`ابتدا آدرس را انتحاب کنید`, {
- position: "bottom-right",
- closeOnClick: true,
- });
- }
- };
-
- const handleGoPayment = async () => {
- try {
- const data = await Chapar.post(
- `${process.env.NEXT_PUBLIC_API_URL}/order/bag/payment/${checkOutData?.id}?paymentMethod=1`,
-
- {
- headers: {
- Authorization: localStorage.getItem("token"),
- },
- }
- );
-
- router.push(data?.paymentUrl);
- } catch ({ error, status }) {
- toast.error(`${error?.response?.data?.message}`, {
- position: "bottom-right",
- closeOnClick: true,
- });
- }
- };
-
- useEffect(() => {
- if (shippingData.length <= 0) {
- GetShippingData();
- }
-
- if (CTX.state.addressData <= 0) {
- CTX.fetchAddressUser();
- }
- }, [checkOutData]);
-
- useEffect(() => {
- setAddressData(CTX.state.addressData);
- }, [CTX.state.addressData]);
-
- useEffect(() => {
- if (CTX.state.checkOutData.length <= 0) {
- router.push("/cart");
- }
-
- setPermissionGoPay(false);
- }, []);
-
return (
<>
-
-
-
-
-
-
آدس ها
-
-
CTX.setBottomSheetAddressOpen(true)}
- >
-
- افزودن آدرس جدید
-
-
-
-
- {addressData.map((e, index) => (
-
setAddressId(index)}
- key={index}
- >
-
-
-
- ))}
-
-
-
زمان و نحوه ارسال
-
-
-
-
-
- سریع ترین زمان ارسال
-
-
-
-
-
-
- {shippingData?.map((e, index) => (
-
handleShippingID(index)}
- key={index}
- >
-
-
-
- {e.name}{" "}
-
-
- {" "}
- حداکثر
-
- روز کاری
- | هزینه ارسال
-
- هزار تومان
-
-
-
- ))}
-
-
-
-
-
-
-
-
-
-
-
- پرداخت آنلاین
-
-
زرین پال
-
-
-
-
-
-
-
-
-
- پرداخت آنلاین (به زودی)
-
-
آسان پرداخت
-
-
-
-
{
- if (checkOutData?.discountCode == "") {
- CTX.setBottomSheetDiscountOpen(true);
- }
- }}
- >
-
-
-
-
- افزودن کد تخفیف{" "}
-
-
- کد تخفیف خود را وارد کنید
-
-
-
-
- {checkOutData?.discountCode == "" ? (
-
- +
-
- ) : (
-
-
- کد تخفیف ثبت شد{" "}
-
-
- )}
-
-
-
-
-
-
-
-
-
قیمت
-
-
-
-
-
-
- {" "}
- تومان
-
-
-
-
-
-
تخفیف محصول
-
-
-
-
-
-
- {" "}
- تومان
-
-
-
-
-
-
- هزینه بسته بندی
-
-
-
-
-
-
-
- {" "}
- تومان
-
-
-
-
-
-
هزینه ارسال
-
-
-
-
-
-
- {" "}
- تومان
-
-
-
-
-
-
- قابل پرداخت
-
-
-
-
-
-
-
- {" "}
- تومان
-
-
-
-
-
-
-
handleGoPayment()}
- permissionGoPay={permissionGoPay}
- />
-
-
-
+
>
);
};
diff --git a/src/app/cart/page.jsx b/src/app/cart/page.jsx
index 8f7d5c7..72bae1b 100644
--- a/src/app/cart/page.jsx
+++ b/src/app/cart/page.jsx
@@ -1,196 +1,15 @@
-"use client";
-import CardCart from "@comp/Cards/CardCart/page";
-import NavBarDownCart from "@comp/Carts/component/NavBarDownCart/page";
-import Navbar from "@comp/Navbar/page";
-import AppContext from "@ctx/AppContext";
-import { useRouter } from "next/navigation";
-import Chapar from "plugins/Chapar";
-import PersianNumber from "plugins/PersianNumber";
-import { useContext, useEffect } from "react";
-import { toast } from "react-toastify";
-
-const Page = () => {
- const CTX = useContext(AppContext);
- const router = useRouter();
- const cart = CTX.state.cart;
-
- const calculateTotalCost = cart.reduce(
- (total, item) => total + parseInt(item.cost) * item.count,
- 0
- );
-
- const calculateTotalCostWithDiscount = cart.reduce(
- (total, item) => total + parseInt(item.costWithDiscount) * item.count,
- 0
- );
-
- // const calculateTotalCostWithDiscount = cart.reduce((total, item) => {
- // // Check if costWithDiscount is defined and a valid number
- // if (
- // typeof item.costWithDiscount === "number" &&
- // !isNaN(item.costWithDiscount)
- // ) {
- // // If costWithDiscount is defined and valid, include it in the calculation
- // return total + item.costWithDiscount * item.count;
- // } else {
- // // If costWithDiscount is not defined or not a valid number, use regular cost
- // return total + item.cost * item.count;
- // }
- // }, 0);
-
- const handleGoCheckOut = async () => {
- // Check if the user is authorized based on the presence of a token in local storage
- const token = localStorage.getItem("token");
-
- if (token) {
- // If token exists, proceed to checkout
- const productsToSend = cart.map((item) => ({
- productId: item.id,
- count: parseInt(item.count),
- }));
- try {
- const data = await Chapar.post(
- `${process.env.NEXT_PUBLIC_API_URL}/order/bag/add`,
-
- JSON.stringify(productsToSend),
-
- {
- headers: {
- Authorization: localStorage.getItem("token"),
- },
- }
- );
-
- CTX.setCheckOutData(data);
- } catch ({ error, status }) {
- toast.error(`${error?.response?.data?.message}`, {
- position: "bottom-right",
- closeOnClick: true,
- });
- }
- router.push("/cart/checkout"); // Redirect to the checkout Page
- } else {
- // If token does not exist, redirect to login
- router.push("/login"); // Redirect to the login Page
- }
- };
-
- useEffect(() => {
- CTX.setBottomSheetCartOpen(false);
- }, []);
+import CartData from "@comp/AppsComponent/CartData/page";
+import React from "react";
+export const metadata = {
+ title: "سبد خرید",
+};
+const page = () => {
return (
<>
-
-
-
-
-
-
- محصولات انتخاب شده
-
-
-
-
-
-
- {cart?.map((e, index) => (
-
- ))}
-
-
-
-
حساب نهایی
-
- {/*
*/}
-
-
-
-
-
قیمت
-
-
-
-
-
-
- {" "}
- تومان
-
-
-
-
-
-
تخفیف محصول
-
-
-
-
-
-
- {" "}
- تومان
-
-
-
-
-
-
- قابل پرداخت
-
-
-
-
-
-
-
- {" "}
- تومان
-
-
-
-
-
-
-
-
-
handleGoCheckOut()}
- permissionGoPay={!!cart.length > 0}
- />
-
+
>
);
};
-export default Page;
+export default page;
diff --git a/src/app/categories/[...id]/page.jsx b/src/app/categories/[...id]/page.jsx
new file mode 100644
index 0000000..799fb5e
--- /dev/null
+++ b/src/app/categories/[...id]/page.jsx
@@ -0,0 +1,43 @@
+import CategoriesData from "@comp/AppsComponent/CategoriesData/page";
+import React from "react";
+
+export async function generateMetadata({ params }) {
+ const decodedName = decodeURIComponent(params.id[1]);
+
+ return {
+ title: decodedName,
+ description: ` خرید ${decodedName}| برندهای متنوع با پایین ترین قیمت | فروشگاه اینترنتی وسمه`,
+ metadataBase: new URL(
+ `https://www.vesmeh.com/categories/${params.id[0]}/${decodedName}`
+ ),
+ keywords: [
+ "آرایشی",
+ "بهداشت خانگی",
+ "محصولات زیبایی",
+ "لوازم تمیزی",
+ "مراقبت شخصی",
+ ],
+ openGraph: {
+ title: decodedName,
+ description: ` خرید ${decodedName}| برندهای متنوع با پایین ترین قیمت | فروشگاه اینترنتی وسمه`,
+ url: `https://www.vesmeh.com/categories/${params.id[0]}/${decodedName}`,
+ type: "website",
+ },
+ twitter: {
+ site: "@vesmehstore",
+ description: ` خرید ${decodedName}| برندهای متنوع با پایین ترین قیمت | فروشگاه اینترنتی وسمه`,
+ title: decodedName,
+ creator: "@vesmehstore",
+ },
+ };
+}
+
+const page = ({ params }) => {
+ return (
+
+
+
+ );
+};
+
+export default page;
diff --git a/src/app/contact-us/page.jsx b/src/app/contact-us/page.jsx
index e72d9a3..44bf1a2 100644
--- a/src/app/contact-us/page.jsx
+++ b/src/app/contact-us/page.jsx
@@ -2,6 +2,9 @@ import Footer from "@comp/Footer/page";
import Navbar from "@comp/Navbar/page";
import PersianNumber from "plugins/PersianNumber";
+export const metadata = {
+ title: "ارتباط با ما ",
+};
const Page = () => {
const number = "02188195164";
return (
diff --git a/src/app/faq/page.jsx b/src/app/faq/page.jsx
index 994912a..58d1098 100644
--- a/src/app/faq/page.jsx
+++ b/src/app/faq/page.jsx
@@ -1,79 +1,11 @@
-"use client";
-
-import Footer from "@comp/Footer/page";
-import Navbar from "@comp/Navbar/page";
-import { useEffect, useState } from "react";
-
+import FaqData from "@comp/AppsComponent/FaqData/page";
+export const metadata = {
+ title: "سوالات متدادول",
+};
const Page = () => {
- const [faq, setFaq] = useState([]);
- const [faqSelect, setFaqSelect] = useState(0);
-
- const fetchNavData = async (id) => {
- const res = await fetch(`https://jsonplaceholder.typicode.com/comments`);
- const post = await res.json();
- setFaq(post);
- };
-
- useEffect(() => {
- fetchNavData();
- }, []);
return (
<>
-
-
-
-
-
-
-
-
-
- پرسشهای متداول
-
-
-
-
-
-
-
- {faq?.map((e, index) => (
-
setFaqSelect(index)}
- key={index}
- >
-
-
- {faqSelect == index ? "-" : "+"}
-
-
- {e.name}
-
-
- {faqSelect == index && (
- <>
-
-
- {e.body}
-
- >
- )}
-
- ))}
-
-
-
+
>
);
};
diff --git a/src/app/layout.jsx b/src/app/layout.jsx
index b4069ee..bfd1b8c 100644
--- a/src/app/layout.jsx
+++ b/src/app/layout.jsx
@@ -1,353 +1,52 @@
-"use client";
-import AppContext from "@ctx/AppContext";
-import Chapar from "plugins/Chapar";
-import Loading from "plugins/Loading/page";
-import BottomSheetAddress from "plugins/bottomSheet/BottomSheetAddress";
-import BottomSheetLogOut from "plugins/bottomSheet/BottomSheetLogOut";
-import { useEffect, useState } from "react";
-import "react-image-gallery/styles/css/image-gallery.css";
-import "react-image-lightbox/style.css";
-import "react-spring-bottom-sheet/dist/style.css";
-import { ToastContainer, toast } from "react-toastify";
-import "react-toastify/dist/ReactToastify.css";
-import "swiper/css";
-import "../../style/fontiran.css";
-import "../../style/globals.css";
-import Goftino from "plugins/Goftino/page";
+import RootData from "@comp/AppsComponent/RootData/page";
export const metadata = {
- title: "Acme",
+ title: {
+ template:
+ "%s | خرید لوازم آرایشی و بهداشتی قیمت مناسب و اصل | فروشگاه اینترنتی وسمه",
+ default:
+ "فروشگاه اینترنتی وسمه - خرید لوازم آرایشی و بهداشتی قیمت مناسب و اصل",
+ },
+ description:
+ "مقایسه و خرید آنلاین انواع لوازم آرایشی، بهداشتی، خانه ، بهداشت جنسی | برندهای متنوع با پایین ترین قیمت | فروشگاه اینترنتی وسمه vesmeh.com",
+ metadataBase: new URL("https://www.vesmeh.com"),
+ authors: [
+ {
+ name: "وسمه",
+ url: "https://www.vesmeh.com",
+ },
+ ],
+ keywords: [
+ "آرایشی",
+ "بهداشت خانگی",
+ "محصولات زیبایی",
+ "لوازم تمیزی",
+ "مراقبت شخصی",
+ ],
openGraph: {
- title: "Acme",
- description: "Acme is a...",
+ title:
+ "خرید لوازم آرایشی و بهداشتی قیمت مناسب و اصل | فروشگاه اینترنتی وسمه",
+ description:
+ "مقایسه و خرید آنلاین انواع لوازم آرایشی، بهداشتی، خانه ، بهداشت جنسی | برندهای متنوع با پایین ترین قیمت | فروشگاه اینترنتی وسمه vesmeh.com",
+ url: "https://www.vesmeh.com",
+ type: "website",
+ },
+ twitter: {
+ site: "@vesmehstore",
+ description:
+ "مقایسه و خرید آنلاین انواع لوازم آرایشی، بهداشتی، خانه ، بهداشت جنسی | برندهای متنوع با پایین ترین قیمت | فروشگاه اینترنتی وسمه vesmeh.com",
+ title:
+ "خرید لوازم آرایشی و بهداشتی قیمت مناسب و اصل | فروشگاه اینترنتی وسمه",
+ creator: "@vesmehstore",
},
};
export default function RootLayout({ children }) {
- const [cart, setCart] = useState([]);
- const [products, setProducts] = useState([]);
- const [pager, setPager] = useState([]);
- const [navData, setNavData] = useState([]);
- const [brands, setBrands] = useState([]);
- const [loading, setLoading] = useState(false);
- const [closeNavbar, setCloseNavbar] = useState(false);
- const [bottomSheetCartOpen, setBottomSheetCartOpen] = useState(false);
- const [bottomSheetFilterOpen, setBottomSheetFilterOpen] = useState(false);
- const [bottomSheetDiscountOpen, setBottomSheetDiscountOpen] = useState(false);
- const [bottomSheetAddressOpen, setBottomSheetAddressOpen] = useState(false);
- const [bottomSheetLogOutOpen, setBottomSheetLogOutOpen] = useState(false);
- const [bottomSheetDeleteAddressOpen, setBottomSheetDeleteAddressOpen] =
- useState(false);
- const [checkOutData, setCheckOutData] = useState([]);
- const [addressData, setAddressData] = useState([]);
- const [profile, setProfile] = useState([]);
- const [stopProducts, setStopProducts] = useState(false);
- const [pageGetProducts, setPageGetProducts] = useState(0);
- const [isMobile, setIsMobile] = useState(false);
- const [isOpenLightBox, setIsOpenLightBox] = useState(false);
-
- const AddItemToCart = (
- id,
- persianName,
- cost,
- costWithDiscount,
- mainImage,
- hasDiscount,
- maxOrderCount
- ) => {
- setCart((prevCart) => {
- // Check if the item is already in the cart
- const existingItem = prevCart.find((item) => item.id === id);
- let updatedCart;
- if (existingItem) {
- // If the item is already in the cart, update its count
- if (existingItem.count < maxOrderCount) {
- updatedCart = prevCart.map((item) =>
- item.id === id ? { ...item, count: item.count + 1 } : item
- );
- } else {
- // Notify user if maxOrderCount is exceeded
- toast.error(
- `
- نمیتوانید بیشتراز
-
- ${maxOrderCount}
-
- عدد ثبت کنید `,
- {
- position: "bottom-right",
- closeOnClick: true,
- }
- );
- updatedCart = prevCart;
- }
- } else {
- // If the item is not in the cart, add it with a count of 1
- updatedCart = [
- ...prevCart,
- {
- id,
- count: 1,
- persianName,
- cost,
- costWithDiscount,
- mainImage,
- hasDiscount,
- maxOrderCount,
- },
- ];
- }
- // Store the updated cart in local storage
- localStorage.setItem("cart", JSON.stringify(updatedCart));
-
- // Return the updated cart
- return updatedCart;
- });
- };
-
- const RemoveItemFromCart = (id) => {
- setCart((prevCart) => {
- // Check if the item is already in the cart
- const existingItem = prevCart.find((item) => item.id === id);
-
- if (existingItem) {
- // If the item is already in the cart
- if (existingItem.count === 1) {
- // If the item count is 1, remove it from the cart
- const updatedCart = prevCart.filter((item) => item.id !== id);
-
- // Store the updated cart in local storage
- localStorage.setItem("cart", JSON.stringify(updatedCart));
-
- // Return the updated cart
- return updatedCart;
- } else {
- // If the item count is greater than 1, update its count
- const updatedCart = prevCart.map((item) =>
- item.id === id ? { ...item, count: item.count - 1 } : item
- );
-
- // Store the updated cart in local storage
- localStorage.setItem("cart", JSON.stringify(updatedCart));
-
- // Return the updated cart
- return updatedCart;
- }
- } else {
- // If the item is not in the cart, do nothing
- return prevCart;
- }
- });
- };
-
- const fetchNavData = async (id) => {
- const res = await fetch(
- `${process.env.NEXT_PUBLIC_API_URL}/product/category?sortByMain=true`
- );
- const post = await res.json();
- setNavData(post);
- };
-
- const fetchProducts = async (
- pageGetProducts,
- id,
- selectedBrands,
- isChecked,
- minPrice,
- maxPrice,
- sort,
- isRangePrice,
- paginationSay
- ) => {
- const brandIds = selectedBrands?.map((brand) => brand.id);
-
- const queryString = `${`page=${pageGetProducts}`}${
- id ? `&categoryId=${id}` : ""
- }${
- brandIds?.length > 0 ? `&brandIds=${brandIds?.join("&brandIds=")}` : ""
- }${isChecked ? `&isActive=${isChecked}` : ""}${
- isRangePrice ? `&minPrice=${minPrice}` : ""
- }${isRangePrice ? `&maxPrice=${maxPrice}` : ""}${
- !!sort ? `&sortBy=${sort}` : ""
- }`;
-
- const cleanQueryString = decodeURIComponent(
- queryString.replace(/\%20/g, " ")
- );
- const res = await fetch(
- `${process.env.NEXT_PUBLIC_API_URL}/product?${cleanQueryString}`
- );
- const post = await res.json();
- if (paginationSay) {
- // If it's a paginated request (not the first Page)
- window.scrollTo({
- top: 0,
- behavior: "smooth", // Optional: smooth scrolling behavior
- });
- console.log();
- setProducts(post.products);
- setStopProducts(true); // Assuming this stops pagination
- }
-
- if (post.length <= 19) {
- // If the length of fetched products is less than or equal to 19, indicating the last Page
- setStopProducts(true); // Assuming this stops pagination
- }
-
- if (!paginationSay && pageGetProducts == 0) {
- // If it's not a paginated request and it's the first Page
- setProducts(post.products);
- setPager(post.pager);
- } else if (!paginationSay && pageGetProducts != 0) {
- // If it's not a paginated request and it's not the first Page
- console.log("kir", products, !!products ? products : [], post.products);
- setProducts((data) => [...(data ? data : []), ...post.products]);
- }
- };
-
- const fetchAddressUser = async () => {
- try {
- const data = await Chapar.get(
- `${process.env.NEXT_PUBLIC_API_URL}/user/address`,
- {
- headers: {
- Authorization: localStorage.getItem("token"),
- },
- }
- );
-
- setAddressData(data);
- } catch ({ error, status }) {
- toast.error(`${error?.response?.data?.message}`, {
- position: "bottom-right",
- closeOnClick: true,
- });
- setLoading(false);
- }
- };
-
- const fetchUserInfo = async () => {
- try {
- const data = await Chapar.get(
- `${process.env.NEXT_PUBLIC_API_URL}/user/info`,
- {
- headers: {
- Authorization: localStorage.getItem("token"),
- },
- }
- );
-
- setProfile(data);
- } catch ({ error, status }) {
- localStorage.removeItem("token");
- toast.error(`${error?.response?.data?.message}`, {
- position: "bottom-right",
- closeOnClick: true,
- });
- }
- };
-
- useEffect(() => {
- const storedCart = localStorage.getItem("cart");
- const token = localStorage.getItem("token");
- if (storedCart) {
- setCart(JSON.parse(storedCart));
- }
-
- if (token) {
- fetchUserInfo();
- }
-
- fetchNavData();
- }, []);
-
- useEffect(() => {
- const mediaQuery = window.matchMedia("(max-width: 768px)"); // Adjust the width according to your mobile breakpoint
-
- const checkDeviceType = (mediaQuery) => {
- if (mediaQuery.matches) {
- setIsMobile(true);
- } else {
- setIsMobile(false);
- }
- };
-
- // Initial check
- checkDeviceType(mediaQuery);
-
- // Listen for changes in media query
- const listener = () => checkDeviceType(mediaQuery);
- mediaQuery.addEventListener("change", listener);
-
- // Clean up
- return () => {
- mediaQuery.removeEventListener("change", listener);
- };
- }, []);
-
return (
-
-
-
- {children}
-
-
-
-
-
-
-
-
-
+
+
+
+
+
);
}
diff --git a/src/app/products/[...id]/page.jsx b/src/app/products/[...id]/page.jsx
index 3b22c70..e91f682 100644
--- a/src/app/products/[...id]/page.jsx
+++ b/src/app/products/[...id]/page.jsx
@@ -1,331 +1,39 @@
-"use client";
-import Footer from "@comp/Footer/page";
-import Navbar from "@comp/Navbar/page";
-import GalleryBox from "plugins/Gallery/page";
-import { useEffect, useState } from "react";
+import ProductData from "@comp/AppsComponent/ProductData/page";
-import AddToCart from "@comp/Cards/Components/AddToCart/page";
-import Image from "next/image";
-import PersianNumber from "plugins/PersianNumber";
-import logo from "../../../../public/images/logo.png";
+export async function generateMetadata({ params }) {
+ const decodedName = decodeURIComponent(params.id[1]);
+ return {
+ title: decodedName,
+ description: ` خرید ${decodedName}| برندهای متنوع با پایین ترین قیمت | فروشگاه اینترنتی وسمه`,
+ metadataBase: new URL(
+ `https://www.vesmeh.com/categories/${params.id[0]}/${decodedName}`
+ ),
+ keywords: [
+ "آرایشی",
+ "بهداشت خانگی",
+ "محصولات زیبایی",
+ "لوازم تمیزی",
+ "مراقبت شخصی",
+ ],
+ openGraph: {
+ title: decodedName,
+ description: ` خرید ${decodedName}| برندهای متنوع با پایین ترین قیمت | فروشگاه اینترنتی وسمه`,
+ url: `https://www.vesmeh.com/categories/${params.id[0]}/${decodedName}`,
+ type: "website",
+ },
+ twitter: {
+ site: "@vesmehstore",
+ description: ` خرید ${decodedName}| برندهای متنوع با پایین ترین قیمت | فروشگاه اینترنتی وسمه`,
+ title: decodedName,
+ creator: "@vesmehstore",
+ },
+ };
+}
const Page = ({ params }) => {
- const [product, setProduct] = useState([]);
- const [specificationsHeader, setSpecificationsHeader] = useState([]);
-
- const fetchPost = async (id) => {
- const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/product/${id}`);
- const post = await res.json();
- setProduct(post.product);
- };
-
- console.log("product", product);
-
- const displaySpecifications = (specs) => {
- let data = [];
- if (specs?.length > 3) {
- specs?.slice(0, 3).forEach((spec) => {
- const { title, value } = spec;
-
- data.push(`${title}: ${value}`);
- });
- } else {
- specs?.forEach((spec) => {
- const { title, value } = spec;
-
- data.push(`${title}: ${value}`);
- });
- }
-
- setSpecificationsHeader(data); // You can replace console.log with any method to display the content in your header
- };
-
- useEffect(() => {
- fetchPost(params.id[0]);
- }, []);
-
- useEffect(() => {
- displaySpecifications(product?.specifications);
- }, [product]);
-
return (
<>
-
-
-
-
-
-
-
-
-
-
{product.persianName}
-
- {product?.englishName}{" "}
-
-
-
-
-
-
- {product?.hasDiscount && (
-
- )}
-
- {!product?.warranty == "" && (
-
-
- {product?.warranty}
-
-
- )}
-
-
- {/*
*/}
-
-
-
-
- {product?.summery}
-
-
-
-
-
- {specificationsHeader.map((e, index) => (
- -
-
-
- {e}
-
-
- ))}
-
-
-
- {/* xs:sticky lg:relative xs:top-[60px] lg:top-0 ==> sticky for price=================== */}
-
-
-
-
-
- {product.files?.length > 0 ? (
-
CTX.setIsOpenLightBox(true)}
- alt=""
- />
- ) : (
-
-
-
- )}
-
-
-
-
- {product.persianName}{" "}
-
-
-
-
-
-
-
- گارانتی{" "}
- اصالت{" "}
- و{" "}
-
- سلامت فیزیکی کالا
-
-
-
-
-
-
-
- {true ? (
-
- ) : (
-
- )}
-
-
-
-
-
-
-
-
-
-
- مشخصات محصول
-
-
- مشخصات
-
-
-
-
-
-
- دیدگاه مخاطبان
-
-
- مخاطبان
-
-
-
-
-
-
- مشخصات محصول
-
-
- {product?.specifications?.map((e, index) => (
-
-
- {e.title}:
-
- {" "}
- {e.value}{" "}
-
-
-
- ))}
-
-
-
-
-
-
-
-
-
- {product?.hasDiscount ? (
- <>
-
-
-
-
-
-
- >
- ) : (
-
- )}
-
-
-
-
-
-
-
-
-
+
>
);
};
diff --git a/src/app/terms-and-conditions/page.jsx b/src/app/terms-and-conditions/page.jsx
index 76623a0..97b02d9 100644
--- a/src/app/terms-and-conditions/page.jsx
+++ b/src/app/terms-and-conditions/page.jsx
@@ -1,6 +1,8 @@
import Footer from "@comp/Footer/page";
import Navbar from "@comp/Navbar/page";
-
+export const metadata = {
+ title: "قوانین و مقررات فروشگاه وسمه ",
+};
const Page = () => {
const number = "02188195164";
return (