diff --git a/package.json b/package.json index f02fe73e..06793b12 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "url": "https://github.com/bahnzumberg/zuugle-suchseite/issues/", "email": "test@zuugle.at" }, - "version": "2.0.0", + "version": "2.0.1", "private": true, "dependencies": { "@alwaysmeticulous/recorder-loader": "^2.79.0", @@ -38,6 +38,7 @@ "lodash": "^4.17.21", "moment": "^2.29.1", "react": "^18.2.0", + "react-cache-buster": "^0.1.8", "react-dom": "^18.2.0", "react-file-download": "^0.3.5", "react-full-screen": "^1.1.0", @@ -62,8 +63,10 @@ "@types/react": "^18.0.0" }, "scripts": { + "generate-meta-tag": "node ./node_modules/react-cache-buster/dist/generate-meta-tag.js", "start": "webpack serve --mode development --port 3000 --open --hot --progress --host localhost --static .", - "build": "webpack --config webpack.config_prod.js", + "build": "npm run generate-meta-tag && npm run build-app", + "build-app": "webpack --config webpack.config_prod.js", "test": "react-scripts test", "eject": "react-scripts eject" }, diff --git a/server/server.js b/server/server.js index 7c70687c..4136512c 100644 --- a/server/server.js +++ b/server/server.js @@ -8,7 +8,9 @@ const app = express(); app.set('trust proxy', 1 /* number of proxies between user and server */) app.get('/ip', (request, response) => { - console.log("L11 Server.js request.ip: ", request.ip); + if(process.env.NODE_ENV != "production"){ + console.log("L11 Server.js request.ip: ", request.ip); + } response.send(request.ip) }) diff --git a/src/App.js b/src/App.js index 9bbab1ce..1570a3ce 100644 --- a/src/App.js +++ b/src/App.js @@ -9,18 +9,28 @@ import { lazy, Suspense } from "react"; import CircularProgress from "@mui/material/CircularProgress"; import DetailReworked from "./views/Main/DetailReworked"; import Search from "./components/Search/Search"; +import i18next from "i18next"; +import { getTopLevelDomain } from "./utils/globals"; +import CacheBuster, { useCacheBuster } from 'react-cache-buster'; +import packageJson from '../package.json'; +import LoadingVersionCheck from "./components/Loading/LoadingVersionCheck.jsx"; +const { version } = packageJson; + const Main = lazy(() => import("./views/Main/Main")); const About = lazy(() => import("./views/Pages/About")); const Impressum = lazy(() => import("./views/Pages/Impressum")); const Privacy = lazy(() => import("./views/Pages/Privacy")); // import { tryLoadAndStartRecorder } from '@alwaysmeticulous/recorder-loader'; -import i18next from "i18next"; -import { getTopLevelDomain } from "./utils/globals"; function App() { + const isProduction = process.env.NODE_ENV === 'production'; + console.log("FROM APP.JS: ", isProduction) + const { checkCacheStatus } = useCacheBuster(); + + //check if first visit and change code to domain language if(!localStorage.getItem('visited')) { @@ -54,11 +64,19 @@ if(!localStorage.getItem('visited')) { g.async=true; g.src='https://stats.bahnzumberg.at/js/container_ANAXmMKf.js'; s.parentNode.insertBefore(g,s); let language = i18next.resolvedLanguage; _mtm.push({'language': language}); - }, []); + }); return ( + <> + +
+ + + ); } diff --git a/src/actions/crudActions.js b/src/actions/crudActions.js index 5575aaa3..7aee3411 100644 --- a/src/actions/crudActions.js +++ b/src/actions/crudActions.js @@ -257,11 +257,15 @@ export function generateShareLink(provider, hashedUrl, date, city) { city: city, }) .then((res) => { - console.log("L281 crudActions / generateShareLink res.data :", res.data); + if(process.env.NODE_ENV != "production"){ + console.log("L281 crudActions / generateShareLink res.data :", res.data); + } return res.data; }) .catch((err) => { - console.log("L285 crudActions / generateShareLink err.response.data :", err.response); + if(process.env.NODE_ENV != "production"){ + console.log("L285 crudActions / generateShareLink err.response.data :", err.response); + } return err.response; }); } diff --git a/src/actions/tourActions.js b/src/actions/tourActions.js index 91f36876..ea66aa47 100644 --- a/src/actions/tourActions.js +++ b/src/actions/tourActions.js @@ -182,7 +182,9 @@ export const loadTourPdf = (data) => async (dispatch, getState) => { ); return response; } catch (error) { - console.log("L94, tourActions Error: " + error.message); + if(process.env.NODE_ENV != "production"){ + console.log("L94, tourActions Error: " + error.message); + } throw error; } }; diff --git a/src/components/Filter/Filter.js b/src/components/Filter/Filter.js index 090f6039..6dfb7c80 100644 --- a/src/components/Filter/Filter.js +++ b/src/components/Filter/Filter.js @@ -286,7 +286,9 @@ function Filter({filter, doSubmit, resetFilter, searchParams, loadFilter, isLoad const submit = () => { - console.log("L288 traverse value : ", traverse) + if(process.env.NODE_ENV != "production"){ + console.log("L288 traverse value : ", traverse) + } const filterValues = { //coordinates: coordinates, //Füg den Wert in die URL ein coordinatesSouthWest: coordinatesSouthWest, diff --git a/src/components/Loading/LoadingVersionCheck.jsx b/src/components/Loading/LoadingVersionCheck.jsx new file mode 100644 index 00000000..7cbde264 --- /dev/null +++ b/src/components/Loading/LoadingVersionCheck.jsx @@ -0,0 +1,9 @@ +import React from 'react' + +function LoadingVersionCheck() { + return ( +
version check in progress ...
+ ) +} + +export default LoadingVersionCheck \ No newline at end of file diff --git a/src/components/Search/Search.js b/src/components/Search/Search.js index 827040b5..5677aacb 100644 --- a/src/components/Search/Search.js +++ b/src/components/Search/Search.js @@ -123,15 +123,16 @@ export function Search({ } } } + //setting searchPhrase to the value of the search parameter if (!!range) { setSearchPhrase(range); setRegion({ value: range, label: range, type: "range" }); } - if (!!search) { + else if (!!search) { setSearchPhrase(search); - if (!city && !search.includes(' ')) { + if (city === null && !search.includes(' ')) { // If a search phrase is given and city is empty and the search term consists only of one word, // we have to check, if the search term is a valid city_slug.If yes, we will store the search term as city. cityEntry = allCities.find((e) => e.value == search.toLowerCase()); // find the city object in array "allCities" @@ -143,18 +144,18 @@ export function Search({ } } } - // state might be useful for future enhancement or new feature related to Klimaticket - if (!!state) { + else if (!!state) { + // state might be useful for future enhancement or new feature related to Klimaticket setSearchPhrase(state); setRegion({ value: state, label: state, type: "state" }); } - // country might be useful for future enhancement or new feature related to Klimaticket - if (!!country) { + else if (!!country) { + // country might be useful for future enhancement or new feature related to Klimaticket setSearchPhrase(country); setRegion({ value: country, label: country, type: "country" }); } - // type might be useful for future enhancement or new feature related to Klimaticket - if (!!type) { + else if (!!type) { + // type might be useful for future enhancement or new feature related to Klimaticket setSearchPhrase(type); setRegion({ value: type, label: type, type: "type" }); } diff --git a/src/components/TourCardContainer.js b/src/components/TourCardContainer.js index dc2c8641..01b26153 100644 --- a/src/components/TourCardContainer.js +++ b/src/components/TourCardContainer.js @@ -41,8 +41,10 @@ export default function TourCardContainer({ const _loadTours = async () => { + if(process.env.NODE_ENV != "production"){ console.log("L67 ====////// filterValues :", filterValues); console.log("L68 ====////// filterValues :", _filter); + } let city = searchParams.get("city"); let range = searchParams.get("range"); let state = searchParams.get("state"); @@ -71,7 +73,9 @@ export default function TourCardContainer({ provider: provider, page: !!pageTours ? Number(pageTours) + 1 : 2, }).then((res) => { - console.log("L116 >>>> results :",(res)); + if(process.env.NODE_ENV != "production"){ + console.log("L116 >>>> results :",(res)); + } let retrievedTours = res.data.tours; if (retrievedTours.length === 0 || retrievedTours.length < 9) { setHasMore(false); diff --git a/src/utils/globals.js b/src/utils/globals.js index 59bd8f15..1cecfd68 100644 --- a/src/utils/globals.js +++ b/src/utils/globals.js @@ -266,7 +266,9 @@ export const countFilterActive = (searchParams, filter) => { count++; } } - console.log("L267 : FINAL count :",count) + if(process.env.NODE_ENV != "production"){ + console.log("L267 : FINAL count :",count) + } return count; }; diff --git a/src/views/Main/DetailReworked.js b/src/views/Main/DetailReworked.js index 16a34f51..1d9250a6 100644 --- a/src/views/Main/DetailReworked.js +++ b/src/views/Main/DetailReworked.js @@ -149,7 +149,9 @@ useEffect(() => { axios.get(`tours/provider/${tour.provider}`) .then((response) => { if (response.status === 200) { - console.log("L158 : first response.data", response.data) + if(process.env.NODE_ENV != "production"){ + console.log("L158 : first response.data", response.data) + } return response.data; } throw new Error("Network response was not ok."); @@ -164,7 +166,9 @@ useEffect(() => { console.error("Error fetching provider permit status:", error); }); } - console.log("L172 : providerPermit", providerPermit) + if(process.env.NODE_ENV != "production"){ + console.log("L172 : providerPermit", providerPermit) + } }, [tour]); @@ -506,10 +510,6 @@ useEffect(() => { - {/* - Specific social media buttons */} - {(socialMediaDropDownToggle && console.log("L537 socialMediaDropDownToggle :", socialMediaDropDownToggle)) } - {(!!shareLink ? console.log("L538 shareLink :", shareLink != null) : console.log("Falsy shareLink"))} {socialMediaDropDownToggle && shareLink !== null && (
- {/* clg */} - {/*{console.log("directLink L 230:",directLink) }*/}{" "} - {/* {console.log("L280: Main / counter :", counter)} */} - {/* {getPageHeader(directLink)} */} - {/* {getPageHeader({ header: `Zuugle ${t(`${cityLabel}`)}` })} */} - {/* {getPageHeader({ header: `Zuugle ${t(`${getCityLabel(location, allCities)}`)}` })} */} - - + {!!directLink && ( =15.7.2: version "15.8.1" resolved "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz" integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== @@ -9131,6 +9136,13 @@ react-app-polyfill@^3.0.0: regenerator-runtime "^0.13.9" whatwg-fetch "^3.6.2" +react-cache-buster@^0.1.8: + version "0.1.8" + resolved "https://registry.npmjs.org/react-cache-buster/-/react-cache-buster-0.1.8.tgz" + integrity sha512-N7BMnz2MUC++oXUzcYXsGn0WsIBDe5rRyT8W6O7L32CjcbgnuxhxNjc9T+Y56zdlSdY5nde3PTmZSktFv3V9IQ== + dependencies: + compare-versions "^4.1.2" + react-dev-utils@^12.0.1: version "12.0.1" resolved "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz" @@ -9414,7 +9426,7 @@ react-transition-group@^4.3.0, react-transition-group@^4.4.5: loose-envify "^1.4.0" prop-types "^15.6.2" -"react@^16.3.0 || ^17 || ^18", "react@^16.3.0 || ^17.0.0 || ^18.0.0", "react@^16.6.0 || ^17.0.0 || ^18.0.0", "react@^16.8 || ^17.0 || ^18.0", "react@^16.8.0 || ^17.0.0 || ^18.0.0", "react@^17.0.0 || ^18.0.0", react@^18.0.0, react@^18.2.0, "react@>= 16", "react@>= 16.8.0", react@>=16.0.0, react@>=16.12.0, react@>=16.3.0, react@>=16.6.0, react@>=16.8, react@>=16.8.0: +"react@^16.3.0 || ^17 || ^18", "react@^16.3.0 || ^17.0.0 || ^18.0.0", "react@^16.6.0 || ^17.0.0 || ^18.0.0", "react@^16.8 || ^17.0 || ^18.0", "react@^16.8.0 || ^17.0.0 || ^18.0.0", "react@^17.0.0 || ^18.0.0", react@^18.0.0, react@^18.2.0, "react@>= 16", "react@>= 16.8.0", react@>=16.0.0, react@>=16.12.0, react@>=16.3.0, react@>=16.6.0, react@>=16.8, react@>=16.8.0, react@>=17.0.2: version "18.2.0" resolved "https://registry.npmjs.org/react/-/react-18.2.0.tgz" integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==