feat: finish 5.0 (mostly)

Co-authored-by: Alex Sparkes <turbomarshmello@gmail.com>
This commit is contained in:
David Ralph
2021-04-15 17:15:57 +01:00
parent f874f2a54c
commit 6662514e5f
21 changed files with 2137 additions and 271 deletions

View File

@@ -48,8 +48,14 @@ export default class Weather extends React.PureComponent {
data = await (await fetch (window.constants.WEATHER_URL + `?city=${this.state.location}`)).json();
}
if (data.cod === '404') {
return this.setState({
location: window.language.widgets.weather.not_found
});
}
let temp = data.main.temp;
let temp_min = data.main.temp_mix
let temp_min = data.main.temp_min;
let temp_max = data.main.temp_max;
let temp_text = 'K';
@@ -105,6 +111,12 @@ export default class Weather extends React.PureComponent {
return (localStorage.getItem(setting) === 'true');
};
if (this.state.location === window.language.widgets.weather.not_found) {
return (<div className='weather'>
<span className='loc'>{this.state.location}</span>
</div>);
};
const minmax = () => {
const mintemp = (localStorage.getItem('mintemp') === 'true');
const maxtemp = (localStorage.getItem('maxtemp') === 'true');
@@ -129,7 +141,7 @@ export default class Weather extends React.PureComponent {
{enabled('windspeed') ? <span className='loc'><br/><WiWindy/>{this.state.weather.windspeed}<span className='minmax'> m/s</span></span> : null}
{enabled('atmosphericpressure') ? <span className='loc'><br/>{this.state.weather.pressure}<span className='minmax'> hPa</span></span> : null}
<br/>
<span className='loc'>{this.state.location}</span>
{enabled('showlocation') ? <span className='loc'>{this.state.location}</span> : null}
</div>
);
}

View File

@@ -4,14 +4,18 @@
right: 1rem;
cursor: initial;
user-select: none;
padding: 20px;
background-color: rgba(0, 0, 0, 0.3);
border-radius: 20px;
span {
text-shadow: 0 0 10px rgb(0 0 0 / 50%);
}
svg {
filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.3));
font-size: 0.8em;
filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.1));
vertical-align: middle;
font-size: 35px;
}
.loc {