From e1a84105c7d5ebe4d492241e52e4876de3739178 Mon Sep 17 00:00:00 2001 From: soheil khaledabadi Date: Tue, 22 Sep 2026 00:14:02 +0330 Subject: [PATCH] feat: require reading the service description before purchase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For categories with has_extra_description, the buy button now stays disabled until the user ticks "توضیحات سرویس را مطالعه کردم" — mirrors the pattern used for the Shahkar/advanced-verification gates. Co-Authored-By: Claude Sonnet 5 --- .../productList/components/ModalBuy.tsx | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/pages/shop/section/productList/components/ModalBuy.tsx b/src/pages/shop/section/productList/components/ModalBuy.tsx index 976283c..f3d0937 100644 --- a/src/pages/shop/section/productList/components/ModalBuy.tsx +++ b/src/pages/shop/section/productList/components/ModalBuy.tsx @@ -47,6 +47,7 @@ const ModalBuy = ({ isOpen, setIsOpen, configId }: ModalBuyProps) => { const [isInfoOpen, setIsInfoOpen] = useState(false); const [needsShahkarVerification, setNeedsShahkarVerification] = useState(false); const [nationalCode, setNationalCode] = useState(""); + const [hasReadDescription, setHasReadDescription] = useState(false); const payablePrice = toNumber( price === 0 ? data?.data?.result?.price || 0 : price ); @@ -103,6 +104,7 @@ const ModalBuy = ({ isOpen, setIsOpen, configId }: ModalBuyProps) => { setPrice(0); setNeedsShahkarVerification(false); setNationalCode(""); + setHasReadDescription(false); } }, [isOpen, setFieldValue]); const mutation = useMutation({ @@ -194,6 +196,11 @@ const ModalBuy = ({ isOpen, setIsOpen, configId }: ModalBuyProps) => { return; } + if (hasExtraDescription && !hasReadDescription) { + toast.error("لطفا ابتدا توضیحات سرویس را مطالعه و تایید کنید"); + return; + } + if (needsShahkarVerification && nationalCode.trim().length !== 10) { toast.error("لطفا کد ملی ۱۰ رقمی را به‌درستی وارد کنید"); return; @@ -281,8 +288,9 @@ const ModalBuy = ({ isOpen, setIsOpen, configId }: ModalBuyProps) => { submitText={data?.data?.result?.max_config === 0 ? undefined : "خرید"} submitOnClick={submitHandler} disabled={ - isLoading || - isFetching + isLoading || + isFetching || + (hasExtraDescription && !hasReadDescription) } nameService={ isLoading || isFetching @@ -337,6 +345,17 @@ const ModalBuy = ({ isOpen, setIsOpen, configId }: ModalBuyProps) => { توضیحات سرویس )} + {hasExtraDescription && ( + + )} {" "} کاربر گرامی لطفا از خاموش بودن vpn خود اطمینان حاصل فرمایید تا در