Commit 16fe3fc9 authored by akiraohgaki's avatar akiraohgaki

Add page refresh button

parent c8c93895
......@@ -10,6 +10,7 @@ export default class ToolBar extends Chirit.Component {
active: '',
backAction: '',
forwardAction: '',
refreshAction: '',
homeAction: '',
collectionAction: '',
indicator: false,
......@@ -21,6 +22,7 @@ export default class ToolBar extends Chirit.Component {
html() {
const backButtonAttr = this.state.backAction ? `data-dispatch="${this.state.backAction}"` : 'disabled';
const forwardButtonAttr = this.state.forwardAction ? `data-dispatch="${this.state.forwardAction}"` : 'disabled';
const refreshButtonAttr = this.state.refreshAction ? `data-dispatch="${this.state.refreshAction}"` : 'disabled';
const homeButtonAttr = this.state.homeAction ? `data-dispatch="${this.state.homeAction}"` : 'disabled';
const collectionButtonAttr = this.state.collectionAction ? `data-dispatch="${this.state.collectionAction}"` : 'disabled';
const collectionButtonImportant = this.state.updateAvailable ? 'important' : '';
......@@ -28,10 +30,11 @@ export default class ToolBar extends Chirit.Component {
return `
<button class="toolbar-button icon-chevron-left" ${backButtonAttr}></button>
<button class="toolbar-button icon-chevron-right" ${forwardButtonAttr}></button>
<button class="toolbar-button icon-refresh refresh-button" ${refreshButtonAttr}></button>
<span class="toolbar-indicator icon-loading"></span>
<button class="toolbar-button icon-home label page-button" ${homeButtonAttr}>Browse</button>
<button class="toolbar-button icon-folder label page-button ${collectionButtonImportant}" ${collectionButtonAttr}>Installed</button>
<span class="toolbar-spacer"></span>
<span class="toolbar-indicator icon-loading"></span>
<select class="toolbar-select" name="startPage">
<option value="">Choose Startpage</option>
<option value="https://www.opendesktop.org/">opendesktop.org</option>
......@@ -154,11 +157,13 @@ export default class ToolBar extends Chirit.Component {
showIndicator() {
this.state.indicator = true;
this.element.querySelector('.toolbar-indicator').style.display = 'inline-block';
this.element.querySelector('.refresh-button').style.display = 'none';
}
hideIndicator() {
this.state.indicator = false;
this.element.querySelector('.toolbar-indicator').style.display = 'none';
this.element.querySelector('.refresh-button').style.display = 'inline-block';
}
}
......@@ -96,6 +96,7 @@ import Root from '../components/Root.js';
active: root.toolBar.state.active,
backAction: root.toolBar.state.backAction,
forwardAction: root.toolBar.state.forwardAction,
refreshAction: root.toolBar.state.refreshAction,
homeAction: root.toolBar.state.homeAction,
collectionAction: root.toolBar.state.collectionAction,
indicator: root.toolBar.state.indicator,
......@@ -128,6 +129,7 @@ import Root from '../components/Root.js';
active: 'collection-page',
backAction: 'collection-page',
forwardAction: '',
refreshAction: '',
homeAction: 'browse-page',
collectionAction: 'collection-page',
indicator: root.toolBar.state.indicator,
......@@ -282,6 +284,7 @@ import Root from '../components/Root.js';
active: 'start-page',
backAction: 'main-webview-back',
forwardAction: 'main-webview-forward',
refreshAction: 'main-webview-refresh',
homeAction: 'start-page',
collectionAction: 'collection-page',
indicator: root.toolBar.state.indicator,
......@@ -315,11 +318,16 @@ import Root from '../components/Root.js';
}
});
stateManager.registerAction('main-webview-refresh', () => {
mainWebview.reload();
});
stateManager.registerAction('collection-page', () => {
root.toolBar.update({
active: 'collection-page',
backAction: '',
forwardAction: '',
refreshAction: '',
homeAction: 'browse-page',
collectionAction: 'collection-page',
indicator: root.toolBar.state.indicator,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment