Skip to content

Commit

Permalink
Show number of tours for cities, if city is set
Browse files Browse the repository at this point in the history
  • Loading branch information
martinheppner committed Sep 19, 2024
1 parent 56063d2 commit 12a5365
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/views/Start/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -84,10 +84,14 @@ export default function Header({
<LanguageMenu />
</Box>
</Suspense>

<Box className="header-text">
{totalTours > 0 && (
<Typography variant="h1" sx={{ height: "162px" }}>
{totalTours.toLocaleString()}{" "}
{totalToursFromCity === 0
? totalTours.toLocaleString()
: totalToursFromCity.toLocaleString()}
{" "}
{t(
totalToursFromCity === 0
? "start.tourenanzahl_untertitel"
Expand All @@ -97,6 +101,7 @@ export default function Header({
</Typography>
)}
</Box>

{allCities.length > 0 && (
<Suspense fallback={<></>}>
<Box
Expand Down
1 change: 0 additions & 1 deletion src/views/Start/Start.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ function Start({
loadTour(tour.id, city).then((tourExtracted) => {
if (tourExtracted?.data?.tour) {
localStorage.setItem("tourId", tour.id);
// window.open("/tour?" + searchParams.toString(),"_blank","noreferrer");// removed to use <a> tags
} else {
window.location.reload();
}
Expand Down

0 comments on commit 12a5365

Please sign in to comment.