Skip to content

Commit

Permalink
Merge branch 'uat'
Browse files Browse the repository at this point in the history
# Conflicts:
#	yarn.lock
  • Loading branch information
martinheppner committed Dec 24, 2023
2 parents e761468 + bd42b36 commit ca673c9
Show file tree
Hide file tree
Showing 78 changed files with 7,655 additions and 12,186 deletions.
67 changes: 0 additions & 67 deletions InfiniteScroll_example.js

This file was deleted.

18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,26 @@
"version": "2.0.0",
"private": true,
"dependencies": {
"@alwaysmeticulous/recorder-loader": "^2.76.0",
"@alwaysmeticulous/recorder-loader": "^2.79.0",
"@babel/polyfill": "^7.12.1",
"@babel/traverse": "^7.23.2",
"@emotion/react": "^11.8.1",
"@emotion/styled": "^11.8.1",
"@jonkoops/matomo-tracker-react": "^0.7.0",
"@mui/icons-material": "^5.4.2",
"@mui/icons-material": "^5.14.15",
"@mui/lab": "^5.0.0-alpha.71",
"@mui/material": "^5.4.3",
"@mui/x-date-pickers": "^5.0.20",
"@mui/x-date-pickers": "^6.17.0",
"@react-leaflet/core": "^2.1.0",
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3",
"again": "0.0.1",
"ajv": "^8.12.0",
"axios": "^1.3.4",
"axios": "^1.6.2",
"buffer": "^6.0.3",
"downshift": "^7.6.0",
"downshift": "^8.2.2",
"express-rate-limit": "^7.1.4",
"fast-memoize": "^2.5.2",
"gpxparser": "^3.0.0",
"history": "^5.3.0",
Expand All @@ -47,7 +49,7 @@
"react-leaflet": "^4.2.1",
"react-leaflet-cluster": "^2.1.0",
"react-redux": "^8.0.5",
"react-router-dom": "^6.2.2",
"react-router-dom": "^6.18.0",
"react-select": "^5.2.2",
"react-share": "^4.4.1",
"redux": "^4.1.2",
Expand Down Expand Up @@ -75,7 +77,7 @@
"@babel/core": "^7.13.10",
"@babel/preset-env": "^7.13.10",
"@babel/preset-react": "^7.16.7",
"@svgr/plugin-svgo": "^7.0.0",
"@svgr/plugin-svgo": "^8.1.0",
"@svgr/webpack": "^7.0.0",
"babel-loader": "^9.1.2",
"copy-webpack-plugin": "^11.0.0",
Expand All @@ -84,7 +86,7 @@
"html-loader": "^4.2.0",
"html-webpack-plugin": "^5.5.0",
"mini-css-extract-plugin": "^2.6.0",
"react-scripts": "^2.1.3",
"react-scripts": "^5.0.1",
"react-svg-loader": "^3.0.0",
"source-map-loader": "^4.0.1",
"style-loader": "^3.3.2",
Expand Down
221 changes: 220 additions & 1 deletion public/i18n/de.json

Large diffs are not rendered by default.

221 changes: 220 additions & 1 deletion public/i18n/en.json

Large diffs are not rendered by default.

221 changes: 220 additions & 1 deletion public/i18n/fr.json

Large diffs are not rendered by default.

221 changes: 220 additions & 1 deletion public/i18n/it.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/i18n/sl.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"dependencies": {
"compression": "^1.7.4",
"express": "^4.14.0",
"express-rate-limit": "^7.1.4",
"http-proxy-middleware": "^2.0.6",
"path": "^0.12.7"
}
},
"type": "module"
}
20 changes: 20 additions & 0 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,26 @@ var express = require('express'),
var port = 4000;
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);
response.send(request.ip)
})


import { rateLimit } from 'express-rate-limit'; // added "type": "module" in package.json

