fix: various settings bug fixes and style changes

This commit is contained in:
David Ralph
2021-06-30 15:25:34 +01:00
parent 6aa1c6b0ea
commit c6b65f943a
19 changed files with 35 additions and 38 deletions

View File

@@ -352,7 +352,7 @@ export default class Background extends React.PureComponent {
};
return (
<video autoPlay muted={enabled('backgroundVideoMute')} loop={enabled('backgroundVideoLoop')} style={{ 'WebkitFilter': `blur(${localStorage.getItem('blur')}px) brightness(${localStorage.getItem('brightness')}%)` }} id='backgroundVideo'>
<video autoPlay muted={enabled('backgroundVideoMute')} loop={enabled('backgroundVideoLoop')} style={{ WebkitFilter: `blur(${localStorage.getItem('blur')}px) brightness(${localStorage.getItem('brightness')}%)` }} id='backgroundVideo'>
<source src={this.state.url}/>
</video>
);

View File

@@ -151,7 +151,7 @@ export default class QuickLinks extends React.PureComponent {
quickLink(item)
))}
<button className='quicklinks' onClick={this.toggleAdd}>+</button>
<span className='quicklinkscontainer' style={{ 'visibility': this.state.showAddLink }}>
<span className='quicklinkscontainer' style={{ visibility: this.state.showAddLink }}>
<div className='topbarquicklinks'>
<h4>{this.language.new}</h4>
<TextareaAutosize rowsMax={1} placeholder={this.language.name} value={this.state.name} onChange={(e) => this.setState({ name: e.target.value })} />

View File

@@ -35,6 +35,8 @@ export default class Weather extends React.PureComponent {
return null;
}
document.querySelector('.weather').style.fontSize = `${Number((localStorage.getItem('zoomWeather') || 100) / 100)}em`;
let data = {
weather: [
{
@@ -118,12 +120,8 @@ export default class Weather extends React.PureComponent {
EventBus.on('refresh', (data) => {
if (data === 'weather') {
this.getWeather();
document.querySelector('.weather').style.fontSize = `${Number((localStorage.getItem('zoomWeather') || 100) / 100)}em`;
document.querySelector('.weather svg').style.fontSize = `${0.95 * Number((localStorage.getItem('zoomWeather') || 100) / 100)}em`;
}
});
document.querySelector('.weather').style.fontSize = `${Number((localStorage.getItem('zoomWeather') || 100) / 100)}em`;
this.getWeather();
}
@@ -165,7 +163,7 @@ export default class Weather extends React.PureComponent {
<div className='weather'>
<WeatherIcon name={this.state.icon}/>
<span>{this.state.weather.temp + this.state.temp_text}</span>
{enabled('weatherdescription') ? <span className='loc' style={{ 'textTransform': 'capitalize' }}><br/>{this.state.weather.description}</span> : null}
{enabled('weatherdescription') ? <span className='loc'><br/>{this.state.weather.description}</span> : null}
<span className='minmax'>{minmax()}</span>
{enabled('humidity') ? <span className='loc'><br/><WiHumidity/>{this.state.weather.humidity}%</span> : null}
{enabled('windspeed') ? <span className='loc'><br/><WiWindy/>{this.state.weather.wind_speed}<span className='minmax'> m/s</span> {enabled('windDirection') ? <WindDirectionIcon degrees={this.state.weather.wind_degrees}/> : null}</span> : null}

View File

@@ -2,10 +2,12 @@ import { WiDirectionDownLeft, WiDirectionDownRight, WiDirectionDown, WiDirection
export default function WindDirectionIcon(props) {
let icon;
// fix potential bug, idk what causes it but now it is fixed
let degrees = props.degrees;
// convert the number openweathermap gives us to closest direction or something
const directions = ['North', 'North-West', 'West', 'South-West', 'South', 'South-East', 'East', 'North-East'];
const direction = directions[Math.round(((props.degrees %= 360) < 0 ? props.degrees + 360 : props.degrees) / 45) % 8];
const direction = directions[Math.round(((degrees %= 360) < 0 ? degrees + 360 : degrees) / 45) % 8];
switch (direction) {
case 'North': icon = <WiDirectionUp/>; break;

View File

@@ -23,6 +23,7 @@
font-size: 0.7em;
margin: 0;
padding: 0;
text-transform: capitalize;
}
.minmax {