mirror of
https://github.com/mue/mue.git
synced 2026-07-10 22:14:39 +02:00
fix: various bug fixes and refactor search settings
This commit is contained in:
@@ -22,20 +22,7 @@ export default class Widgets extends React.PureComponent {
|
||||
}
|
||||
|
||||
enabled(key) {
|
||||
const stringValue = localStorage.getItem(key);
|
||||
let enabled = true;
|
||||
|
||||
if (stringValue !== null) {
|
||||
if (stringValue === 'true') {
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
if (stringValue === 'false') {
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
return enabled;
|
||||
return (localStorage.getItem(key) === 'true');
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
||||
@@ -226,12 +226,12 @@ export default class Background extends React.PureComponent {
|
||||
|
||||
render() {
|
||||
if (this.state.video === true) {
|
||||
const checkValue = (setting) => {
|
||||
const enabled = (setting) => {
|
||||
return (localStorage.getItem(setting) === 'true');
|
||||
};
|
||||
|
||||
return (
|
||||
<video autoPlay muted={checkValue('backgroundVideoMute')} loop={checkValue('backgroundVideoLoop')} id='backgroundVideo'>
|
||||
<video autoPlay muted={enabled('backgroundVideoMute')} loop={enabled('backgroundVideoLoop')} id='backgroundVideo'>
|
||||
<source src={this.state.url}/>
|
||||
</video>
|
||||
);
|
||||
|
||||
@@ -91,7 +91,7 @@ export default class Clock extends React.PureComponent {
|
||||
render() {
|
||||
let clockHTML = <h1 className='clock'>{this.state.time}<span className='ampm'>{this.state.ampm}</span></h1>;
|
||||
|
||||
const checkValue = (setting) => {
|
||||
const enabled = (setting) => {
|
||||
return (localStorage.getItem(setting) === 'true');
|
||||
};
|
||||
|
||||
@@ -100,11 +100,11 @@ export default class Clock extends React.PureComponent {
|
||||
<Analog
|
||||
className='analogclock'
|
||||
value={this.state.time}
|
||||
renderHourMarks={checkValue('hourMarks')}
|
||||
renderMinuteMarks={checkValue('minuteMarks')}
|
||||
renderSecondHand={checkValue('secondHand')}
|
||||
renderMinuteHand={checkValue('minuteHand')}
|
||||
renderHourHand={checkValue('hourHand')}
|
||||
renderHourMarks={enabled('hourMarks')}
|
||||
renderMinuteMarks={enabled('minuteMarks')}
|
||||
renderSecondHand={enabled('secondHand')}
|
||||
renderMinuteHand={enabled('minuteHand')}
|
||||
renderHourHand={enabled('hourHand')}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ export default class Weather extends React.PureComponent {
|
||||
}
|
||||
|
||||
render() {
|
||||
const checkValue = (setting) => {
|
||||
const enabled = (setting) => {
|
||||
return (localStorage.getItem(setting) === 'true');
|
||||
};
|
||||
|
||||
@@ -92,12 +92,11 @@ export default class Weather extends React.PureComponent {
|
||||
<WeatherIcon name={this.state.icon}/>
|
||||
<span>{this.state.weather.temp + this.state.temp_text}</span>
|
||||
<span className='minmax'>{minmax()}</span>
|
||||
{checkValue('humidity') ? <span className='loc'><br/><WiHumidity/>{this.state.weather.humidity}%</span> : null}
|
||||
{checkValue('windspeed') ? <span className='loc'><br/><WiWindy/>{this.state.weather.windspeed}<span className='minmax'> m/s</span></span> : null}
|
||||
{checkValue('atmosphericpressure') ? <span className='loc'><br/>{this.state.weather.pressure}<span className='minmax'> hPa</span></span> : null}
|
||||
{enabled('humidity') ? <span className='loc'><br/><WiHumidity/>{this.state.weather.humidity}%</span> : null}
|
||||
{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>
|
||||
{/*<span>{this.state.weather.title}</span>*/}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user