From 12a5365c9c9b4c993f4eaca8ed24c4b3a8d8172c Mon Sep 17 00:00:00 2001 From: Martin Heppner <105971399+martinheppner@users.noreply.github.com> Date: Thu, 19 Sep 2024 17:11:42 +0200 Subject: [PATCH] Show number of tours for cities, if city is set --- src/views/Start/Header.js | 11 ++++++++--- src/views/Start/Start.js | 1 - 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/views/Start/Header.js b/src/views/Start/Header.js index b3c68fc..3fcb050 100644 --- a/src/views/Start/Header.js +++ b/src/views/Start/Header.js @@ -26,7 +26,7 @@ export default function Header({ const [capCity, setCapCity] = useState(city); const [totalToursFromCity, setTotalToursFromCity] = useState(0); - + const tld = getTLD(); const updateCapCity = useCallback((newCity) => { @@ -43,7 +43,7 @@ export default function Header({ const cityObj = allCities.find((e) => e.value === city); if (cityObj) { updateCapCity(cityObj.label); - console.log("setting search params", city); + // console.log("setting search params", city); searchParams.set("city", city); } } @@ -84,10 +84,14 @@ export default function Header({ + {totalTours > 0 && ( - {totalTours.toLocaleString()}{" "} + {totalToursFromCity === 0 + ? totalTours.toLocaleString() + : totalToursFromCity.toLocaleString()} + {" "} {t( totalToursFromCity === 0 ? "start.tourenanzahl_untertitel" @@ -97,6 +101,7 @@ export default function Header({ )} + {allCities.length > 0 && ( }> { if (tourExtracted?.data?.tour) { localStorage.setItem("tourId", tour.id); - // window.open("/tour?" + searchParams.toString(),"_blank","noreferrer");// removed to use tags } else { window.location.reload(); }