From 5e9e0b79691a22e7e69268c2835a074211ef1ff8 Mon Sep 17 00:00:00 2001 From: soheil khaledabadi Date: Fri, 11 Sep 2026 16:48:20 +0330 Subject: [PATCH] feat: drive shop "service description" button/content from backend Replaces the hardcoded DNS-only content and isDns/category-label check with data from the config's `has_extra_description` / `extra_description` fields, so any product can opt into showing free-text extra info. Co-Authored-By: Claude Sonnet 5 --- .../shop/section/productList/ProductList.tsx | 5 +- .../productList/components/ListAllProduct.tsx | 17 +-- .../productList/components/ModalBuy.tsx | 14 +- .../components/ModalDnsServiceInfo.tsx | 131 ++---------------- src/types/props.d.ts | 1 - 5 files changed, 23 insertions(+), 145 deletions(-) diff --git a/src/pages/shop/section/productList/ProductList.tsx b/src/pages/shop/section/productList/ProductList.tsx index 2701bc7..cc11d31 100644 --- a/src/pages/shop/section/productList/ProductList.tsx +++ b/src/pages/shop/section/productList/ProductList.tsx @@ -53,10 +53,7 @@ const ProductList = () => { activeId={activeId} setActiveId={setActiveId} /> - + ); diff --git a/src/pages/shop/section/productList/components/ListAllProduct.tsx b/src/pages/shop/section/productList/components/ListAllProduct.tsx index 6365cd4..1f0d093 100644 --- a/src/pages/shop/section/productList/components/ListAllProduct.tsx +++ b/src/pages/shop/section/productList/components/ListAllProduct.tsx @@ -9,25 +9,11 @@ import { RootState } from "../../../../../redux/store"; import { useNavigate } from "react-router-dom"; import toast from "react-hot-toast"; -interface Category { - id: number | string; - label?: string; -} - -const ListAllProduct = ({ - activeId, - categories, -}: { - activeId: number; - categories?: Category[]; -}) => { +const ListAllProduct = ({ activeId }: { activeId: number }) => { const axios = useAxios(); const [selectedConfigId, setSelectedConfigId] = useState(null); const { token } = useSelector((state: RootState) => state.token); const navigate = useNavigate(); - const isDnsCategory = - categories?.find((category) => Number(category.id) === activeId)?.label?.toLowerCase() === - "dns"; const { data, error, isLoading, isFetching } = useQuery({ queryKey: ["configs", activeId], queryFn: () => { @@ -84,7 +70,6 @@ const ListAllProduct = ({ isOpen={selectedConfigId !== null} setIsOpen={(open) => { if (!open) setSelectedConfigId(null); }} configId={selectedConfigId} - isDns={isDnsCategory} /> )}
{ +const ModalBuy = ({ isOpen, setIsOpen, configId }: ModalBuyProps) => { const axios = useAxios(); const dispatch = useDispatch(); const navigate = useNavigate(); @@ -54,6 +54,10 @@ const ModalBuy = ({ isOpen, setIsOpen, configId, isDns }: ModalBuyProps) => { ); const advancedVerificationMessage = buildAdvancedVerificationMessage(advancedVerificationLimit); + const hasExtraDescription = Boolean( + data?.data?.result?.has_extra_description + ); + const extraDescription = data?.data?.result?.extra_description ?? ""; const advancedVerificationFromApi = data?.data?.result?.requires_advanced_verification; const hasAdvancedVerificationApiFlag = @@ -239,7 +243,11 @@ const ModalBuy = ({ isOpen, setIsOpen, configId, isDns }: ModalBuyProps) => { return ( <> - + {
) : (
- {isDns && ( + {hasExtraDescription && (