Skip to content

Commit

Permalink
Merge branch 'uat' into shiv
Browse files Browse the repository at this point in the history
  • Loading branch information
shivky1992 authored Sep 11, 2024
2 parents 83ce4a6 + bddd1bc commit 055a4a6
Show file tree
Hide file tree
Showing 8 changed files with 219 additions and 107 deletions.
230 changes: 183 additions & 47 deletions package-lock.json

Large diffs are not rendered by default.

25 changes: 1 addition & 24 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,5 @@ app.use((req, res, next) => {
});

app.get([ '/*' ], function(req, res) {
var host = req.get('host');

if(host.indexOf('zuugle.si') >= 0) {
res.sendFile(path.join(__dirname, '../app/index-si.html'));
}
else if(host.indexOf('zuugle.it') >= 0) {
res.sendFile(path.join(__dirname, '../app/index-it.html'));
}
else if(host.indexOf('zuugle.fr') >= 0) {
res.sendFile(path.join(__dirname, '../app/index-fr.html'));
}
else if(host.indexOf('zuugle.de') >= 0) {
res.sendFile(path.join(__dirname, '../app/index-de.html'));
}
else if(host.indexOf('zuugle.ch') >= 0) {
res.sendFile(path.join(__dirname, '../app/index-ch.html'));
}
else if(host.indexOf('zuugle.li') >= 0) {
res.sendFile(path.join(__dirname, '../app/index-li.html'));
}
else {
res.sendFile(path.join(__dirname, '../app/index.html'));
}

res.sendFile(path.join(__dirname, '../app/index.html'));
});
3 changes: 2 additions & 1 deletion src/components/Search/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,15 @@ export function Search({
// 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.
let cityEntry = allCities.find(
(e) => e.value === search.toLowerCase().replace("ü", "ue")
(e) => e.value === search.toLowerCase().replace("ü", "ue").replace("ö", "oe").replace("ä", "ae")
); // find the city object in array "allCities"
if (!!cityEntry) {
setCityInput(cityEntry.label); // set the state "cityInput" to this city LABEL / string value
setCity(cityEntry);
writeCityToLocalStorage(search.toLowerCase());
searchParams.set("city", search.toLowerCase());
setSearchParams(searchParams);
setSearchPhrase("");
}
}
} else if (!!country) {
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import App from "./App";
import "./index.css";
import rootReducer from "./rootReducer";
import "./translations/i18n";
import { getTLD } from "./utils/globals";
import { getTLD, isMobileDevice } from "./utils/globals";

const isDevelopment = process.env.NODE_ENV === "development";

Expand All @@ -32,6 +32,7 @@ if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
document.head.appendChild(msViewportStyle);
}


