diff --git a/src/components/modals/main/settings/sections/Navbar.jsx b/src/components/modals/main/settings/sections/Navbar.jsx index 3810f6a0..d7143ceb 100644 --- a/src/components/modals/main/settings/sections/Navbar.jsx +++ b/src/components/modals/main/settings/sections/Navbar.jsx @@ -110,10 +110,12 @@ function Navbar() { variables.stats.postEvent('feature', 'App link delete'); }; + const NAVBAR_SECTION = 'modals.main.settings.sections.appearance.navbar'; + return ( <>
@@ -161,7 +163,7 @@ function Navbar() { {showRefreshOptions && (
- + @@ -187,13 +185,13 @@ export default class QuickLinks extends PureComponent {
- {variables.getMessage('modals.main.settings.sections.quicklinks.no_quicklinks')} + {variables.getMessage(`${QUICKLINKS_SECTION}.no_quicklinks`)} {variables.getMessage('modals.main.settings.sections.message.add_some')}
diff --git a/src/components/modals/main/settings/sections/Quote.jsx b/src/components/modals/main/settings/sections/Quote.jsx index 5db9af60..3293e446 100644 --- a/src/components/modals/main/settings/sections/Quote.jsx +++ b/src/components/modals/main/settings/sections/Quote.jsx @@ -92,17 +92,19 @@ export default class QuoteSettings extends PureComponent { } render() { + const QUOTE_SECTION = 'modals.main.settings.sections.quote'; + let customSettings; if (this.state.quoteType === 'custom' && this.state.sourceSection === true) { customSettings = ( <> @@ -152,14 +154,12 @@ export default class QuoteSettings extends PureComponent {
- - {variables.getMessage('modals.main.settings.sections.quote.no_quotes')} - + {variables.getMessage(`${QUOTE_SECTION}.no_quotes`)} {variables.getMessage('modals.main.settings.sections.message.add_some')}
@@ -175,15 +175,13 @@ export default class QuoteSettings extends PureComponent { <> {this.state.sourceSection ? ( this.setState({ sourceSection: false })}> - - {variables.getMessage('modals.main.settings.sections.quote.title')} - + {variables.getMessage(`${QUOTE_SECTION}.title`)} {' '} {variables.getMessage('modals.main.settings.sections.background.source.title')} ) : (
- {variables.getMessage('modals.main.settings.sections.quote.source_subtitle')} + {variables.getMessage(`${QUOTE_SECTION}.source_subtitle`)} @@ -214,23 +212,21 @@ export default class QuoteSettings extends PureComponent { - + {!this.state.sourceSection && ( <> {/**/} diff --git a/src/components/modals/main/settings/sections/Search.jsx b/src/components/modals/main/settings/sections/Search.jsx index 7ec8b384..31500298 100644 --- a/src/components/modals/main/settings/sections/Search.jsx +++ b/src/components/modals/main/settings/sections/Search.jsx @@ -68,46 +68,48 @@ export default class SearchSettings extends PureComponent { } render() { + const SEARCH_SECTION = 'modals.main.settings.sections.search'; + return ( <>
{/* not supported on firefox */} {navigator.userAgent.includes('Chrome') && typeof InstallTrigger === 'undefined' ? ( ) : null} ))} - {variables.getMessage('modals.main.settings.sections.search.custom').split(' ')[0]} + {variables.getMessage(`${SEARCH_SECTION}.custom`).split(' ')[0]}
- + this.setState({ customValue: e.target.value })} varient="outlined" diff --git a/src/components/modals/main/settings/sections/Time.jsx b/src/components/modals/main/settings/sections/Time.jsx index b56550e5..37517081 100644 --- a/src/components/modals/main/settings/sections/Time.jsx +++ b/src/components/modals/main/settings/sections/Time.jsx @@ -26,23 +26,23 @@ export default class TimeSettings extends PureComponent { render() { let timeSettings = null; + const TIME_SECTION = 'modals.main.settings.sections.time'; + const digitalSettings = ( @@ -64,38 +64,38 @@ export default class TimeSettings extends PureComponent { const analogSettings = ( @@ -160,7 +160,7 @@ export default class TimeSettings extends PureComponent { return ( <>
this.setState({ timeType: value })} category="clock" > - + diff --git a/src/components/modals/main/settings/sections/Weather.jsx b/src/components/modals/main/settings/sections/Weather.jsx index 4e3890ec..82764681 100644 --- a/src/components/modals/main/settings/sections/Weather.jsx +++ b/src/components/modals/main/settings/sections/Weather.jsx @@ -63,44 +63,64 @@ export default class TimeSettings extends PureComponent { render() { const weatherType = localStorage.getItem('weatherType'); + const WEATHER_SECTION = 'modals.main.settings.sections.weather'; + + const weatherOptions = [ + { + name: 'weatherdescription', + textKey: `${WEATHER_SECTION}.extra_info.show_description`, + }, + { + name: 'cloudiness', + textKey: `${WEATHER_SECTION}.extra_info.cloudiness`, + }, + { name: 'humidity', textKey: `${WEATHER_SECTION}.extra_info.humidity` }, + { + name: 'visibility', + textKey: `${WEATHER_SECTION}.extra_info.visibility`, + }, + { + name: 'windspeed', + textKey: `${WEATHER_SECTION}.extra_info.wind_speed`, + onChange: () => this.setState({ windSpeed: localStorage.getItem('windspeed') !== 'true' }), + }, + { + name: 'windDirection', + textKey: `${WEATHER_SECTION}.extra_info.wind_direction`, + disabled: this.state.windSpeed, + }, + { + name: 'atmosphericpressure', + textKey: `${WEATHER_SECTION}.extra_info.atmospheric_pressure`, + }, + ]; + return ( <>
- + this.forceUpdate()} > - - - - + + + + - + this.changeLocation(e)} placeholder="London" @@ -109,34 +129,26 @@ export default class TimeSettings extends PureComponent { /> this.getAuto()}> - {variables.getMessage('modals.main.settings.sections.weather.auto')} + {variables.getMessage(`${WEATHER_SECTION}.auto`)} {weatherType === '4' && ( - - - - - - this.setState({ - windSpeed: localStorage.getItem('windspeed') !== 'true', - }) - } - /> - - + {weatherOptions.map((item) => ( + + ))} )}