From 9f857402430048ac25f228f9b32564c143f1ba29 Mon Sep 17 00:00:00 2001 From: AbdulGhaffar7 <2016n6497@gmail.com> Date: Sat, 7 Oct 2023 20:25:18 +0500 Subject: [PATCH 01/80] start changes --- package.json | 1 + src/views/Start/Start.js | 90 +- yarn.lock | 14167 +++++++++++++++++++++++++++++++++++++ 3 files changed, 14216 insertions(+), 42 deletions(-) create mode 100644 yarn.lock diff --git a/package.json b/package.json index 55ac8e55..df26a75a 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "react-file-download": "^0.3.5", "react-full-screen": "^1.1.0", "react-helmet": "^6.1.0", + "react-helmet-async": "^1.3.0", "react-horizontal-scrolling-menu": "^2.8.2", "react-i18next": "^12.2.2", "react-infinite-scroll-component": "^6.1.0", diff --git a/src/views/Start/Start.js b/src/views/Start/Start.js index f0b371cb..ca15b479 100644 --- a/src/views/Start/Start.js +++ b/src/views/Start/Start.js @@ -17,7 +17,7 @@ import { useSearchParams } from "react-router-dom"; import { useNavigate } from "react-router"; import FooterLinks from "../../components/Footer/FooterLinks"; import { useTranslation } from "react-i18next"; -import Header from "./Header" +import Header from "./Header"; import { getPageHeader, listAllCityLinks, @@ -57,8 +57,8 @@ function Start({ totalProvider, loadRanges, allRanges, - noDataAvailable, - noToursAvailable, + noDataAvailable, + noToursAvailable, error, }) { // const [showMaintenance, setShowMaintenance] = useState(false); @@ -68,25 +68,24 @@ function Start({ const { t, i18n } = useTranslation(); const abortController = new AbortController(); - let searchParamCity ="" ; + let searchParamCity = ""; let city = ""; - + let _city = searchParams.get("city"); - const getCity = () => { + const getCity = () => { searchParamCity = searchParams.get("city"); city = localStorage.getItem("city"); - if(!!city) { + if (!!city) { return city; - }else { + } else { return ""; } - } + }; - useEffect(() => { // matomo - _mtm.push({'pagetitel': "Startseite"}); + _mtm.push({ pagetitel: "Startseite" }); // network request configuration const requestConfig = { params: { domain: window.location.host }, @@ -97,7 +96,10 @@ function Start({ try { await loadTotalTours(requestConfig); await loadAllCities(requestConfig); - await loadRanges({ ignore_limit: true, remove_duplicates: true }, requestConfig); + await loadRanges( + { ignore_limit: true, remove_duplicates: true }, + requestConfig + ); getCity(); if (!!city && !!!searchParamCity) { @@ -106,19 +108,21 @@ function Start({ } await loadCities({ limit: 5 }, requestConfig); - await loadFavouriteTours({ - sort: "relevanz", - limit: 10, - city: !!city ? city : undefined, - ranges: true, - provider: searchParams.get("p"), - }, requestConfig); - + await loadFavouriteTours( + { + sort: "relevanz", + limit: 10, + city: !!city ? city : undefined, + ranges: true, + provider: searchParams.get("p"), + }, + requestConfig + ); } catch (error) { - if (error.name === 'AbortError') { - console.log('Request was canceled:', error.message); + if (error.name === "AbortError") { + console.log("Request was canceled:", error.message); } else { - console.error('Error loading data:', error); + console.error("Error loading data:", error); } } }; @@ -130,8 +134,7 @@ function Start({ // Cancel any ongoing network request when the component unmounts abortController.abort(); }; - }, [totalTours]); - + }, [totalTours]); const onSelectTour = (tour) => { let currentSearchParams = new URLSearchParams(searchParams.toString()); @@ -144,17 +147,16 @@ function Start({ updatedSearchParams.set("city", city); } //console.log(`"Start page ..route :`);// '/tour?id=18117&city=bad-ischl' - window.open("/tour?" + updatedSearchParams.toString(),'_blank', 'noreferrer'); + window.open( + "/tour?" + updatedSearchParams.toString(), + "_blank", + "noreferrer" + ); }; - const onSelectRange = (range) => { if (!!range && !!range.range) { - navigate( - `/suche?range=${range.range}${ - !!_city ? "&city=" + _city : "" - }` - ); + navigate(`/suche?range=${range.range}${!!_city ? "&city=" + _city : ""}`); } }; @@ -176,9 +178,11 @@ function Start({ // console.log(" L198 noToursAvailable :", noToursAvailable); - if (noToursAvailable ) { - - console.log(" L203 inside the true option/ noToursAvailable :", noToursAvailable); + if (noToursAvailable) { + console.log( + " L203 inside the true option/ noToursAvailable :", + noToursAvailable + ); console.log(" L203 inside the true option/ totalTours :", totalTours); return ( @@ -186,16 +190,18 @@ function Start({