function isMobileDevice() {
return /Mobi|Android|iPhone|iPad|Windows Phone|BlackBerry|Opera Mini|IEMobile/i.test(
navigator.userAgent
Expand Down
6 changes: 6 additions & 0 deletions src/utils/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ export const getDomainText = () => {
}


export const isMobileDevice = () => {
return /Mobi|Android|iPhone|iPad|Windows Phone|BlackBerry|Opera Mini|IEMobile/i.test(
navigator.userAgent
);
}

export const get_meta_data = (page) => {
const { t } = useTranslation();

Expand Down
28 changes: 15 additions & 13 deletions src/views/Main/DetailReworked.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,16 @@ const DetailReworked = (props) => {
setCityI(_city);
}, [_city]);

const goToStartPage = () => {
let city = searchParams.get("city");
navigate(`/?${!!city ? "city=" + city : ""}`);
};

const goToStartPageUnavailableTour = () => {
navigate(`/?${searchParams.toString()}`);
window.location.reload();
// const goToStartPage = () => {
// let city = searchParams.get("city");
// navigate(`/?${!!city ? "city=" + city : ""}`);
// };

const goToSearchPage = () => {
!!cityOne && (cityOne !== "no-city") ?
navigate(`/search?city=${cityOne}`)
:
navigate(`/search`);
};

const LoadingSpinner = () => (
Expand Down Expand Up @@ -221,7 +223,6 @@ const DetailReworked = (props) => {
loadTour(tourId, _city)
.then((tourExtracted) => {
if (tourExtracted && tourExtracted.data && tourExtracted.data.tour) {
setIsTourLoading(false);
setTourDifficulty(
!!tourExtracted.data.tour.difficulty &&
tourExtracted.data.tour.difficulty
Expand All @@ -232,14 +233,16 @@ const DetailReworked = (props) => {
}
})
.catch((error) => {
setIsTourLoading(false);
console.error("Tour not found:", error);
if (error.response && error.response.status === 404) {
console.error("Tour not found:", error);
goToStartPageUnavailableTour();
goToSearchPage();
} else {
console.error("Other error:", error);
}
})
.finally(() => {
setIsTourLoading(false);
});
}

Expand Down Expand Up @@ -301,7 +304,7 @@ const DetailReworked = (props) => {
);
setDateIndex(index);
} else {
goToStartPage();
goToSearchPage();
}
}

Expand Down Expand Up @@ -359,7 +362,6 @@ const DetailReworked = (props) => {

const downloadButtonsDisabled = () => {
return (
// !!!validTour ||
!!!tour ||
!!!tour.gpx_file ||
!!!activeConnection ||
Expand Down
7 changes: 4 additions & 3 deletions src/views/Start/BackgroundImageLoader.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { Box } from "@mui/material";
import React from "react";
import { useResponsive } from "../../utils/globals";
import { isMobileDevice } from "../../utils/globals";

const LINEAR_GRADIENT =
"linear-gradient(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.45)), ";

const BackgroundImageLoader = ({ tld, sx, children }) => {
const _isMobile = useResponsive();
// const _isMobile = useResponsive();

const backgroundImage = _isMobile
// const backgroundImage = _isMobile
const backgroundImage = isMobileDevice()
? `${LINEAR_GRADIENT} url(/app_static/img/background_start_mobil_${tld}.webp)`
: `${LINEAR_GRADIENT} url(/app_static/img/background_start_small_${tld}.webp)`;

Expand Down
24 changes: 6 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1731,18 +1731,6 @@
"@types/yargs" "^17.0.8"
chalk "^4.0.0"

"@jonkoops/matomo-tracker-react@^0.7.0":
version "0.7.0"
resolved "https://registry.npmjs.org/@jonkoops/matomo-tracker-react/-/matomo-tracker-react-0.7.0.tgz"
integrity sha512-3iwG/QM1T6KokU/NZNCkhOccIkhaNnO1+0bTv2JsLbsS7u7hWxpio20gfBjCRd/9N1AMiGidvytG2FK9tu7WFw==
dependencies:
"@jonkoops/matomo-tracker" "^0.7.0"

"@jonkoops/matomo-tracker@^0.7.0":
version "0.7.0"
resolved "https://registry.npmjs.org/@jonkoops/matomo-tracker/-/matomo-tracker-0.7.0.tgz"
integrity sha512-ppCXiDaVytTQOP6hNZIBwjUph5IrGgDoQw4IF5sBoA3PBpMAc5tWtPExbVWTR5pJWpTcp11dv2M83n9pm7LpeQ==

"@jridgewell/gen-mapping@^0.3.2", "@jridgewell/gen-mapping@^0.3.5":
version "0.3.5"
resolved "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz"
Expand Down Expand Up @@ -4473,6 +4461,11 @@ data-view-byte-offset@^1.0.0:
es-errors "^1.3.0"
is-data-view "^1.0.1"

dayjs@^1.10.7, dayjs@^1.11.13:
version "1.11.13"
resolved "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz"
integrity sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==

debug@^2.1.3:
version "2.6.9"
resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz"
Expand Down Expand Up @@ -7949,7 +7942,7 @@ mkdirp@~0.5.1:
dependencies:
minimist "^1.2.6"

moment@^2.29.1, moment@^2.29.4:
moment@^2.29.4:
version "2.30.1"
resolved "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz"
integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==
Expand Down Expand Up @@ -11222,11 +11215,6 @@ wbuf@^1.1.0, wbuf@^1.7.3:
dependencies:
minimalistic-assert "^1.0.0"

web-vitals@^3.3.0:
version "3.5.2"
resolved "https://registry.npmjs.org/web-vitals/-/web-vitals-3.5.2.tgz"
integrity sha512-c0rhqNcHXRkY/ogGDJQxZ9Im9D19hDihbzSQJrsioex+KnFgmMzBiy57Z1EjkhX/+OjyBpclDCzz2ITtjokFmg==

webidl-conversions@^3.0.0:
version "3.0.1"
resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz"
Expand Down

0 comments on commit 055a4a6

Please sign in to comment.