From 03795f975d4127c663afbf70dfd3473ea08fc352 Mon Sep 17 00:00:00 2001 From: duckietm Date: Wed, 20 May 2026 12:00:41 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=86=99=20Fix=20Buy=20when=20search?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/page/common/CatalogSearchView.tsx | 7 ++++++- .../page/widgets/CatalogPurchaseWidgetView.tsx | 13 ++++++------- src/components/login/TurnstileWidget.tsx | 18 +----------------- src/hooks/catalog/useCatalog.ts | 6 +++--- 4 files changed, 16 insertions(+), 28 deletions(-) diff --git a/src/components/catalog/views/page/common/CatalogSearchView.tsx b/src/components/catalog/views/page/common/CatalogSearchView.tsx index 5fd9dca..5a3baf3 100644 --- a/src/components/catalog/views/page/common/CatalogSearchView.tsx +++ b/src/components/catalog/views/page/common/CatalogSearchView.tsx @@ -49,6 +49,7 @@ export const CatalogSearchView: FC<{}> = () => const name = normalizeSearchText(furniture.name || ''); const matchesSearch = name.includes(search); + const isBuyable = (furniture.purchaseOfferId > -1) || (furniture.rentOfferId > -1); if((currentType === CatalogType.BUILDER) && (furniture.purchaseOfferId === -1) && (furniture.rentOfferId === -1)) { @@ -57,7 +58,7 @@ export const CatalogSearchView: FC<{}> = () => if(matchesSearch) foundFurniLines.push(furniture.furniLine); } } - else if(matchesSearch) + else if(matchesSearch && isBuyable) { foundFurniture.push(furniture); @@ -68,6 +69,10 @@ export const CatalogSearchView: FC<{}> = () => if(foundFurniture.length === 250) break; } + else if(matchesSearch && furniture.furniLine && furniture.furniLine.length && (foundFurniLines.indexOf(furniture.furniLine) < 0)) + { + foundFurniLines.push(furniture.furniLine); + } } const offers: IPurchasableOffer[] = []; diff --git a/src/components/catalog/views/page/widgets/CatalogPurchaseWidgetView.tsx b/src/components/catalog/views/page/widgets/CatalogPurchaseWidgetView.tsx index ed1dc34..5fe8ef8 100644 --- a/src/components/catalog/views/page/widgets/CatalogPurchaseWidgetView.tsx +++ b/src/components/catalog/views/page/widgets/CatalogPurchaseWidgetView.tsx @@ -22,7 +22,7 @@ export const CatalogPurchaseWidgetView: FC = pro const [ catalogSkipPurchaseConfirmation, setCatalogSkipPurchaseConfirmation ] = useLocalStorage(LocalStorageKeys.CATALOG_SKIP_PURCHASE_CONFIRMATION, false); const { currentOffer = null, currentPage = null } = useCatalogData(); const { currentType = CatalogType.NORMAL, purchaseOptions = null, setPurchaseOptions = null, setCatalogPlaceMultipleObjects = null } = useCatalogUiState(); - const { requestOfferToMover = null, getBuilderFurniPlaceableStatus = null } = useCatalogActions(); + const { requestOfferToMover = null, getBuilderFurniPlaceableStatus = null, getNodesByOfferId = null } = useCatalogActions(); const { getCurrencyAmount = null } = usePurse(); const { showSingleBubble = null } = useNotification(); @@ -105,12 +105,11 @@ export const CatalogPurchaseWidgetView: FC = pro let pageId = currentOffer.page.pageId; - // if(pageId === -1) - // { - // const nodes = getNodesByOfferId(currentOffer.offerId); - - // if(nodes) pageId = nodes[0].pageId; - // } + if(pageId === -1 && getNodesByOfferId) + { + const nodes = getNodesByOfferId(currentOffer.offerId); + if(nodes && nodes.length) pageId = nodes[0].pageId; + } SendMessageComposer(new PurchaseFromCatalogComposer(pageId, currentOffer.offerId, purchaseOptions.extraData, purchaseOptions.quantity)); }; diff --git a/src/components/login/TurnstileWidget.tsx b/src/components/login/TurnstileWidget.tsx index 8754231..6a8cbda 100644 --- a/src/components/login/TurnstileWidget.tsx +++ b/src/components/login/TurnstileWidget.tsx @@ -13,8 +13,6 @@ declare global } } -const SCRIPT_SRC = 'https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit'; - export interface TurnstileWidgetProps { siteKey: string; @@ -98,19 +96,5 @@ export const TurnstileWidget: FC = props => if(!siteKey) return null; - return ( - <> -