diff --git a/src/components/modals/main/settings/sections/Weather.jsx b/src/components/modals/main/settings/sections/Weather.jsx index 4999f798..31003df8 100644 --- a/src/components/modals/main/settings/sections/Weather.jsx +++ b/src/components/modals/main/settings/sections/Weather.jsx @@ -26,6 +26,18 @@ export default class TimeSettings extends React.PureComponent { localStorage.setItem('showReminder', true); } + getAuto() { + navigator.geolocation.getCurrentPosition(async (position) => { + const data = await (await fetch(`${window.constants.WEATHER_URL}/location?getAuto=true&lat=${position.coords.latitude}&lon=${position.coords.longitude}`)).json(); + this.setState({ + location: data[0].name + }); + }); + + document.querySelector('.reminder-info').style.display = 'block'; + localStorage.setItem('showReminder', true); + } + render() { const language = window.language.modals.main.settings.sections.weather; @@ -49,15 +61,17 @@ export default class TimeSettings extends React.PureComponent {

{language.title}


{language.extra_info.title}

+ + diff --git a/src/components/widgets/weather/Weather.jsx b/src/components/widgets/weather/Weather.jsx index af0f8e71..1d6a3acf 100644 --- a/src/components/widgets/weather/Weather.jsx +++ b/src/components/widgets/weather/Weather.jsx @@ -3,8 +3,8 @@ import React from 'react'; import EventBus from '../../../modules/helpers/eventbus'; import WeatherIcon from './WeatherIcon'; -//import WindDirectionIcon from './WindDirectionIcon'; -import { WiHumidity, WiWindy, WiBarometer } from 'weather-icons-react'; +import WindDirectionIcon from './WindDirectionIcon'; +import { WiHumidity, WiWindy, WiBarometer, WiCloud } from 'weather-icons-react'; import './weather.scss'; @@ -17,11 +17,13 @@ export default class Weather extends React.PureComponent { temp_text: '', weather: { temp: '', + description: '', temp_min: '', temp_max: '', humidity: '', wind_speed: '', wind_degrees: '', + cloudiness: '', pressure: '' } }; @@ -35,19 +37,23 @@ export default class Weather extends React.PureComponent { let data = { weather: [ { + description: this.state.weather.description, icon: this.state.icon } ], - wind: { - speed: this.state.weather.wind_speed, - deg: this.state.weather.wind_degrees - }, main: { temp: this.state.weather.original_temp, temp_min: this.state.weather.original_temp_min, temp_max: this.state.weather.original_temp_max, humidity: this.state.weather.humidity, pressure: this.state.weather.pressure + }, + wind: { + speed: this.state.weather.wind_speed, + deg: this.state.weather.wind_degrees + }, + clouds: { + all: this.state.weather.cloudiness } }; @@ -88,11 +94,13 @@ export default class Weather extends React.PureComponent { temp_text: temp_text, weather: { temp: Math.round(temp), + description: data.weather[0].description, temp_min: Math.round(temp_min), temp_max: Math.round(temp_max), humidity: data.main.humidity, wind_speed: data.wind.speed, wind_degrees: data.wind.deg, + cloudiness: data.clouds.all, pressure: data.main.pressure, original_temp: data.main.temp, original_temp_min: data.main.temp_min, @@ -144,14 +152,16 @@ export default class Weather extends React.PureComponent { return <>
{this.state.weather.temp_min + this.state.temp_text} {this.state.weather.temp_max + this.state.temp_text}; } }; - + return (
{this.state.weather.temp + this.state.temp_text} +
{this.state.weather.description}
{minmax()} {enabled('humidity') ?
{this.state.weather.humidity}%
: null} - {enabled('windspeed') ?
{this.state.weather.wind_speed} m/s{/**/}
: null} + {enabled('windspeed') ?
{this.state.weather.wind_speed} m/s {enabled('windDirection') ? : null}
: null} + {enabled('cloudiness') ?
{this.state.weather.cloudiness}%
: null} {enabled('atmosphericpressure') ?
{this.state.weather.pressure} hPa
: null}
{enabled('showlocation') ? {this.state.location} : null} diff --git a/src/translations/de_DE.json b/src/translations/de_DE.json index c7693099..a964b166 100644 --- a/src/translations/de_DE.json +++ b/src/translations/de_DE.json @@ -179,8 +179,10 @@ "extra_info": { "title": "Zusätzliche Informationen", "show_location": "Standort anzeigen", + "show_text": "Show Text", "humidity": "Luftfeuchtigkeit", "wind_speed": "Windgeschwindigkeit", + "wind_direction": "Wind direction", "min_temp": "Mindesttemperatur", "max_temp": "Höchsttemperatur", "atmospheric_pressure": "Atmosphärischer Druck" diff --git a/src/translations/en_GB.json b/src/translations/en_GB.json index 0ce86b40..9d07ea2a 100644 --- a/src/translations/en_GB.json +++ b/src/translations/en_GB.json @@ -179,8 +179,10 @@ "extra_info": { "title": "Extra information", "show_location": "Show Location", + "show_text": "Show Text", "humidity": "Humidity", "wind_speed": "Wind speed", + "wind_direction": "Wind direction", "min_temp": "Minimum temperature", "max_temp": "Maximum temperature", "atmospheric_pressure": "Atmospheric pressure" diff --git a/src/translations/en_US.json b/src/translations/en_US.json index a2b9e804..53d5d5d0 100644 --- a/src/translations/en_US.json +++ b/src/translations/en_US.json @@ -181,6 +181,7 @@ "show_location": "Show Location", "humidity": "Humidity", "wind_speed": "Wind speed", + "wind_direction": "Wind direction", "min_temp": "Minimum temperature", "max_temp": "Maximum temperature", "atmospheric_pressure": "Atmospheric pressure" diff --git a/src/translations/es.json b/src/translations/es.json index e7a4c411..9846e95c 100644 --- a/src/translations/es.json +++ b/src/translations/es.json @@ -179,8 +179,10 @@ "extra_info": { "title": "Información extra", "show_location": "Mostrar ubicación", + "show_text": "Show Text", "humidity": "Humedad", "wind_speed": "Velocidad del viento", + "wind_direction": "Wind direction", "min_temp": "Temperatura mínima", "max_temp": "Temperatura máxima", "atmospheric_pressure": "Presión atmosférica" diff --git a/src/translations/fr.json b/src/translations/fr.json index 1cf762a9..818f3559 100644 --- a/src/translations/fr.json +++ b/src/translations/fr.json @@ -179,8 +179,10 @@ "extra_info": { "title": "Informations supplémentaires", "show_location": "Afficher l'emplacement", + "show_text": "Show Text", "humidity": "Humidité", "wind_speed": "Vitesse du vent", + "wind_direction": "Wind direction", "min_temp": "Température minimale", "max_temp": "Température maximale", "atmospheric_pressure": "Pression atmosphérique" diff --git a/src/translations/nl.json b/src/translations/nl.json index 2a269164..d6f55e9c 100644 --- a/src/translations/nl.json +++ b/src/translations/nl.json @@ -179,8 +179,10 @@ "extra_info": { "title": "Extra information", "show_location": "Show Location", + "show_text": "Show Text", "humidity": "Humidity", "wind_speed": "Wind speed", + "wind_direction": "Wind direction", "min_temp": "Minimum temperature", "max_temp": "Maximum temperature", "atmospheric_pressure": "Atmospheric pressure" diff --git a/src/translations/no.json b/src/translations/no.json index fe14f51a..ac998e42 100644 --- a/src/translations/no.json +++ b/src/translations/no.json @@ -179,8 +179,10 @@ "extra_info": { "title": "Extra information", "show_location": "Show Location", + "show_text": "Show Text", "humidity": "Humidity", "wind_speed": "Wind speed", + "wind_direction": "Wind direction", "min_temp": "Minimum temperature", "max_temp": "Maximum temperature", "atmospheric_pressure": "Atmospheric pressure" diff --git a/src/translations/ru.json b/src/translations/ru.json index ae519331..0513ab88 100644 --- a/src/translations/ru.json +++ b/src/translations/ru.json @@ -179,8 +179,10 @@ "extra_info": { "title": "Extra information", "show_location": "Show Location", + "show_text": "Show Text", "humidity": "Humidity", "wind_speed": "Wind speed", + "wind_direction": "Wind direction", "min_temp": "Minimum temperature", "max_temp": "Maximum temperature", "atmospheric_pressure": "Atmospheric pressure" diff --git a/src/translations/zh_CN.json b/src/translations/zh_CN.json index 5153e91d..605c5715 100644 --- a/src/translations/zh_CN.json +++ b/src/translations/zh_CN.json @@ -179,8 +179,10 @@ "extra_info": { "title": "Extra information", "show_location": "Show Location", + "show_text": "Show Text", "humidity": "Humidity", "wind_speed": "Wind speed", + "wind_direction": "Wind direction", "min_temp": "Minimum temperature", "max_temp": "Maximum temperature", "atmospheric_pressure": "Atmospheric pressure"