From 0f166aa9d7fcdb75db1d5109fb950fce7cec47e9 Mon Sep 17 00:00:00 2001 From: Pranshul Date: Wed, 27 Nov 2024 22:07:09 +0530 Subject: [PATCH] new features to radar --- app/src/main/assets/pages/radar.html | 127 +++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) diff --git a/app/src/main/assets/pages/radar.html b/app/src/main/assets/pages/radar.html index aac91336d..9eafef0e4 100644 --- a/app/src/main/assets/pages/radar.html +++ b/app/src/main/assets/pages/radar.html @@ -200,6 +200,57 @@ z-index: 1; } + .custom-tooltip { + background-color: #3d322f; + border-color: #3d322f; + z-index: 436; + border-radius: 18px; + } + .leaflet-tooltip-right:before { + border-right-color: #a08c87; + } + .leaflet-tooltip-left:before { + border-left-color: #a08c87; + } + .leaflet-tooltip-top:before { + border-top-color: #a08c87; + } + .leaflet-tooltip-bottom:before { + border-bottom-color: #a08c87; + } + + .custom-tooltip .content_holder_weather{ + height: 50px; + max-width: 150px; + padding: 10px; + padding-top: 0; + padding-bottom: 0; + } + + .custom-tooltip .content_holder_weather p{ + width: 100%; + overflow: hidden; + text-overflow: ellipsis; + font-family: var(--outfit); + font-size: 16px; + color: #d8c2bc; + white-space: nowrap; + } + + .custom-tooltip .content_holder_weather div{ + display: flex; + align-items: center; + color: #f1dfda; + gap: 10px; + font-family: var(--google-mid); + padding-top: 5px; + padding-bottom: 5px; + } + + .custom-tooltip .content_holder_weather div img{ + width: 20px; + height: 20px; + } @@ -412,6 +463,82 @@ const AppLanguageCodeValue = localStorage.getItem('AppLanguageCode'); } }); + const savedLocations = JSON.parse(localStorage.getItem('savedLocations')) || []; + const selectedProvider = localStorage.getItem("selectedMainWeatherProvider") + + + let alldata + + savedLocations.forEach((locationsData) => { + let currentLocationData = locationsData.locationName; + let weatherData; + let locationWeatherCondition; + let icon + + if (selectedProvider === 'Met norway' || + (localStorage.getItem('ApiForAccu') && selectedProvider === 'Accuweather')) { + weatherData = JSON.parse(localStorage.getItem(`WeatherDataOpenMeteo_${currentLocationData}`)); + } else if (selectedProvider === 'meteoFrance') { + weatherData = JSON.parse(localStorage.getItem(`WeatherDataMeteoFrance_${currentLocationData}`)); + } else if (selectedProvider === 'dwdGermany') { + weatherData = JSON.parse(localStorage.getItem(`WeatherDataDWDGermany_${currentLocationData}`)); + } else if (selectedProvider === 'noaaUS') { + weatherData = JSON.parse(localStorage.getItem(`WeatherDataNOAAUS_${currentLocationData}`)); + } else if (selectedProvider === 'ecmwf') { + weatherData = JSON.parse(localStorage.getItem(`WeatherDataECMWF_${currentLocationData}`)); + } else if (selectedProvider === 'ukMetOffice') { + weatherData = JSON.parse(localStorage.getItem(`WeatherDataukMetOffice_${currentLocationData}`)); + } else if (selectedProvider === 'jmaJapan') { + weatherData = JSON.parse(localStorage.getItem(`WeatherDataJMAJapan_${currentLocationData}`)); + } else if (selectedProvider === 'gemCanada') { + weatherData = JSON.parse(localStorage.getItem(`WeatherDatagemCanada_${currentLocationData}`)); + } else if (selectedProvider === 'bomAustralia') { + weatherData = JSON.parse(localStorage.getItem(`WeatherDatabomAustralia_${currentLocationData}`)); + } else if (selectedProvider === 'cmaChina') { + weatherData = JSON.parse(localStorage.getItem(`WeatherDatacmaChina_${currentLocationData}`)); + } else if (selectedProvider === 'knmiNetherlands') { + weatherData = JSON.parse(localStorage.getItem(`WeatherDataknmiNetherlands_${currentLocationData}`)); + } else if (selectedProvider === 'dmiDenmark') { + weatherData = JSON.parse(localStorage.getItem(`WeatherDatadmiDenmark_${currentLocationData}`)); + } else { + weatherData = JSON.parse(localStorage.getItem(`WeatherDataOpenMeteo_${currentLocationData}`)); + } + + + if (weatherData) { + locationWeatherCondition = getWeatherLabelInLangNoAnim( + weatherData.current.weather_code, + weatherData.current.is_day, + getTranslationByLang(localStorage.getItem('AppLanguageCode')) + ); + + icon = GetWeatherIcon(weatherData.current.weather_code, weatherData.current.is_day); + + window.L.tooltip({ + permanent: true, + opacity: 1, + className: 'custom-tooltip' + }) + + .setLatLng([locationsData.lat, locationsData.lon]) + .setContent(` + +
+

${locationsData.locationName}

+
+ + ${locationWeatherCondition} + +
+
+ `) + .addTo(map); + } else { + console.warn(`No weather data found for ${currentLocationData}`); + } + + }); + }