diff --git a/.github/workflows/new_release.yml b/.github/workflows/new_release.yml
index 031fab8..4f8e131 100644
--- a/.github/workflows/new_release.yml
+++ b/.github/workflows/new_release.yml
@@ -5,6 +5,8 @@ name: New Release
on:
push:
+ branches:
+ - "main"
tags:
- v*.*.*
@@ -88,10 +90,6 @@ jobs:
ls -la
ls -la www
- - name: Add CNAME
- run: |
- echo "know-where-you-go.de" > CNAME
-
- name: Deploy 🚀
uses: crazy-max/ghaction-github-pages@v3
with:
diff --git a/design/Jost.zip b/design/Jost.zip
deleted file mode 100644
index 1ac9aec..0000000
Binary files a/design/Jost.zip and /dev/null differ
diff --git a/design/kwyg-logo-background.svg b/design/kwyg-logo-background.svg
deleted file mode 100644
index fec03c7..0000000
--- a/design/kwyg-logo-background.svg
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
diff --git a/design/kwyg-logo-exports.svg b/design/kwyg-logo-exports.svg
deleted file mode 100644
index 0e86269..0000000
--- a/design/kwyg-logo-exports.svg
+++ /dev/null
@@ -1,3601 +0,0 @@
-
-
-
-
diff --git a/design/old/kwyg-logo.svg b/design/old/kwyg-logo.svg
deleted file mode 100644
index dae1010..0000000
--- a/design/old/kwyg-logo.svg
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
diff --git a/design/old/kwyg-white.svg b/design/old/kwyg-white.svg
deleted file mode 100644
index 7999623..0000000
--- a/design/old/kwyg-white.svg
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
diff --git a/design/old/logo-color.png b/design/old/logo-color.png
deleted file mode 100644
index 8a3fec5..0000000
Binary files a/design/old/logo-color.png and /dev/null differ
diff --git a/design/old/logo-color.svg b/design/old/logo-color.svg
deleted file mode 100644
index eeac5ba..0000000
--- a/design/old/logo-color.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/design/old/logo-color.svg.2022_11_17_11_04_21.0.svg b/design/old/logo-color.svg.2022_11_17_11_04_21.0.svg
deleted file mode 100644
index 173985d..0000000
--- a/design/old/logo-color.svg.2022_11_17_11_04_21.0.svg
+++ /dev/null
@@ -1,190 +0,0 @@
-
-
-
-
-
-
-
-
- KNOW WHERE YOU GO
- Location Based Service
-
-
-
- KNOW WHERE YOU GO
- Location Based Service
-
-
-
- KNOW WHERE YOU GO
- Location Based Service
-
-
-
- KNOW WHERE YOU GO
- Location Based Service
-
-
-
- KNOW WHERE YOU GO
- Location Based Service
-
-
-
diff --git a/design/old/logo.svg b/design/old/logo.svg
deleted file mode 100644
index 3781cc9..0000000
--- a/design/old/logo.svg
+++ /dev/null
@@ -1,97 +0,0 @@
-
-
-
-
-
-
- KNOW WHERE YOU GO
- Location Based Service
-
-
-
-
-
diff --git a/design/old/meme.html b/design/old/meme.html
deleted file mode 100644
index 4fcc5b4..0000000
--- a/design/old/meme.html
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- farbig
-
-
-
-
-
-
-
-
-
-
-
-
- KNOW WHERE YOU GO
-
-
- Location Based Service
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/design/old/original.svg b/design/old/original.svg
deleted file mode 100644
index eeac5ba..0000000
--- a/design/old/original.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 79e30b7..a40ebed 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -15,7 +15,6 @@
"framework7-icons": "^5.0.5",
"framework7-react": "^7.0.9",
"leaflet": "^1.9.3",
- "leaflet-routing-machine": "^3.2.12",
"material-icons": "^1.13.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
@@ -2182,22 +2181,6 @@
"@jridgewell/sourcemap-codec": "1.4.14"
}
},
- "node_modules/@mapbox/corslite": {
- "version": "0.0.7",
- "resolved": "https://registry.npmjs.org/@mapbox/corslite/-/corslite-0.0.7.tgz",
- "integrity": "sha512-w/uS474VFjmqQ7fFWIMZINQM1BAQxDLuoJaZZIPES1BmeYpCtlh9MtbFxKGGDAsfvut8/HircIsVvEYRjQ+iMg=="
- },
- "node_modules/@mapbox/polyline": {
- "version": "0.2.0",
- "resolved": "https://registry.npmjs.org/@mapbox/polyline/-/polyline-0.2.0.tgz",
- "integrity": "sha512-GCddO0iw6AzOQqZgBmjEQI9Pgo40/yRgkTkikGctE01kNBN0ThWYuAnTD+hRWrAWMV6QJ0rNm4m8DAsaAXE7Pg==",
- "bin": {
- "polyline": "bin/polyline.bin.js"
- },
- "engines": {
- "node": "*"
- }
- },
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -6184,16 +6167,6 @@
"resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.9.3.tgz",
"integrity": "sha512-iB2cR9vAkDOu5l3HAay2obcUHZ7xwUBBjph8+PGtmW/2lYhbLizWtG7nTeYht36WfOslixQF9D/uSIzhZgGMfQ=="
},
- "node_modules/leaflet-routing-machine": {
- "version": "3.2.12",
- "resolved": "https://registry.npmjs.org/leaflet-routing-machine/-/leaflet-routing-machine-3.2.12.tgz",
- "integrity": "sha512-HLde58G1YtD9xSIzZavJ6BPABZaV1hHeGst8ouhzuxmSC3s32NVtADT+njbIUMW1maHRCrsgTk/E4hz5QH7FrA==",
- "dependencies": {
- "@mapbox/corslite": "0.0.7",
- "@mapbox/polyline": "^0.2.0",
- "osrm-text-instructions": "^0.13.2"
- }
- },
"node_modules/leven": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz",
@@ -7201,11 +7174,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/osrm-text-instructions": {
- "version": "0.13.4",
- "resolved": "https://registry.npmjs.org/osrm-text-instructions/-/osrm-text-instructions-0.13.4.tgz",
- "integrity": "sha512-ge4ZTIetMQKAHKq2MwWf83ntzdJN20ndRKRaVNoZ3SkDkBNO99Qddz7r6+hrVx38I+ih6Rk5T1yslczAB6Q9Pg=="
- },
"node_modules/p-cancelable": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz",
diff --git a/package.json b/package.json
index f3d9486..7085956 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,6 @@
"framework7-icons": "^5.0.5",
"framework7-react": "^7.0.9",
"leaflet": "^1.9.3",
- "leaflet-routing-machine": "^3.2.12",
"material-icons": "^1.13.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
diff --git a/public/icons/128x128.png b/public/icons/128x128.png
index 0a9b16c..adbe8b4 100644
Binary files a/public/icons/128x128.png and b/public/icons/128x128.png differ
diff --git a/public/icons/144x144.png b/public/icons/144x144.png
index e817c36..e4fb430 100644
Binary files a/public/icons/144x144.png and b/public/icons/144x144.png differ
diff --git a/public/icons/152x152.png b/public/icons/152x152.png
index 0ef8eb9..d3c46c6 100644
Binary files a/public/icons/152x152.png and b/public/icons/152x152.png differ
diff --git a/public/icons/192x192.png b/public/icons/192x192.png
index ba99454..a1a3c27 100644
Binary files a/public/icons/192x192.png and b/public/icons/192x192.png differ
diff --git a/public/icons/256x256.png b/public/icons/256x256.png
index 4e350f6..c1c442c 100644
Binary files a/public/icons/256x256.png and b/public/icons/256x256.png differ
diff --git a/public/icons/512x512.png b/public/icons/512x512.png
index 9a36e6f..76adb03 100644
Binary files a/public/icons/512x512.png and b/public/icons/512x512.png differ
diff --git a/public/icons/apple-touch-icon.png b/public/icons/apple-touch-icon.png
index 4e350f6..2ad4ce1 100644
Binary files a/public/icons/apple-touch-icon.png and b/public/icons/apple-touch-icon.png differ
diff --git a/public/icons/favicon.png b/public/icons/favicon.png
index 0a9b16c..adbe8b4 100644
Binary files a/public/icons/favicon.png and b/public/icons/favicon.png differ
diff --git a/public/icons/iOS/10.2__iPad_landscape.png b/public/icons/iOS/10.2__iPad_landscape.png
deleted file mode 100644
index b9ee9d6..0000000
Binary files a/public/icons/iOS/10.2__iPad_landscape.png and /dev/null differ
diff --git a/public/icons/iOS/10.2__iPad_portrait.png b/public/icons/iOS/10.2__iPad_portrait.png
deleted file mode 100644
index 9d9f0d6..0000000
Binary files a/public/icons/iOS/10.2__iPad_portrait.png and /dev/null differ
diff --git a/public/icons/iOS/10.5__iPad_Air_landscape.png b/public/icons/iOS/10.5__iPad_Air_landscape.png
deleted file mode 100644
index 47739cb..0000000
Binary files a/public/icons/iOS/10.5__iPad_Air_landscape.png and /dev/null differ
diff --git a/public/icons/iOS/10.5__iPad_Air_portrait.png b/public/icons/iOS/10.5__iPad_Air_portrait.png
deleted file mode 100644
index 24e1889..0000000
Binary files a/public/icons/iOS/10.5__iPad_Air_portrait.png and /dev/null differ
diff --git a/public/icons/iOS/10.9__iPad_Air_landscape.png b/public/icons/iOS/10.9__iPad_Air_landscape.png
deleted file mode 100644
index 77d6609..0000000
Binary files a/public/icons/iOS/10.9__iPad_Air_landscape.png and /dev/null differ
diff --git a/public/icons/iOS/10.9__iPad_Air_portrait.png b/public/icons/iOS/10.9__iPad_Air_portrait.png
deleted file mode 100644
index cdb0934..0000000
Binary files a/public/icons/iOS/10.9__iPad_Air_portrait.png and /dev/null differ
diff --git a/public/icons/iOS/11__iPad_Pro__10.5__iPad_Pro_landscape.png b/public/icons/iOS/11__iPad_Pro__10.5__iPad_Pro_landscape.png
deleted file mode 100644
index 6cd265e..0000000
Binary files a/public/icons/iOS/11__iPad_Pro__10.5__iPad_Pro_landscape.png and /dev/null differ
diff --git a/public/icons/iOS/11__iPad_Pro__10.5__iPad_Pro_portrait.png b/public/icons/iOS/11__iPad_Pro__10.5__iPad_Pro_portrait.png
deleted file mode 100644
index 5499073..0000000
Binary files a/public/icons/iOS/11__iPad_Pro__10.5__iPad_Pro_portrait.png and /dev/null differ
diff --git a/public/icons/iOS/12.9__iPad_Pro_landscape.png b/public/icons/iOS/12.9__iPad_Pro_landscape.png
deleted file mode 100644
index 07b6cc9..0000000
Binary files a/public/icons/iOS/12.9__iPad_Pro_landscape.png and /dev/null differ
diff --git a/public/icons/iOS/12.9__iPad_Pro_portrait.png b/public/icons/iOS/12.9__iPad_Pro_portrait.png
deleted file mode 100644
index a48577b..0000000
Binary files a/public/icons/iOS/12.9__iPad_Pro_portrait.png and /dev/null differ
diff --git a/public/icons/iOS/4__iPhone_SE__iPod_touch_5th_generation_and_later_landscape.png b/public/icons/iOS/4__iPhone_SE__iPod_touch_5th_generation_and_later_landscape.png
deleted file mode 100644
index 62abbbe..0000000
Binary files a/public/icons/iOS/4__iPhone_SE__iPod_touch_5th_generation_and_later_landscape.png and /dev/null differ
diff --git a/public/icons/iOS/4__iPhone_SE__iPod_touch_5th_generation_and_later_portrait.png b/public/icons/iOS/4__iPhone_SE__iPod_touch_5th_generation_and_later_portrait.png
deleted file mode 100644
index 87bffaf..0000000
Binary files a/public/icons/iOS/4__iPhone_SE__iPod_touch_5th_generation_and_later_portrait.png and /dev/null differ
diff --git a/public/icons/iOS/8.3__iPad_Mini_landscape.png b/public/icons/iOS/8.3__iPad_Mini_landscape.png
deleted file mode 100644
index 2f4a83d..0000000
Binary files a/public/icons/iOS/8.3__iPad_Mini_landscape.png and /dev/null differ
diff --git a/public/icons/iOS/8.3__iPad_Mini_portrait.png b/public/icons/iOS/8.3__iPad_Mini_portrait.png
deleted file mode 100644
index 49eea2d..0000000
Binary files a/public/icons/iOS/8.3__iPad_Mini_portrait.png and /dev/null differ
diff --git a/public/icons/iOS/9.7__iPad_Pro__7.9__iPad_mini__9.7__iPad_Air__9.7__iPad_landscape.png b/public/icons/iOS/9.7__iPad_Pro__7.9__iPad_mini__9.7__iPad_Air__9.7__iPad_landscape.png
deleted file mode 100644
index af8fd7e..0000000
Binary files a/public/icons/iOS/9.7__iPad_Pro__7.9__iPad_mini__9.7__iPad_Air__9.7__iPad_landscape.png and /dev/null differ
diff --git a/public/icons/iOS/9.7__iPad_Pro__7.9__iPad_mini__9.7__iPad_Air__9.7__iPad_portrait.png b/public/icons/iOS/9.7__iPad_Pro__7.9__iPad_mini__9.7__iPad_Air__9.7__iPad_portrait.png
deleted file mode 100644
index c9ef8b4..0000000
Binary files a/public/icons/iOS/9.7__iPad_Pro__7.9__iPad_mini__9.7__iPad_Air__9.7__iPad_portrait.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_11_Pro_Max__iPhone_XS_Max_landscape.png b/public/icons/iOS/iPhone_11_Pro_Max__iPhone_XS_Max_landscape.png
deleted file mode 100644
index 4619b7d..0000000
Binary files a/public/icons/iOS/iPhone_11_Pro_Max__iPhone_XS_Max_landscape.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_11_Pro_Max__iPhone_XS_Max_portrait.png b/public/icons/iOS/iPhone_11_Pro_Max__iPhone_XS_Max_portrait.png
deleted file mode 100644
index 7792b99..0000000
Binary files a/public/icons/iOS/iPhone_11_Pro_Max__iPhone_XS_Max_portrait.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_11__iPhone_XR_landscape.png b/public/icons/iOS/iPhone_11__iPhone_XR_landscape.png
deleted file mode 100644
index 74cac06..0000000
Binary files a/public/icons/iOS/iPhone_11__iPhone_XR_landscape.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_11__iPhone_XR_portrait.png b/public/icons/iOS/iPhone_11__iPhone_XR_portrait.png
deleted file mode 100644
index 31547f2..0000000
Binary files a/public/icons/iOS/iPhone_11__iPhone_XR_portrait.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_13_mini__iPhone_12_mini__iPhone_11_Pro__iPhone_XS__iPhone_X_landscape.png b/public/icons/iOS/iPhone_13_mini__iPhone_12_mini__iPhone_11_Pro__iPhone_XS__iPhone_X_landscape.png
deleted file mode 100644
index e5b90e8..0000000
Binary files a/public/icons/iOS/iPhone_13_mini__iPhone_12_mini__iPhone_11_Pro__iPhone_XS__iPhone_X_landscape.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_13_mini__iPhone_12_mini__iPhone_11_Pro__iPhone_XS__iPhone_X_portrait.png b/public/icons/iOS/iPhone_13_mini__iPhone_12_mini__iPhone_11_Pro__iPhone_XS__iPhone_X_portrait.png
deleted file mode 100644
index 43c83b8..0000000
Binary files a/public/icons/iOS/iPhone_13_mini__iPhone_12_mini__iPhone_11_Pro__iPhone_XS__iPhone_X_portrait.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_14_Plus__iPhone_13_Pro_Max__iPhone_12_Pro_Max_landscape.png b/public/icons/iOS/iPhone_14_Plus__iPhone_13_Pro_Max__iPhone_12_Pro_Max_landscape.png
deleted file mode 100644
index 38c9537..0000000
Binary files a/public/icons/iOS/iPhone_14_Plus__iPhone_13_Pro_Max__iPhone_12_Pro_Max_landscape.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_14_Plus__iPhone_13_Pro_Max__iPhone_12_Pro_Max_portrait.png b/public/icons/iOS/iPhone_14_Plus__iPhone_13_Pro_Max__iPhone_12_Pro_Max_portrait.png
deleted file mode 100644
index 02e41d3..0000000
Binary files a/public/icons/iOS/iPhone_14_Plus__iPhone_13_Pro_Max__iPhone_12_Pro_Max_portrait.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_14_Pro_Max_landscape.png b/public/icons/iOS/iPhone_14_Pro_Max_landscape.png
deleted file mode 100644
index cae397d..0000000
Binary files a/public/icons/iOS/iPhone_14_Pro_Max_landscape.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_14_Pro_Max_portrait.png b/public/icons/iOS/iPhone_14_Pro_Max_portrait.png
deleted file mode 100644
index 13fb886..0000000
Binary files a/public/icons/iOS/iPhone_14_Pro_Max_portrait.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_14_Pro_landscape.png b/public/icons/iOS/iPhone_14_Pro_landscape.png
deleted file mode 100644
index 4021fbb..0000000
Binary files a/public/icons/iOS/iPhone_14_Pro_landscape.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_14_Pro_portrait.png b/public/icons/iOS/iPhone_14_Pro_portrait.png
deleted file mode 100644
index b558f9c..0000000
Binary files a/public/icons/iOS/iPhone_14_Pro_portrait.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_14__iPhone_13_Pro__iPhone_13__iPhone_12_Pro__iPhone_12_landscape.png b/public/icons/iOS/iPhone_14__iPhone_13_Pro__iPhone_13__iPhone_12_Pro__iPhone_12_landscape.png
deleted file mode 100644
index 6d05876..0000000
Binary files a/public/icons/iOS/iPhone_14__iPhone_13_Pro__iPhone_13__iPhone_12_Pro__iPhone_12_landscape.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_14__iPhone_13_Pro__iPhone_13__iPhone_12_Pro__iPhone_12_portrait.png b/public/icons/iOS/iPhone_14__iPhone_13_Pro__iPhone_13__iPhone_12_Pro__iPhone_12_portrait.png
deleted file mode 100644
index 1cbfd65..0000000
Binary files a/public/icons/iOS/iPhone_14__iPhone_13_Pro__iPhone_13__iPhone_12_Pro__iPhone_12_portrait.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_8_Plus__iPhone_7_Plus__iPhone_6s_Plus__iPhone_6_Plus_landscape.png b/public/icons/iOS/iPhone_8_Plus__iPhone_7_Plus__iPhone_6s_Plus__iPhone_6_Plus_landscape.png
deleted file mode 100644
index a3e71ec..0000000
Binary files a/public/icons/iOS/iPhone_8_Plus__iPhone_7_Plus__iPhone_6s_Plus__iPhone_6_Plus_landscape.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_8_Plus__iPhone_7_Plus__iPhone_6s_Plus__iPhone_6_Plus_portrait.png b/public/icons/iOS/iPhone_8_Plus__iPhone_7_Plus__iPhone_6s_Plus__iPhone_6_Plus_portrait.png
deleted file mode 100644
index 862fa95..0000000
Binary files a/public/icons/iOS/iPhone_8_Plus__iPhone_7_Plus__iPhone_6s_Plus__iPhone_6_Plus_portrait.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_8__iPhone_7__iPhone_6s__iPhone_6__4.7__iPhone_SE_landscape.png b/public/icons/iOS/iPhone_8__iPhone_7__iPhone_6s__iPhone_6__4.7__iPhone_SE_landscape.png
deleted file mode 100644
index f93b605..0000000
Binary files a/public/icons/iOS/iPhone_8__iPhone_7__iPhone_6s__iPhone_6__4.7__iPhone_SE_landscape.png and /dev/null differ
diff --git a/public/icons/iOS/iPhone_8__iPhone_7__iPhone_6s__iPhone_6__4.7__iPhone_SE_portrait.png b/public/icons/iOS/iPhone_8__iPhone_7__iPhone_6s__iPhone_6__4.7__iPhone_SE_portrait.png
deleted file mode 100644
index 0292610..0000000
Binary files a/public/icons/iOS/iPhone_8__iPhone_7__iPhone_6s__iPhone_6__4.7__iPhone_SE_portrait.png and /dev/null differ
diff --git a/public/icons/iOS/icon.png b/public/icons/iOS/icon.png
deleted file mode 100644
index 476c2ee..0000000
Binary files a/public/icons/iOS/icon.png and /dev/null differ
diff --git a/public/icons/maskable_icon_x1024.png b/public/icons/maskable_icon_x1024.png
deleted file mode 100644
index bf000f1..0000000
Binary files a/public/icons/maskable_icon_x1024.png and /dev/null differ
diff --git a/public/icons/maskable_icon_x512.png b/public/icons/maskable_icon_x512.png
deleted file mode 100644
index 66cb99c..0000000
Binary files a/public/icons/maskable_icon_x512.png and /dev/null differ
diff --git a/src/components/OutlinePolygon.jsx b/src/components/OutlinePolygon.jsx
index a0d6a72..3bdb6ec 100644
--- a/src/components/OutlinePolygon.jsx
+++ b/src/components/OutlinePolygon.jsx
@@ -1,6 +1,5 @@
import React from "react";
import { Polygon } from "react-leaflet";
-import MemoFetcher from "../js/memo-fetcher";
class OutlinePolygon extends React.Component {
constructor(props) {
@@ -8,7 +7,6 @@ class OutlinePolygon extends React.Component {
this.state = {
polyLatLngs: [],
};
- this.memoFetcher = new MemoFetcher();
}
async componentDidUpdate(prevProps) {
@@ -18,11 +16,12 @@ class OutlinePolygon extends React.Component {
// fetch the polygon outline from the OpenStreetMap API (Nominatim)
// this is not done in the main component because loading the polygon outline
// takes more time than the normal API call
- const data = await this.memoFetcher.fetch(
+ const response = await fetch(
// eslint-disable-next-line max-len
`https://nominatim.openstreetmap.org/search?q=${this.props.placeName}&format=json&limit=1&polygon_geojson=1&polygon_threshold=0.0005`,
);
// check if the response is suited for a polygon outline
+ const data = await response.json();
if (
data[0]?.geojson?.coordinates === undefined ||
data[0]?.geojson?.type === undefined ||
diff --git a/src/components/WikiInfo.jsx b/src/components/WikiInfo.jsx
deleted file mode 100644
index c97d512..0000000
--- a/src/components/WikiInfo.jsx
+++ /dev/null
@@ -1,230 +0,0 @@
-import { Block, BlockTitle, Icon, Link } from "framework7-react";
-import { getPlaceByNominatimData } from "../js/helpers";
-
-import React from "react";
-import MemoFetcher from "../js/memo-fetcher";
-
-class WikiInfo extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- isLoading: true,
- noInfoFound: false,
- title: "",
- description: "",
- image: "",
- noPlaceGiven: true,
- };
- this.place = props.place;
- this.memoFetcher = new MemoFetcher();
- }
-
- async componentDidUpdate(prevProps) {
- // if nothing changed do nothing
- if (
- prevProps.place.name === this.props.place.name &&
- prevProps.place.wikidata === this.props.place.wikidata &&
- prevProps.place.wikipedia === this.props.place.wikipedia &&
- prevProps.place.zoomLevel === this.props.place.zoomLevel &&
- prevProps.place.userInputCoords?.lat === this.props.place.userInputCoords?.lat &&
- prevProps.place.userInputCoords?.lng === this.props.place.userInputCoords?.lng
- ) {
- return;
- }
-
- // if no place was given show nothing
- if (
- this.props.place.name === undefined ||
- this.props.place.name === "" ||
- this.props.place.userInputCoords === undefined ||
- this.props.place.userInputCoords.lat === undefined ||
- this.props.place.userInputCoords.lng === undefined
- ) {
- this.setState({
- isLoading: false,
- noInfoFound: false,
- noPlaceGiven: true,
- });
- return;
- }
-
- // if a new place was given load the information
- this.setState({
- isLoading: true,
- noInfoFound: false,
- noPlaceGiven: false,
- });
- this.place = this.props.place;
- await this.loadWikiInfo(this.props.place.wikipedia, this.props.place.wikidata);
- }
-
- /**
- * Tries to load the wiki info by the given wikipedia tag,
- * if this fails it tries to load the info by the given wikidata id,
- * if this fails it tries to load the info by the given search text
- * It updates the state with the loaded information
- * @param {string} wikipediaTag
- * @param {string} wikidata
- * @returns {Promise}
- */
- async loadWikiInfo(wikipediaTag, wikidata) {
- if (wikipediaTag && (await this.loadWikiInfoByWikipediaTag(wikipediaTag))) {
- return;
- }
-
- if (wikidata && (await this.loadWikiInfoByWikidata(wikidata))) {
- return;
- }
-
- // this fulltextsearch is disabled because there are better results with the other methods
- // TODO: maybe enable it in the future again
- // if (searchText && (await this.loadWikiInfoBySearch(searchText))) {
- // return;
- // }
-
- // if no information was found try the next smaller zoom level
- await this.takeNextBiggerPlace();
- }
-
- /**
- * Updates the current place with the next bigger place to search for information
- * @returns {Promise}
- */
- takeNextBiggerPlace = async () => {
- const newZoomLevel = this.place.zoomLevel - 1;
-
- // if the zoom level is 0 no information was found
- if (this.place.zoomLevel === 0) {
- this.setState({
- isLoading: false,
- noInfoFound: true,
- });
- return;
- }
-
- // get the new place information
- const data = await this.memoFetcher.fetch(
- // eslint-disable-next-line max-len
- `https://nominatim.openstreetmap.org/reverse?format=json&lat=${this.place.userInputCoords.lat}&lon=${this.place.userInputCoords.lng}&extratags=1&zoom=${newZoomLevel}&addressdetails=1`,
- );
- if (data.error) {
- this.setState({
- isLoading: false,
- noInfoFound: true,
- });
- return;
- }
- const place = getPlaceByNominatimData(data, this.place.userInputCoords);
- this.setState({
- isLoading: true,
- noInfoFound: false,
- title: "",
- description: "",
- image: "",
- });
-
- // update the place information and try to load the wiki info again
- place.zoomLevel = newZoomLevel;
- this.place = place;
- await this.loadWikiInfo(place.wikipedia, place.wikidata);
- };
-
- /**
- * Calls the wikipedia api to get the information for the given wikipedia tag
- * @param {string} wikipediaTag
- * @returns Promise true if the information was found and loaded false if not
- */
- loadWikiInfoByWikipediaTag = async wikipediaTag => {
- if (wikipediaTag === undefined || wikipediaTag === "") return false;
-
- const data = await this.memoFetcher.fetch(
- // eslint-disable-next-line max-len
- `https://de.wikipedia.org/w/api.php?action=query&format=json&prop=extracts|pageimages&formatversion=2&origin=*&exintro=1&explaintext=1&exsentences=3&exlimit=1&piprop=original&titles=${wikipediaTag}`,
- );
- if (data.query.pages === undefined || data.query.pages.length === 0) {
- return false;
- }
- console.log(data.query.pages);
- this.updateInfoByWikiPage(data.query.pages[0]);
- return true;
- };
-
- /**
- * Calls the wikidata api to get the information for the given wikidata id
- * @param {string} wikidata
- * @returns Promise true if the information was found and loaded false if not
- */
- loadWikiInfoByWikidata = async wikidata => {
- if (wikidata === undefined || wikidata === "") return false;
-
- // get the wikipedia tag for the given wikidata id in the preferred language
- const preferredLanguageWiki = "dewiki";
- const data = await this.memoFetcher.fetch(
- // eslint-disable-next-line max-len
- `https://www.wikidata.org/w/api.php?action=wbgetentities&format=json&props=sitelinks&ids=${wikidata}&origin=*&sitefilter=${preferredLanguageWiki}`,
- );
- if (!data.entities[wikidata]?.sitelinks[preferredLanguageWiki]) {
- return false;
- }
-
- // load the information for the wikipedia tag
- const wikipediaTag = data.entities[wikidata].sitelinks.dewiki.title;
- return await this.loadWikiInfoByWikipediaTag(wikipediaTag);
- };
-
- /**
- * Calls the wikipedia api to get the information for the given search text
- * @param {*} searchText
- * @returns Promise true if the information was found and loaded false if not
- */
- loadWikiInfoBySearch = async searchText => {
- if (searchText === undefined || searchText === "" || searchText === "Unknown location") return false;
- const data = await this.memoFetcher.fetch(
- // eslint-disable-next-line max-len
- `https://de.wikipedia.org/w/api.php?action=query&format=json&list=search&formatversion=2&origin=*&srsearch=${searchText}`,
- );
- if (data.query?.search?.length === 0) {
- return;
- }
-
- return await this.loadWikiInfoByWikipediaTag(data.query.search[0].title);
- };
-
- /**
- * Updates the state with the information from the given wikipedia page
- * @param {*} page
- * @returns void
- */
- updateInfoByWikiPage(page) {
- this.setState({
- isLoading: false,
- noInfoFound: false,
- noPlaceGiven: false,
- title: page.title,
- description: page.extract.slice(0, 600) + (page.extract.length > 600 ? "..." : ""),
- image: page.original ? page.original.source : "",
- });
- }
-
- render() {
- if (this.state.noPlaceGiven) return null;
-
- if (this.state.isLoading) return Loading Wikipedia information...;
-
- if (this.state.noInfoFound) return No Wikipedia information found.;
-
- return (
- <>
-
-
- {this.state.title}
-
-
- {this.state.description}
- {this.state.image && }
- >
- );
- }
-}
-
-export default WikiInfo;
diff --git a/src/css/app.css b/src/css/app.css
index 3cb6563..d05bd63 100644
--- a/src/css/app.css
+++ b/src/css/app.css
@@ -1,4 +1 @@
/* Your app custom styles here */
-.leaflet-control-container .leaflet-routing-container-hide .leaflet-routing-container .leaflet-top .leaflet-right {
- display: none;
-}
diff --git a/src/index.html b/src/index.html
index b6cd034..69a808e 100644
--- a/src/index.html
+++ b/src/index.html
@@ -27,178 +27,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/js/helpers.js b/src/js/helpers.js
deleted file mode 100644
index 0ff8b34..0000000
--- a/src/js/helpers.js
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * Get a place from nominatim response data
- * @param {any} placeData
- * @param {{ lat: number, lng: number} | undefined } userInputCoords
- * @returns {any}
- */
-export const getPlaceByNominatimData = (placeData, userInputCoords) => {
- if (placeData === undefined) return;
- let place = {
- name: placeData?.display_name || "Unknown location",
- address: {
- amenity: placeData?.address?.amenity || "",
- city: placeData?.address?.city || "",
- cityDistrict: placeData?.address?.city_district || "",
- municipality: placeData?.address?.municipality || "",
- country: placeData?.address?.country || "",
- countryCode: placeData?.address?.country_code || "",
- neighbourhood: placeData?.address?.neighbourhood || "",
- postcode: placeData?.address?.postcode || "",
- road: placeData?.address?.road || "",
- houseNumber: placeData?.address?.house_number || "",
- state: placeData?.address?.state || "",
- suburb: placeData?.address?.suburb || "",
- },
- type: placeData?.type || "",
- importance: placeData?.importance ? parseFloat(placeData?.lat) : 0,
- osmId: placeData?.osm_id || 0,
- realCoords: {
- lat: placeData?.lat ? parseFloat(placeData?.lat) : undefined,
- lng: placeData?.lon ? parseFloat(placeData?.lon) : undefined,
- },
- userInputCoords: {
- lat: userInputCoords?.lat ? userInputCoords.lat : placeData?.lat ? parseFloat(placeData?.lat) : undefined,
- lng: userInputCoords?.lng ? userInputCoords.lng : placeData?.lon ? parseFloat(placeData?.lon) : undefined,
- },
- zoomLevel: getZoomByBoundingBox(placeData?.boundingbox) || 10,
- wikidata: placeData?.extratags?.wikidata || "",
- wikipedia: placeData?.extratags?.wikipedia || "",
- searchedByCoords: false,
- searchedByCurrentLocation: false,
- searchedByPlace: false,
- searchedByAddress: false,
- };
- return place;
-};
-
-/**
- * Get the zoom level by a given bounding box
- * @param {number[] | string[] | undefined} boundingbox
- * @returns {number | undefined}
- * @see https://wiki.openstreetmap.org/wiki/Zoom_levels
- * @see https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Zoom_levels
- */
-export const getZoomByBoundingBox = boundingbox => {
- if (boundingbox === undefined) return undefined;
-
- const lat1 = parseFloat(`${boundingbox[0]}`);
- const lat2 = parseFloat(`${boundingbox[1]}`);
- const lng1 = parseFloat(`${boundingbox[2]}`);
- const lng2 = parseFloat(`${boundingbox[3]}`);
- const latDiff = Math.abs(lat1 - lat2);
- const lngDiff = Math.abs(lng1 - lng2);
- const maxDiff = Math.max(latDiff, lngDiff);
- const zoom = Math.min(Math.round(Math.log(360 / maxDiff) / Math.log(2)), 18);
- return zoom;
-};
-
-/**
- * Get coordinates from a string
- * @param {string} text
- * @returns {{lat: number, lng: number} | undefined} undefined if no coordinates were found
- */
-export const getCoordsFromSearchText = text => {
- const coordinateRegex = /^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$/;
- coordinateRegex.test(text);
- const match = text.match(coordinateRegex);
- if (!match) return undefined;
- const lat = parseFloat(match[1]);
- const lng = parseFloat(match[3]);
- return { lat: lat, lng: lng };
-};
diff --git a/src/js/memo-fetcher.js b/src/js/memo-fetcher.js
deleted file mode 100644
index 35544f2..0000000
--- a/src/js/memo-fetcher.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * MemoFetcher is a wrapper around fetch() that caches the results.
- * The cache is stored in LocalStorage.
- */
-class MemoFetcher {
- /**
- * Fetches a URL and caches the result in LocalStorage.
- * @param {string} url The URL to fetch.
- */
- async fetch(url) {
- if (localStorage.getItem(url)) {
- return JSON.parse(localStorage.getItem(url) || "{}");
- }
-
- const response = await fetch(url);
- const data = await response.json();
- localStorage.setItem(url, JSON.stringify(data));
- return data;
- }
-}
-
-export default MemoFetcher;
diff --git a/src/manifest.json b/src/manifest.json
index 7f04677..e374d1a 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -1,12 +1,12 @@
{
"name": "Know Where You Go",
- "short_name": "KWYG",
- "description": "Know-Where-You-Go ist eine Webanwendung, die Ihnen hilft, herauszufinden, wo Sie sind und wohin Sie gehen.",
- "lang": "de",
+ "short_name": "Know Where You Go",
+ "description": "Know Where You Go",
+ "lang": "en-US",
"start_url": "/",
"display": "standalone",
- "background_color": "#222222",
- "theme_color": "#222222",
+ "background_color": "#EE350F",
+ "theme_color": "#EE350F",
"icons": [
{
"src": "/icons/128x128.png",
@@ -37,22 +37,6 @@
"src": "/icons/512x512.png",
"sizes": "512x512",
"type": "image/png"
- },
- {
- "src": "/icons/maskable_icon_x512.png",
- "sizes": "512x512",
- "type": "image/png",
- "purpose": "any"
- },
- {
- "src": "/icons/maskable_icon_x1024.png",
- "sizes": "1024x1024",
- "type": "image/png",
- "purpose": "maskable"
}
- ],
- "dir": "ltr",
- "scope": "https://know-where-you-go.de/",
- "orientation": "any",
- "categories": ["navigation"]
+ ]
}
diff --git a/src/pages/home.jsx b/src/pages/home.jsx
index 0cf6d4c..36dd1df 100644
--- a/src/pages/home.jsx
+++ b/src/pages/home.jsx
@@ -1,16 +1,11 @@
import React from "react";
-import { Page, Searchbar, List, BlockTitle, Button, ListItem, Toggle } from "framework7-react";
-import { MapContainer, useMap, useMapEvents } from "react-leaflet";
+import { Page, Searchbar, List, BlockTitle, Button, ListItem } from "framework7-react";
+import { MapContainer, TileLayer, useMap, useMapEvents } from "react-leaflet";
import "leaflet/dist/leaflet.css";
import SnappingSheet from "../components/SnappingSheet";
import LocationMarker from "../components/LocationMarker";
import AccuracyCircle from "../components/AccuracyCircle";
import OutlinePolygon from "../components/OutlinePolygon";
-import { getPlaceByNominatimData, getCoordsFromSearchText } from "../js/helpers";
-import WikiInfo from "../components/WikiInfo";
-import MemoFetcher from "../js/memo-fetcher";
-import L from "leaflet";
-import "leaflet-routing-machine";
const SEARCH_BAR_HEIGHT = 70;
@@ -27,15 +22,11 @@ class Home extends React.Component {
searchText: "",
place: {},
mapHeight: window.innerHeight - SEARCH_BAR_HEIGHT,
- selectedCoords: { lat: undefined, lng: undefined },
+ selectedCoords: undefined,
searchSuggestions: [],
showSearchSuggestions: false,
- showRouting: true,
- routingDistance: 0,
- routingTime: 0,
- showRoutingDistanceAndDuration: false,
- tileLayerStyle: "map",
};
+
this.sheetHeightStates = [
SEARCH_BAR_HEIGHT,
window.innerHeight * 0.25 + SEARCH_BAR_HEIGHT,
@@ -44,16 +35,11 @@ class Home extends React.Component {
this.suggestionTimeout = undefined;
this.mapNeedsUpdate = false;
this.mapSlowAnimation = true;
- this.routingNeedsUpdate = false;
- this.tileLayerNeedsUpdate = true;
this.mapZoom = 4;
this.mapCenter = {
lat: 47.665575312188025,
lng: 9.447241869601651,
};
- this.memoFetcher = new MemoFetcher();
- this.routingMachine = undefined;
- this.tileLayer = undefined;
}
componentDidMount() {
@@ -62,6 +48,7 @@ class Home extends React.Component {
// get the current location
navigator.geolocation.getCurrentPosition(position => {
+ console.log(position);
this.setState({
currentLocation: {
lat: position.coords.latitude,
@@ -89,23 +76,18 @@ class Home extends React.Component {
/**
* Search for a place by text or coordinates
* @param {string} searchText
- * @param {string | undefined} osmID
- * @returns Promise
*/
- updatePlaceBySearchOrOsmID = async (searchText, osmID = undefined) => {
- // if a osmID is given, use it, otherwise use the search text
+ updatePlaceBySearch = async searchText => {
+ const coords = this.getCoordsFromSearchText(searchText);
+
let place = {};
- if (osmID !== undefined) {
- place = await this.getPlaceByOsmID(osmID);
- } else {
- const coords = getCoordsFromSearchText(searchText);
- if (coords !== undefined) place = await this.getPlaceByCoords(coords);
- else place = await this.getPlaceByText(searchText);
- }
+ if (coords !== undefined) place = await this.getPlaceByCoords(coords);
+ else place = await this.getPlaceByText(searchText);
+
+ console.log("place in updatePlaceBySearch", place);
if (place === undefined) return;
this.mapNeedsUpdate = true;
- this.routingNeedsUpdate = true;
this.mapZoom = place.zoomLevel;
this.mapCenter = {
lat: place.realCoords.lat,
@@ -116,7 +98,6 @@ class Home extends React.Component {
snapSheetToState: 1,
selectedCoords: place.realCoords,
showSearchSuggestions: false,
- showRouting: true,
});
};
@@ -134,14 +115,29 @@ class Home extends React.Component {
lng: coords.lng,
};
}
- this.routingNeedsUpdate = true;
const place = await this.getPlaceByCoords(coords, zoom);
this.setState({
place: place,
snapSheetToState: 1,
selectedCoords: coords,
- showRouting: true,
});
+ console.log("state in updatePlaceByCoords", this.state);
+ };
+
+ /**
+ * Get coordinates from a string
+ * @param {string} text
+ * @returns {{lat: number, lng: number} | undefined} undefined if no coordinates were found
+ */
+ getCoordsFromSearchText = text => {
+ const coordinateRegex = /^(-?\d+(\.\d+)?),\s*(-?\d+(\.\d+)?)$/;
+ coordinateRegex.test(text);
+ const match = text.match(coordinateRegex);
+ if (!match) return undefined;
+ const lat = parseFloat(match[1]);
+ const lng = parseFloat(match[3]);
+ console.log(`lat: ${lat}, lng: ${lng}`);
+ return { lat: lat, lng: lng };
};
/**
@@ -150,30 +146,31 @@ class Home extends React.Component {
* @returns Promise
*/
getPlaceByText = async searchText => {
- const data = await this.memoFetcher.fetch(
+ const response = await fetch(
`https://nominatim.openstreetmap.org/search?q=${searchText}&format=json&addressdetails=1&limit=1&extratags=1`,
);
+ const data = await response.json();
if (data[0] === undefined) return;
- const place = getPlaceByNominatimData(data[0], undefined);
- place.userInputCoords = place.realCoords;
+ const place = this.getPlaceByNominatimData(data[0]);
return place;
};
/**
* Get a place from nominatim by coordinates
* @param {{lat: number, lng: number}} coords
- * @param {number} zoom
* @returns {Promise}
*/
getPlaceByCoords = async (coords, zoom = 20) => {
- const data = await this.memoFetcher.fetch(
+ const response = await fetch(
// eslint-disable-next-line max-len
`https://nominatim.openstreetmap.org/reverse?format=json&lat=${coords.lat}&lon=${coords.lng}&extratags=1&zoom=${
- parseInt(`${zoom}`) + 1
+ zoom + 1
}&addressdetails=1`,
);
+ const data = await response.json();
+ console.log(data);
if (data === undefined) return;
- const place = getPlaceByNominatimData(data, coords);
+ const place = this.getPlaceByNominatimData(data);
if (place?.realCoords?.lat === undefined || place?.realCoords?.lng === undefined) {
place.realCoords = coords;
}
@@ -181,20 +178,71 @@ class Home extends React.Component {
};
/**
- * Get a place from nominatim by osmID
- * @param {string} osmID
- * @returns {Promise}
+ * Get a place from nominatim response data
+ * @param {any} placeData
+ * @returns {any}
*/
- getPlaceByOsmID = async osmID => {
- const data = await this.memoFetcher.fetch(
- // eslint-disable-next-line max-len
- `https://nominatim.openstreetmap.org/lookup?format=json&osm_ids=${osmID}&extratags=1&addressdetails=1`,
- );
- if (data[0] === undefined) return;
- const place = getPlaceByNominatimData(data[0], undefined);
+ getPlaceByNominatimData = placeData => {
+ if (placeData === undefined) return;
+ // console.log(placeData);
+ let place = {
+ name: placeData?.display_name || "Unknown location",
+ address: {
+ amenity: placeData?.address?.amenity || "",
+ city: placeData?.address?.city || "",
+ cityDistrict: placeData?.address?.city_district || "",
+ municipality: placeData?.address?.municipality || "",
+ country: placeData?.address?.country || "",
+ countryCode: placeData?.address?.country_code || "",
+ neighbourhood: placeData?.address?.neighbourhood || "",
+ postcode: placeData?.address?.postcode || "",
+ road: placeData?.address?.road || "",
+ houseNumber: placeData?.address?.house_number || "",
+ state: placeData?.address?.state || "",
+ suburb: placeData?.address?.suburb || "",
+ },
+ type: placeData?.type || "",
+ importance: placeData?.importance ? parseFloat(placeData?.lat) : 0,
+ osmId: placeData?.osm_id || 0,
+ realCoords: {
+ lat: placeData?.lat ? parseFloat(placeData?.lat) : undefined,
+ lng: placeData?.lon ? parseFloat(placeData?.lon) : undefined,
+ },
+ userInputCoords: {
+ lat: 0,
+ lng: 0,
+ },
+ zoomLevel: this.getZoomByBoundingBox(placeData?.boundingbox) || 10,
+ searchedByCoords: false,
+ searchedByCurrentLocation: false,
+ searchedByPlace: false,
+ searchedByAddress: false,
+ };
+ // console.log(place);
return place;
};
+ /**
+ * Get the zoom level by a given bounding box
+ * @param {number[] | string[] | undefined} boundingbox
+ * @returns {number | undefined}
+ * @see https://wiki.openstreetmap.org/wiki/Zoom_levels
+ * @see https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Zoom_levels
+ */
+ getZoomByBoundingBox(boundingbox) {
+ if (boundingbox === undefined) return undefined;
+
+ const lat1 = parseFloat(`${boundingbox[0]}`);
+ const lat2 = parseFloat(`${boundingbox[1]}`);
+ const lng1 = parseFloat(`${boundingbox[2]}`);
+ const lng2 = parseFloat(`${boundingbox[3]}`);
+ const latDiff = Math.abs(lat1 - lat2);
+ const lngDiff = Math.abs(lng1 - lng2);
+ const maxDiff = Math.max(latDiff, lngDiff);
+ const zoom = Math.min(Math.round(Math.log(360 / maxDiff) / Math.log(2)), 18);
+ return zoom;
+ }
+
/**
* Get the search suggestions from nominatim
* @param {string} searchText
@@ -207,17 +255,11 @@ class Home extends React.Component {
}
clearTimeout(this.suggestionTimeout);
this.suggestionTimeout = setTimeout(async () => {
- const data = await this.memoFetcher.fetch(
- // eslint-disable-next-line max-len
- `https://photon.komoot.io/api/?q=${searchText}&limit=5&lang=de&lat=${this.state.currentLocation.lat}&lon=${this.state.currentLocation.lng}`,
- );
- const searchSuggestions = data.features.map(place => {
+ const response = await fetch(`https://nominatim.openstreetmap.org/search?q=${searchText}&format=json&limit=5`);
+ const data = await response.json();
+ const searchSuggestions = data.map(place => {
const placeData = {
- displayName:
- place?.properties?.name ||
- // eslint-disable-next-line max-len
- `${place?.properties?.street} ${place?.properties?.housenumber} ${place?.properties?.postcode} ${place?.properties?.city}`,
- osmID: place?.properties?.osm_type + place?.properties?.osm_id,
+ displayName: place?.display_name || "Unknown location",
};
return placeData;
});
@@ -225,15 +267,6 @@ class Home extends React.Component {
}, 200);
};
- /**
- * Toggles the tile layer from satellite to map and vice versa
- * @returns {void}
- */
- toggleTileLayer = () => {
- this.tileLayerNeedsUpdate = true;
- this.setState({ tileLayerStyle: this.state.tileLayerStyle === "satellite" ? "map" : "satellite" });
- };
-
/**
* Small Component to interact with the leaflet map
* @returns {null}
@@ -260,71 +293,6 @@ class Home extends React.Component {
},
});
- // tile layer
- if (this.tileLayerNeedsUpdate) {
- if (this.tileLayer) map.removeLayer(this.tileLayer);
- this.tileLayer = L.tileLayer(
- this.state.tileLayerStyle === "satellite"
- ? "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}"
- : "https://{s}.tile.openstreetmap.de/{z}/{x}/{y}.png",
- {
- attribution: this.state.tileLayerStyle === "satellite" ? "Tiles © Esri" : "Tiles © OpenStreetMap",
- },
- ).addTo(map);
- this.tileLayerNeedsUpdate = false;
- }
-
- // routing
- if (!this.routingNeedsUpdate) return null;
-
- if (this.routingMachine) map.removeControl(this.routingMachine);
- if (
- this.state.currentLocation.lat === undefined ||
- this.state.currentLocation.lng === undefined ||
- this.state.selectedCoords?.lat === undefined ||
- this.state.selectedCoords?.lng === undefined ||
- this.state.currentLocation.lat === this.state.selectedCoords.lat ||
- this.state.currentLocation.lng === this.state.selectedCoords.lng ||
- this.state.showRouting === false
- )
- return null;
-
- this.routingMachine = L.Routing.control({
- waypoints: [
- L.latLng(this.state.currentLocation.lat, this.state.currentLocation.lng),
- L.latLng(this.state.selectedCoords.lat, this.state.selectedCoords.lng),
- ],
- routeWhileDragging: false,
- // @ts-ignore
- createMarker: () => null,
- fitSelectedRoutes: false,
- draggableWaypoints: false,
- lineOptions: {
- styles: [{ color: "blue", opacity: 1, weight: 2 }],
- extendToWaypoints: true,
- missingRouteTolerance: 0,
- },
- addWaypoints: false,
- router: L.Routing.osrmv1({
- serviceUrl: "https://router.project-osrm.org/route/v1",
- }),
- collapsible: true,
- });
-
- // if a route is found, check if it is too near to the current location and if so, don't show it
- this.routingMachine.on("routesfound", event => {
- if (event.routes[0] === undefined) return;
- const minDistance = 400;
- if (event.routes[0].summary.totalDistance < minDistance) this.routingNeedsUpdate = true;
- this.setState({
- routingDistance: event.routes[0].summary.totalDistance,
- routingTime: event.routes[0].summary.totalTime,
- showRouting: event.routes[0].summary.totalDistance > minDistance,
- showRoutingDistanceAndDuration: event.routes[0].summary.totalDistance > minDistance,
- });
- });
- this.routingMachine.addTo(map);
- this.routingNeedsUpdate = false;
return null;
};
@@ -339,10 +307,6 @@ class Home extends React.Component {
return (
-
+
{
- this.setState({ searchText: event.target.value, showSearchSuggestions: true });
+ this.setState({ searchText: event.target.value });
this.updateSearchSuggestions(event.target.value);
}}
onSubmit={event => {
event.target.blur(); // hide keyboard TODO: this is not working yet
- this.updatePlaceBySearchOrOsmID(this.state.searchText);
+ this.updatePlaceBySearch(this.state.searchText);
}}
onClickClear={() => {
this.setState({ searchText: "", showSearchSuggestions: false, searchSuggestions: [] });
@@ -415,28 +383,16 @@ class Home extends React.Component {
title={suggestion["displayName"]}
onClick={() => {
this.setState({ searchText: suggestion["displayName"], showSearchSuggestions: false });
- this.updatePlaceBySearchOrOsmID(suggestion["displayName"], suggestion["osmID"]);
+ this.updatePlaceBySearch(suggestion["displayName"]);
}}
style={{ cursor: "pointer" }}
/>
);
})}
+
{this.state.place.name}
-
- {Math.round(this.state.routingDistance / 1000)} km,{" "}
- {
- // eslint-disable-next-line max-len
- this.state.routingTime > 3600
- ? Math.round(this.state.routingTime / 3600) +
- " h " +
- Math.round((this.state.routingTime % 3600) / 60) +
- " min"
- : Math.round(this.state.routingTime / 60) + " min"
- }
-
{address}
-