mirror of
https://github.com/mue/mue.git
synced 2026-07-18 06:24:17 +02:00
feat: finish weather settings
This commit is contained in:
@@ -10,9 +10,9 @@ export default function QuickLinks() {
|
||||
<>
|
||||
<h2>{language.title}</h2>
|
||||
<Switch name='quicklinksenabled' text={window.language.modals.main.settings.enabled} />
|
||||
<Checkbox name='quicklinksnewtab' text='Open in new tab' />
|
||||
<Checkbox name='quicklinkstooltip' text='Tooltip' />
|
||||
<Checkbox name='quicklinksnewtab' text='Chrome Apps' />
|
||||
<Checkbox name='quicklinksnewtab' text={language.open_new} />
|
||||
<Checkbox name='quicklinkstooltip' text={language.tooltip} />
|
||||
<Checkbox name='quicklinksnewtab' text={language.chrome_apps} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -28,15 +28,15 @@ export default class TimeSettings extends React.PureComponent {
|
||||
|
||||
const tempFormat = [
|
||||
{
|
||||
'name': 'Celsius',
|
||||
'name': language.temp_format.celsius + ' (°C)',
|
||||
'value': 'celsius'
|
||||
},
|
||||
{
|
||||
'name': 'Fahrenheit',
|
||||
'name': language.temp_format.fahrenheit + ' (°F)',
|
||||
'value': 'fahrenheit'
|
||||
},
|
||||
{
|
||||
'name': 'Kelvin',
|
||||
'name': language.temp_format.kelvin + ' (K)',
|
||||
'value': 'kelvin'
|
||||
}
|
||||
];
|
||||
@@ -45,18 +45,18 @@ export default class TimeSettings extends React.PureComponent {
|
||||
<>
|
||||
<h2>{language.title}</h2>
|
||||
<Switch name='weatherEnabled' text={this.language.enabled} />
|
||||
<br/>
|
||||
<Radio name='tempformat' title='Temperature Format' options={tempFormat} />
|
||||
<ul>
|
||||
<p>Location <span className='modalLink' onClick={() => this.getLocation()}>Auto</span></p>
|
||||
<p>{language.location} <span className='modalLink' onClick={() => this.getLocation()}>{language.auto}</span></p>
|
||||
<input type='text' value={this.state.location} onChange={(e) => this.setState({ location: e.target.value })}></input>
|
||||
</ul>
|
||||
<h3>Extra Information</h3>
|
||||
<Checkbox name='mintemp' text='Min temp'/>
|
||||
<Checkbox name='maxtemp' text='Max temp'/>
|
||||
<Checkbox name='humidity' text='Humidity'/>
|
||||
<Checkbox name='windspeed' text='Wind speed'/>
|
||||
<Checkbox name='windspeed' text='Atmospheric pressure'/>
|
||||
<br/>
|
||||
<Radio name='tempformat' title={language.temp_format.title} options={tempFormat} />
|
||||
<h3>{language.extra_info.title}</h3>
|
||||
<Checkbox name='humidity' text={language.extra_info.humidity}/>
|
||||
<Checkbox name='windspeed' text={language.extra_info.wind_speed}/>
|
||||
<Checkbox name='mintemp' text={language.extra_info.min_temp}/>
|
||||
<Checkbox name='maxtemp' text={language.extra_info.max_temp}/>
|
||||
<Checkbox name='atmosphericpressure' text={language.extra_info.atmospheric_pressure}/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -68,18 +68,19 @@ export default class Weather extends React.PureComponent {
|
||||
}
|
||||
|
||||
render() {
|
||||
const checkValue = (setting) => {
|
||||
return (localStorage.getItem(setting) === 'true');
|
||||
};
|
||||
|
||||
return (
|
||||
<div className='weather'>
|
||||
<WeatherIcon name={this.state.icon}/>
|
||||
<span>{this.state.weather.temp + this.state.temp_text}</span>
|
||||
<br/>
|
||||
<span className='minmax'>{this.state.weather.temp_min + this.state.temp_text} {this.state.weather.temp_max + this.state.temp_text}</span>
|
||||
<br/>
|
||||
<span className='loc'><WiHumidity/>{this.state.weather.humidity}%</span>
|
||||
<br/>
|
||||
<span className='loc'><WiWindy/>{this.state.weather.windspeed}<span className='minmax'> m/s</span></span>
|
||||
<br/>
|
||||
<span className='loc'>{this.state.weather.pressure}<span className='minmax'> hPa</span></span>
|
||||
<span className='minmax'>{checkValue('mintemp') ? this.state.weather.temp_min + this.state.temp_text : null} {checkValue('maxtemp') ? this.state.weather.temp_max + this.state.temp_text : null}</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}
|
||||
<br/>
|
||||
<span className='loc'>{this.state.location}</span>
|
||||
{/*<span>{this.state.weather.title}</span>*/}
|
||||
|
||||
@@ -143,10 +143,29 @@
|
||||
"voice_search": "Voice Search"
|
||||
},
|
||||
"weather": {
|
||||
"title": "Weather"
|
||||
"title": "Weather",
|
||||
"location": "Location",
|
||||
"auto": "Auto",
|
||||
"temp_format": {
|
||||
"title": "Temperature Format",
|
||||
"celsius": "Celsius",
|
||||
"fahrenheit": "Fahrenheit",
|
||||
"kelvin": "Kelvin"
|
||||
},
|
||||
"extra_info": {
|
||||
"title": "Extra Information",
|
||||
"humidity": "Humidity",
|
||||
"wind_speed": "Wind speed",
|
||||
"min_temp": "Minimum temperature",
|
||||
"max_temp": "Maximum temperature",
|
||||
"atmospheric_pressure": "Atmospheric pressure"
|
||||
}
|
||||
},
|
||||
"quicklinks": {
|
||||
"title": "Quick Links"
|
||||
"title": "Quick Links",
|
||||
"open_new": "Open in new tab",
|
||||
"tooltip": "Tooltip",
|
||||
"chrome_apps": "Chrome Apps"
|
||||
},
|
||||
"appearance": {
|
||||
"title": "Appearance",
|
||||
|
||||
Reference in New Issue
Block a user