-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # src/index.js # src/utils/globals.js # src/views/Start/Header.js # src/views/Start/Start.js
- Loading branch information
Showing
49 changed files
with
5,897 additions
and
537 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,119 +1,97 @@ | ||
import CircularProgress from "@mui/material/CircularProgress"; | ||
import ThemeProvider from "@mui/material/styles/ThemeProvider"; | ||
import * as React from "react"; | ||
import { lazy, Suspense } from "react"; | ||
import { Navigate, Route, Routes } from "react-router-dom"; | ||
import "./App.css"; | ||
import ModalRoot from "./components/ModalRoot"; | ||
import ThemeProvider from "@mui/material/styles/ThemeProvider"; | ||
import { theme } from "./theme"; | ||
import Start from "./views/Start/Start"; | ||
import ModalRoot from "./components/ModalRoot"; | ||
import { Route, Routes, Navigate } from "react-router-dom"; | ||
import { lazy, Suspense, useCallback } from "react"; | ||
import CircularProgress from "@mui/material/CircularProgress"; | ||
// import Start from "./views/Start/Start"; | ||
// import DetailReworked from "./views/Main/DetailReworked"; | ||
// import Search from "./components/Search/Search"; | ||
import i18next from "i18next"; | ||
import { getTopLevelDomain } from "./utils/globals"; | ||
import "/src/config.js"; | ||
import '/src/config.js'; | ||
|
||
const Main = lazy(() => import("./views/Main/Main")); | ||
const Impressum = lazy(() => import("./views/Pages/Impressum")); | ||
const Privacy = lazy(() => import("./views/Pages/Privacy")); | ||
const DetailReworked = lazy(() => import("./views/Main/DetailReworked")); | ||
const Search = lazy(() => import("./components/Search/Search")); | ||
// const Start = lazy(() => import("./views/Start/Start")); | ||
const DetailReworked = lazy(() => import("./views/Main/DetailReworked")); | ||
const Search = lazy(() => import("./components/Search/Search")); | ||
const Start = lazy(() => import("./views/Start/Start")); | ||
|
||
|
||
|
||
|
||
function App() { | ||
//check if first visit and change code to domain language | ||
if (!localStorage.getItem("visited")) { | ||
let domain = getTopLevelDomain(); | ||
//check if first visit and change code to domain language | ||
if(!localStorage.getItem('visited')) { | ||
|
||
let domain = getTopLevelDomain(); | ||
|
||
//switch to domain language | ||
switch (domain) { | ||
case 'si': | ||
i18next.changeLanguage('sl'); | ||
break; | ||
case 'fr': | ||
i18next.changeLanguage('fr'); | ||
break; | ||
case 'it': | ||
i18next.changeLanguage('it'); | ||
break; | ||
default: | ||
i18next.changeLanguage('de'); | ||
break; | ||
} | ||
|
||
localStorage.setItem('visited',true); | ||
} | ||
|
||
// Matomo tracking | ||
var _mtm = window._mtm = window._mtm || []; | ||
React.useEffect(() => { | ||
_mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'}); | ||
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; | ||
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}); | ||
}); | ||
|
||
//switch to domain language | ||
switch (domain) { | ||
case "si": | ||
i18next.changeLanguage("sl"); | ||
break; | ||
case "fr": | ||
i18next.changeLanguage("fr"); | ||
break; | ||
case "it": | ||
i18next.changeLanguage("it"); | ||
break; | ||
default: | ||
i18next.changeLanguage("de"); | ||
break; | ||
} | ||
|
||
localStorage.setItem("visited", true); | ||
} | ||
|
||
// Matomo tracking | ||
var _mtm = (window._mtm = window._mtm || []); | ||
React.useEffect(() => { | ||
_mtm.push({ | ||
"mtm.startTime": new Date().getTime(), | ||
event: "mtm.Start", | ||
}); | ||
var d = document, | ||
g = d.createElement("script"), | ||
s = d.getElementsByTagName("script")[0]; | ||
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 ( | ||
<> | ||
<ThemeProvider theme={theme}> | ||
<div className="App" style={{ minHeight: '100vh', display: 'flex', flexDirection: 'column' }}> | ||
<Suspense | ||
fallback={ | ||
<div style={{ height: "100%", width: "100%", padding: "20px" }}> | ||
<CircularProgress /> | ||
</div> | ||
} | ||
> | ||
<Routes> | ||
<Route path="/" element={<Start />} /> | ||
<Route path="/total" element={<Start />} /> | ||
<Route path="/search" element={<Main />} /> | ||
<Route path="/tour/:idOne/:cityOne" element={<DetailReworked />} /> | ||
<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 />} /> | ||
<Route path="/searchPhrases" element={<Search />} /> | ||
|
||
return ( | ||
<> | ||
<ThemeProvider theme={theme}> | ||
<div | ||
className="App" | ||
style={{ | ||
minHeight: "100vh", | ||
display: "flex", | ||
flexDirection: "column", | ||
}} | ||
> | ||
<Suspense | ||
fallback={ | ||
<div | ||
style={{ | ||
height: "100%", | ||
width: "100%", | ||
padding: "20px", | ||
}} | ||
> | ||
<CircularProgress /> | ||
</div> | ||
} | ||
> | ||
<Routes> | ||
<Route path="/" element={<Start />} /> | ||
<Route path="/total" element={<Start />} /> | ||
<Route path="/search" element={<Main />} /> | ||
<Route | ||
path="/tour/:idOne/:cityOne" | ||
element={<DetailReworked />} | ||
/> | ||
<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 />} /> | ||
<Route path="/searchPhrases" element={<Search />} /> | ||
<Route path="*" element={<Navigate to="/" replace />} /> | ||
</Routes> | ||
</Suspense> | ||
</div> | ||
<ModalRoot /> | ||
</ThemeProvider> | ||
</> | ||
|
||
<Route | ||
path="*" | ||
element={<Navigate to="/" replace />} | ||
/> | ||
</Routes> | ||
</Suspense> | ||
</div> | ||
<ModalRoot /> | ||
</ThemeProvider> | ||
</> | ||
); | ||
); | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.