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

@@ -21,7 +21,7 @@ export default class Radio extends PureComponent {
if (this.props.name === 'language') {
// old tab name
if (localStorage.getItem('tabName') === window.language.tabname) {
localStorage.setItem('tabName', require(`../../../../translations/${value.replace('-', '_')}.json`).tabname);
localStorage.setItem('tabName', require(`translations/${value.replace('-', '_')}.json`).tabname);
}
}

View File

@@ -5,7 +5,7 @@ import Slider from '../Slider';
import Text from '../Text';
export default function AppearanceSettings() {
const { appearance } = window.language.modals.main.settings.sections;
const { appearance, background, quote } = window.language.modals.main.settings.sections;
const themeOptions = [
{
@@ -28,8 +28,16 @@ export default function AppearanceSettings() {
<Radio name='theme' title={appearance.theme.title} options={themeOptions} category='other' />
<h3>{appearance.navbar.title}</h3>
<Checkbox name='notesEnabled' text={appearance.navbar.notes} category='navbar' />
<Checkbox name='refresh' text={appearance.navbar.refresh} category='navbar' />
<Checkbox name='notesEnabled' text={appearance.navbar.notes} category='navbar' element='.other' />
<Dropdown label={appearance.navbar.refresh} name='refresh' category='navbar'>
<option value='false'>{appearance.navbar.refresh_options.none}</option>
<option value='background'>{background.title}</option>
<option value='quote'>{quote.title}</option>
<option value='quotebackground'>{quote.title} + {background.title}</option>
{/* before it was just a checkbox */}
<option value='true'>{appearance.navbar.refresh_options.page}</option>
</Dropdown>
<br/>
<Slider title={appearance.accessibility.widget_zoom} name='zoomNavbar' min='10' max='400' default='100' display='%' category='navbar' />
<h3>{appearance.font.title}</h3>

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');

View File

@@ -236,7 +236,11 @@
"navbar": {
"title": "Navigationsleiste",
"notes": "Notizen",
"refresh": "Aktualisieren"
"refresh": "Aktualisieren",
"refresh_options": {
"none": "None",
"page": "Page"
}
},
"font": {
"title": "Schriftart",

View File

@@ -36,7 +36,7 @@
"navbar": {
"tooltips": {
"update": "Update Patch Notes",
"refresh": "Refresh Page",
"refresh": "Refresh",
"feedback": "Feedback"
},
"notes": {
@@ -236,7 +236,11 @@
"navbar": {
"title": "Navbar",
"notes": "Notes",
"refresh": "Refresh button"
"refresh": "Refresh button",
"refresh_options": {
"none": "None",
"page": "Page"
}
},
"font": {
"title": "Font",

View File

@@ -236,7 +236,11 @@
"navbar": {
"title": "Navbar",
"notes": "Notes",
"refresh": "Refresh button"
"refresh": "Refresh button",
"refresh_options": {
"none": "None",
"page": "Page"
}
},
"font": {
"title": "Font",

View File

@@ -36,7 +36,7 @@
"navbar": {
"tooltips": {
"update": "Notas de actualización del parche",
"refresh": "Recargar página",
"refresh": "Recargar",
"feedback": "Comentarios"
},
"notes": {
@@ -236,7 +236,11 @@
"navbar": {
"title": "Barra de búsqueda",
"notes": "Notas",
"refresh": "Botón de recargar"
"refresh": "Botón de recargar",
"refresh_options": {
"none": "None",
"page": "Página"
}
},
"font": {
"title": "Fuente",

View File

@@ -36,7 +36,7 @@
"navbar": {
"tooltips": {
"update": "Update Patch Notes",
"refresh": "Refresh Page",
"refresh": "Refresh",
"feedback": "Réactions"
},
"notes": {
@@ -236,7 +236,11 @@
"navbar": {
"title": "Navbar",
"notes": "Notes",
"refresh": "Refresh button"
"refresh": "Refresh button",
"refresh_options": {
"none": "None",
"page": "Page"
}
},
"font": {
"title": "Font",

View File

@@ -36,7 +36,7 @@
"navbar": {
"tooltips": {
"update": "Update Patch Notes",
"refresh": "Refresh Page",
"refresh": "Refresh",
"feedback": "Feedback"
},
"notes": {
@@ -236,7 +236,11 @@
"navbar": {
"title": "Navbar",
"notes": "Notes",
"refresh": "Refresh button"
"refresh": "Refresh button",
"refresh_options": {
"none": "None",
"page": "Page"
}
},
"font": {
"title": "Font",

View File

@@ -36,7 +36,7 @@
"navbar": {
"tooltips": {
"update": "Update Patch Notes",
"refresh": "Refresh Page",
"refresh": "Refresh",
"feedback": "Feedback"
},
"notes": {
@@ -236,7 +236,11 @@
"navbar": {
"title": "Navbar",
"notes": "Notes",
"refresh": "Refresh button"
"refresh": "Refresh button",
"refresh_options": {
"none": "None",
"page": "Page"
}
},
"font": {
"title": "Font",

View File

@@ -36,7 +36,7 @@
"navbar": {
"tooltips": {
"update": "Update Patch Notes",
"refresh": "Refresh Page",
"refresh": "Refresh",
"feedback": "Feedback"
},
"notes": {
@@ -236,7 +236,11 @@
"navbar": {
"title": "Navbar",
"notes": "Notes",
"refresh": "Refresh button"
"refresh": "Refresh button",
"refresh_options": {
"none": "None",
"page": "Page"
}
},
"font": {
"title": "Font",

View File

@@ -36,7 +36,7 @@
"navbar": {
"tooltips": {
"update": "更新日志",
"refresh": "刷新页面",
"refresh": "刷新",
"feedback": "用户反馈"
},
"notes": {
@@ -236,7 +236,11 @@
"navbar": {
"title": "右上方功能键",
"notes": "备忘录",
"refresh": "刷新键"
"refresh": "刷新键",
"refresh_options": {
"none": "None",
"page": "页面"
}
},
"font": {
"title": "字体",

View File

@@ -41,8 +41,9 @@ module.exports = {
resolve: {
extensions: ['.js', '.jsx'],
alias: {
components: path.resolve(__dirname, 'src/components'),
modules: path.resolve(__dirname, 'src/modules')
components: path.resolve(__dirname, './src/components'),
modules: path.resolve(__dirname, './src/modules'),
translations: path.resolve(__dirname, './src/translations')
}
},
output: {