const limiter = rateLimit({
windowMs: 1 * 60 * 1000, // 15 minutes
limit: 1, // Limit each IP to 100 requests per `window` (here, per 15 minutes).
standardHeaders: 'draft-7', // draft-6: `RateLimit-*` headers; draft-7: combined `RateLimit` header
legacyHeaders: false, // Disable the `X-RateLimit-*` headers.
// store: ... , // Use an external store for consistency across multiple server instances.
})

// Apply the rate limiting middleware to all requests.
app.use(limiter)

app.use(compression());

app.listen(port);
Expand Down
6 changes: 4 additions & 2 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,13 @@ body ::-webkit-scrollbar-thumb:hover {

.search-bar--city {
color: #8b8b8b !important;
width: 100%;
}

.search-bar--searchPhase {
color: #070000 !important;
font-weight: 600;
width: 100%;
}

.search-bar--city::first-letter {
Expand Down Expand Up @@ -388,10 +390,10 @@ body ::-webkit-scrollbar-thumb:hover {
text-align: left;
padding-left: 20px;
padding-right: 20px;
border-bottom: 1px solid #ececec;
/* border-bottom: 1px solid #ececec; */
padding-bottom: 20px;
padding-top: 20px;
background-color: #fff;
background-color: #4992ff;
}

@media only screen and (max-width: 600px) {
Expand Down
13 changes: 5 additions & 8 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ 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 { tryLoadAndStartRecorder } from '@alwaysmeticulous/recorder-loader';
import i18next from "i18next";
import { getTopLevelDomain } from "./utils/globals";

Expand All @@ -22,11 +22,11 @@ import { getTopLevelDomain } from "./utils/globals";

function App() {

//check if first visit and change code to domain language
//check if first visit and change code to domain language
if(!localStorage.getItem('visited')) {
// get the domain
// let domain = 'fr';

let domain = getTopLevelDomain();

//switch to domain language
switch (domain) {
case 'si':
Expand All @@ -45,10 +45,6 @@ if(!localStorage.getItem('visited')) {

localStorage.setItem('visited',true);
}
// UAT and local development should use matomo test instance
if (location.hostname.indexOf("localhost") !== -1 || location.hostname.indexOf("www2.") !== -1) {
tryLoadAndStartRecorder({ projectId: '0HjVPphxK3XDsQ4ka8QMwfxlMW204RtKu2bL92KO', isProduction: false, });
}

// Matomo tracking
var _mtm = window._mtm = window._mtm || [];
Expand Down Expand Up @@ -78,6 +74,7 @@ if(!localStorage.getItem('visited')) {
<Route path="/suche" element={<Main />} />
<Route path="/about" element={<About />} />
<Route path="/tour" element={<DetailReworked />} />
<Route path="/provider/:provider" element={<DetailReworked />} />
<Route path="/imprint" element={<Impressum />} />
<Route path="/privacy" element={<Privacy />} />
<Route path="/:city" element={<Main />} />
Expand Down
8 changes: 0 additions & 8 deletions src/actions/cityActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,3 @@ export function loadAllCities(data = {all: true}) {
};
}

//Code description:
// This code defines two functions, loadCities and loadAllCities, that are used to load data from an API endpoint. The code makes use of two other functions, dispatch and getState, that are part of the Redux framework, a popular state management library for React applications.

// The loadCities function takes an optional data parameter, which is an object that can be used to specify filter conditions for the API request. The function creates a new object, data, which includes a property domain that is set to the host name of the current location. This new object is then passed to loadList, which is a utility function that dispatches actions and makes the API request.

// The loadAllCities function works in the same way as loadCities, but sets the data object to include a property all with a value of true.

// Both functions return the result of calling loadList with specific arguments, including the action types to dispatch, the endpoint to send the request to, and the property of the state object to store the response data in.
39 changes: 13 additions & 26 deletions src/actions/crudActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,14 @@ export async function loadFile(
params: params,
timeout: 60000,
headers: {
Authorization: "FV69pR5PQQLcQ4wuMtTSqKqyYqf5XEK4",
"authorization": "FV69pR5PQQLcQ4wuMtTSqKqyYqf5XEK4",
},
});

dispatch({
type: typeDone,
});

//clgs
// console.log("L34 crudActions /getFileFromServer res :", res)
// console.log("L39 crudActions /getFileFromServer res.request.responseURL :", res.request.responseURL)
return res;
} catch (error) {
console.log(" error :, L39", error.message);
Expand All @@ -67,26 +64,19 @@ export function loadList(
useState = true,
language
) {
//clg
// console.log(`dispatch: packageFcn, getState: packageFcn, typeBefore: ${typeBefore}, typeDone:${typeDone}, stateName: ${stateName}, data: ${JSON.stringify(data)}, route: ${route}, entityName: ${entityName}, usePagination: ${usePagination},useState: ${useState}, language: ${language}`)

// language && console.log("language: " + language)
// language && console.log("data: " + JSON.stringify(data));
// console.log("Type is LOAD_TOURS ? : ", typeBefore == 'LOAD_TOURS')
// console.log("Type is LOAD_TOUR_CONNECTIONS ? : ", typeBefore == 'LOAD_TOUR_CONNECTIONS')
//initialize language param

// initialize language param
const langPassed =
language &&
(typeBefore == "LOAD_TOURS" || typeBefore == "LOAD_TOUR_CONNECTIONS")
? language
: "de";

// langPassed && console.log("passed language : " + langPassed)

if (!!useState) {
dispatch({ ...data, type: typeBefore });
}
const state = getState()[stateName];

let params = {};
if (state) {
let pagination = {};
Expand All @@ -96,22 +86,22 @@ export function loadList(
pagination.order_id = state.orderId;
pagination.order_desc = state.orderDesc;
}
// console.log("data: inside if(state) : " + JSON.stringify(data));
//console.log(" L89 data: inside if(state) : ", state.filter); // filter is passed
// now pass the filter
// data = {...data, filter: filter}
params = {
...pagination,
...data,
currLanguage: langPassed,
// filter: state.filter,
};
}

// console.log("wichtiiiig", route, { params: params });
return axios
.get(route, { params: params })
.then((res) => {
const entities = res.data[entityName];
// console.log("entities :",entities)
const total = res.data.total;
// total && total.length && console.log("total length: ", total.length);
const filter = !!res.data.filter ? res.data.filter : null;
if (!!useState) {
dispatch({
Expand All @@ -123,8 +113,6 @@ export function loadList(
ranges: res.data.ranges,
});
}
//console.log("crudActions : response ", res); // issue #9 API

return res;
})
.catch((err) => {
Expand Down Expand Up @@ -201,7 +189,6 @@ export function loadOneReturnAll(
.then((res) => {
if (!!res && !!res.data) {
const { total_tours } = res.data;
console.log("The type error");

if (total_tours === 0) {
dispatch({ type: NO_TOURS_AVAILABLE });
Expand Down Expand Up @@ -261,33 +248,33 @@ export function loadShareParams(shareId, city) {

//generateShareLink is used to generate a new sharing link to the corresponding tour on a specific date, the city is saved to later on always get connections, a shareId will be returned
export function generateShareLink(provider, hashedUrl, date, city) {
console.log("From inside generateShareLink")
return axios
.post("shares/", {
.post("/shares", {
provider: provider,
hashedUrl: hashedUrl,
date: date,
city: city,
})
.then((res) => {
console.log("L281 crudActions / generateShareLink res.data :", res.data);
return res.data;
})
.catch((err) => {
return err.response.data;
console.log("L285 crudActions / generateShareLink err.response.data :", err.response);
return err.response;
});
}

//
export const getTotalCityTours = (city) => {
// return axios.get(`tours/total/?city=${city}`, {
return axios
.get(`tours/total/`, {
params: {
city: city,
},
})
.then((res) => {
// console.log("L225 res :");
// console.log(res);
return res.data;
});
};
Loading

0 comments on commit ca673c9

Please sign in to comment.