feat: new refresh button options

This commit is contained in:
David Ralph
2021-08-28 18:56:59 +01:00
parent 6b23e56bd6
commit 67ab7c8674
15 changed files with 92 additions and 25 deletions

View File

@@ -309,7 +309,7 @@ export default class Background extends PureComponent {
}
// uninstall photo pack reverts your background to what you had previously
if (data === 'marketplacebackgrounduninstall' || data === 'backgroundwelcome') {
if (data === 'marketplacebackgrounduninstall' || data === 'backgroundwelcome' || data === 'backgroundrefresh') {
refresh();
}
});

View File

@@ -14,6 +14,7 @@ export default class Navbar extends PureComponent {
constructor() {
super();
this.navbarContainer = createRef();
this.refreshValue = localStorage.getItem('refresh');
}
setZoom() {
@@ -32,6 +33,23 @@ export default class Navbar extends PureComponent {
this.setZoom();
}
refresh() {
switch (this.refreshValue) {
case 'background':
EventBus.dispatch('refresh', 'backgroundrefresh');
break;
case 'quote':
EventBus.dispatch('refresh', 'quoterefresh');
break;
case 'quotebackground':
EventBus.dispatch('refresh', 'quoterefresh');
EventBus.dispatch('refresh', 'backgroundrefresh');
break;
default:
window.location.reload();
}
}
render() {
const backgroundEnabled = (localStorage.getItem('background') === 'true');
@@ -53,9 +71,9 @@ export default class Navbar extends PureComponent {
</Tooltip>
: null}
{(localStorage.getItem('refresh') === 'true') ?
{(this.refreshValue !== 'false') ?
<Tooltip title={window.language.widgets.navbar.tooltips.refresh}>
<RefreshRounded className='refreshicon topicons' onClick={() => window.location.reload()}/>
<RefreshRounded className='refreshicon topicons' onClick={() => this.refresh()}/>
</Tooltip>
: null}

View File

@@ -226,6 +226,10 @@ export default class Quote extends PureComponent {
if (data === 'marketplacequoteuninstall') {
this.init();
}
if (data === 'quoterefresh') {
this.getQuote();
}
});
const interval = localStorage.getItem('quotechange');