fix: weather with offline mode, maximise fixes, voice search hot reload

This commit is contained in:
David Ralph
2021-06-30 14:11:45 +01:00
parent 2dcaa5270d
commit 6aa1c6b0ea
3 changed files with 13 additions and 12 deletions

View File

@@ -76,7 +76,9 @@ export default class SearchSettings extends React.PureComponent {
<>
<h2>{search.title}</h2>
<Switch name='searchBar' text={language.enabled} category='widgets' />
{(navigator.userAgent.includes('Chrome') && typeof InstallTrigger === 'undefined') ? <Checkbox name='voiceSearch' text={search.voice_search} category='search' element='.other' /> : null}
{(navigator.userAgent.includes('Chrome') && typeof InstallTrigger === 'undefined') ?
<Checkbox name='voiceSearch' text={search.voice_search} category='search'/>
: null}
<Dropdown label={search.search_engine} name='searchEngine' onChange={(value) => this.setSearchEngine(value)}>
{searchEngines.map((engine) => (
<option key={engine.name} value={engine.settingsName}>{engine.name}</option>

View File

@@ -60,7 +60,7 @@ export default class Widgets extends React.PureComponent {
<React.Suspense fallback={renderLoader()}>
{this.enabled('searchBar') ? <Search/> : null}
{elements}
{this.enabled('weatherEnabled') && !localStorage.getItem('offlineMode') ? <Weather/> : null}
{this.enabled('weatherEnabled') && (localStorage.getItem('offlineMode') === 'false') ? <Weather/> : null}
</React.Suspense>
</div>
);

View File

@@ -13,6 +13,12 @@ export default class Maximise extends React.PureComponent {
}
setAttribute(blur, brightness, filter) {
// don't attempt to modify the background if it isn't an image
const backgroundType = localStorage.getItem('backgroundType');
if (backgroundType === 'colour') {
return;
}
const element = document.getElementById('backgroundImage');
let backgroundFilter;
@@ -27,16 +33,9 @@ export default class Maximise extends React.PureComponent {
}
maximise = () => {
// elements to hide
const elements = ['.searchBar', '.clock', '.greeting', '.quotediv', 'time', '.quicklinks-container', '.weather', '.date'];
elements.forEach((element) => {
try {
(this.state.hidden === false) ? document.querySelector(element).style.display = 'none' : document.querySelector(element).style.display = 'block';
} catch (e) {
return;
}
});
// hide widgets
const widgets = document.getElementById('widgets');
(this.state.hidden === false) ? widgets.style.display = 'none' : widgets.style.display = 'block';
if (this.state.hidden === false) {
this.setState({