specialOffer
parent
5b38790cd3
commit
f0eaae56a2
|
@ -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.3.3
|
||||
NEXT_PUBLIC_PACKAGE_VERSION=0.31.3
|
|
@ -39,13 +39,18 @@ export default function CategoriesData({ params, products }) {
|
|||
);
|
||||
const stopProducts = CTX.state.stopProducts;
|
||||
const pager = products.pager;
|
||||
const productsLength = CTX.state.products.length;
|
||||
const productsLength = CTX.state?.products?.length || 0;
|
||||
const filter = CTX.state.filter;
|
||||
|
||||
const isChecked = useMemo(
|
||||
() => Boolean(Number(searchParams.get("isActive"))),
|
||||
[searchParams]
|
||||
);
|
||||
|
||||
const specialOffer = useMemo(
|
||||
() => Boolean(Number(searchParams.get("specialOffer"))),
|
||||
[searchParams]
|
||||
);
|
||||
const selectedBrands = useMemo(
|
||||
() =>
|
||||
searchParams.get("brandIds")
|
||||
|
@ -148,6 +153,7 @@ export default function CategoriesData({ params, products }) {
|
|||
sortBy={sortBy}
|
||||
isRangePrice={isRangePrice}
|
||||
filter={filter}
|
||||
specialOffer={specialOffer}
|
||||
/>
|
||||
|
||||
<div className="lg:col-span-6 xl:col-span-4 ">
|
||||
|
|
|
@ -14,6 +14,7 @@ const FilterCategory = ({
|
|||
sortBy,
|
||||
isRangePrice,
|
||||
theme,
|
||||
specialOffer,
|
||||
filter,
|
||||
}) => {
|
||||
const pathname = usePathname();
|
||||
|
@ -37,6 +38,18 @@ const FilterCategory = ({
|
|||
router.push(`${pathname}?${params}`);
|
||||
};
|
||||
|
||||
const handleSpecialOfferChange = () => {
|
||||
// CTX.setIsChecked(!isChecked);
|
||||
const params = new URLSearchParams(searchParams.toString());
|
||||
if (!specialOffer) {
|
||||
params.set("specialOffer", Number(!specialOffer));
|
||||
} else {
|
||||
params.delete("specialOffer");
|
||||
}
|
||||
params.set("page", "0");
|
||||
router.push(`${pathname}?${params}`);
|
||||
};
|
||||
|
||||
const handleRangeChange = (values) => {
|
||||
// CTX.setIsRangePrice(true);
|
||||
|
||||
|
@ -180,6 +193,7 @@ const FilterCategory = ({
|
|||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={`p-5 border-gray-300 rounded-lg mt-3 flex justify-between ${
|
||||
theme == 2 ? "bg-gray-100" : "bg-gray-50"
|
||||
|
@ -202,6 +216,30 @@ const FilterCategory = ({
|
|||
</Switch>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={`p-5 border-gray-300 rounded-lg mt-3 flex justify-between ${
|
||||
theme == 2 ? "bg-gray-100" : "bg-gray-50"
|
||||
} `}
|
||||
>
|
||||
<p className="mb-0 lg:text-sm xl:text-base">
|
||||
فقط پیشنهاد های ویژه{" "}
|
||||
</p>
|
||||
<Switch
|
||||
checked={Boolean(Number(searchParams.get("specialOffer")))}
|
||||
onChange={handleSpecialOfferChange}
|
||||
className={`${
|
||||
specialOffer ? "bg-primary-500" : "bg-gray-400"
|
||||
} relative inline-flex h-6 w-[50px] items-center rounded-full`}
|
||||
>
|
||||
<span className="sr-only">Enable notifications</span>
|
||||
<span
|
||||
className={`${
|
||||
specialOffer ? "translate-x-[-5px]" : "translate-x-[-30px]"
|
||||
} inline-block h-4 w-4 transform rounded-full bg-white transition`}
|
||||
/>
|
||||
</Switch>
|
||||
</div>
|
||||
|
||||
{/* <div
|
||||
className={` p-5 border-gray-300 rounded-lg mt-3 ${
|
||||
theme == 2 ? "bg-gray-100" : "bg-gray-50"
|
||||
|
|
|
@ -86,20 +86,20 @@ const FilterCategoryMobile = (props) => {
|
|||
>
|
||||
<div>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="20"
|
||||
height="20"
|
||||
viewBox="0 0 300 300"
|
||||
viewBox="0 0 16 16"
|
||||
className="mx-2 opacity-30"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
className=" opacity-30"
|
||||
>
|
||||
<path
|
||||
d="M175.462 261.712C173.18 261.701 170.943 261.075 168.987 259.9L127.312 234.9C122.624 232.071 118.743 228.082 116.044 223.318C113.344 218.554 111.917 213.175 111.9 207.7V151.137C111.911 147.145 110.67 143.249 108.35 140L50.1623 58.2247C48.8035 56.3369 47.9927 54.1105 47.8193 51.791C47.6459 49.4716 48.1166 47.1493 49.1795 45.0804C50.2424 43.0116 51.8561 41.2765 53.8427 40.0668C55.8292 38.857 58.1113 38.2195 60.4373 38.2247H239.562C241.89 38.215 244.175 38.8497 246.164 40.0585C248.154 41.2673 249.77 43.003 250.833 45.0736C251.897 47.1441 252.367 49.4686 252.191 51.7897C252.015 54.1108 251.201 56.338 249.837 58.2247L191.65 140C189.326 143.248 188.08 147.143 188.087 151.137V249.062C188.084 252.412 186.754 255.624 184.387 257.995C182.021 260.366 178.812 261.702 175.462 261.712ZM60.4373 50.7872L118.525 132.75C122.363 138.111 124.418 144.544 124.4 151.137V207.687C124.408 211.005 125.272 214.264 126.907 217.15C128.543 220.036 130.895 222.451 133.737 224.162L175.412 249.162L175.587 151.125C175.573 144.53 177.633 138.098 181.475 132.737L239.65 50.9622L60.4373 50.7872Z"
|
||||
fill="black"
|
||||
fill="currentColor"
|
||||
d="M3.5 2.5a.5.5 0 0 0-1 0v8.793l-1.146-1.147a.5.5 0 0 0-.708.708l2 1.999l.007.007a.497.497 0 0 0 .7-.006l2-2a.5.5 0 0 0-.707-.708L3.5 11.293zm3.5 1a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5M7.5 6a.5.5 0 0 0 0 1h5a.5.5 0 0 0 0-1zm0 3a.5.5 0 0 0 0 1h3a.5.5 0 0 0 0-1zm0 3a.5.5 0 0 0 0 1h1a.5.5 0 0 0 0-1z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<p className="mb-0 text-sm text-gray-500">ترند ها</p>
|
||||
<p className="mb-0 text-sm text-gray-500"> مرتب سازی</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@ const BeautySection = ({ data }) => {
|
|||
<div className="xs:px-0 lg:px-20">
|
||||
<div className="w-full rtl relative ">
|
||||
<div className="pt-5 flex relative justify-between">
|
||||
<p className="mb-0 text-white font-bold xs:text-sm lg:text-2xl xl:text-2xl">
|
||||
لوازم بهداشتی زیبایی{" "}
|
||||
</p>
|
||||
<h2 className="mb-0 text-white font-bold xs:text-sm lg:text-2xl xl:text-2xl">
|
||||
آرایش صورت وسمه{" "}
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
<Swiper
|
||||
|
|
|
@ -37,7 +37,7 @@ const BetweenSexualSection = () => {
|
|||
|
||||
<div className="mt-10 xs:block lg:flex">
|
||||
<Link
|
||||
href={`/categories/7e92af7d-0370-451f-9770-5e26b5c8dc63`}
|
||||
href={`/categories/8bf20569-c3e3-457f-b9ad-140ef449741b/ژل-بهداشتی-بانوان-و-آقایان`}
|
||||
className="w-full mx-3"
|
||||
>
|
||||
<div className="w-full p-3 mx-1 bg-pink-300 rounded-3xl lg:my-0 ">
|
||||
|
@ -63,7 +63,7 @@ const BetweenSexualSection = () => {
|
|||
</Link>
|
||||
|
||||
<Link
|
||||
href={`/categories/7e92af7d-0370-451f-9770-5e26b5c8dc63`}
|
||||
href={`/categories/70cffd9e-f475-4245-87bb-5f175d286901/لوازم-اصلاح`}
|
||||
className="w-full mx-3"
|
||||
>
|
||||
<div className="w-full p-3 mx-1 bg-sky-300 rounded-3xl xs:my-3 lg:my-0 ">
|
||||
|
|
|
@ -12,7 +12,7 @@ const HeroSection = () => {
|
|||
<div className=" xs:mt-[150px] md:mt-[60px] xl:mt-[90px] relative">
|
||||
<div className="text-center">
|
||||
<h1 className=" xs:text-3xl lg:text-5xl xl:text-6xl text-white font-bold">
|
||||
وسمه ، بُن مضـــــــــــارع زیبایی
|
||||
وسمه ، بُن مضارع زیبایی
|
||||
</h1>
|
||||
<h2 className="text-gray-300 mt-4 xs:text-sm lg:text-lg xl:text-xl font-light ">
|
||||
زیبایی شما در اولویت ماست{" "}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import CardNormal from "@comp/Cards/CardNormal/page";
|
||||
import TimerDown from "@comp/TimerDown/TimerDown";
|
||||
import Link from "next/link";
|
||||
import { Swiper, SwiperSlide } from "swiper/react";
|
||||
|
||||
const SurpriseSection = ({ data }) => {
|
||||
|
@ -66,11 +67,16 @@ const SurpriseSection = ({ data }) => {
|
|||
))}
|
||||
</Swiper>
|
||||
|
||||
{/* <div className="mx-5 mt-8">
|
||||
<p className="mb-0 text-sm text-gray-600 xs:text-white md:text-black">
|
||||
مشاهده بیشتر{" "}
|
||||
</p>
|
||||
</div> */}
|
||||
<Link
|
||||
href={"/categories/0/همه%20محصولات?page=0&specialOffer=1"}
|
||||
className="z-90 relative"
|
||||
>
|
||||
<div className="mx-5 mt-8">
|
||||
<p className="mb-0 text-sm text-gray-600 xs:text-white md:text-black">
|
||||
مشاهده بیشتر{" "}
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
|
|
|
@ -482,7 +482,7 @@ const Navbar = ({ theme }) => {
|
|||
<div
|
||||
className={`flex justify-between rtl z-[50] rounded-bl-3xl ${
|
||||
isScrolled
|
||||
? " !fixed top-0 w-full bg-gray-100 p-5"
|
||||
? " !sticky top-0 w-full bg-gray-100 p-5"
|
||||
: " relative px-5 pt-5 "
|
||||
} `}
|
||||
>
|
||||
|
|
|
@ -40,11 +40,18 @@ export async function generateMetadata({ params }) {
|
|||
// maxPrice
|
||||
// sortBy
|
||||
const fetchProducts = async (categoryId, searchParams) => {
|
||||
const { brandIds: brandIdsString, isActive, ...params } = searchParams;
|
||||
const {
|
||||
brandIds: brandIdsString,
|
||||
isActive,
|
||||
specialOffer,
|
||||
...params
|
||||
} = searchParams;
|
||||
|
||||
const query = {
|
||||
categoryId,
|
||||
...(categoryId != 0 ? { categoryId } : {}),
|
||||
page: 0,
|
||||
...(!!isActive ? { isActive: !!isActive } : {}),
|
||||
...(!!specialOffer ? { specialOffer: !!specialOffer } : {}),
|
||||
...params,
|
||||
};
|
||||
|
||||
|
@ -61,6 +68,7 @@ const fetchProducts = async (categoryId, searchParams) => {
|
|||
if (!res.ok) return [];
|
||||
const products = await res.json();
|
||||
|
||||
console.log("products++++++++++++++++++++++++++++++++", products);
|
||||
return products;
|
||||
} catch (error) {
|
||||
return [];
|
||||
|
|
Loading…
Reference in New Issue