fix(core): update

This commit is contained in:
Philipp Kunz 2020-12-07 04:07:32 +00:00
parent 37d343da03
commit 97b88d965c

View File

@ -102,7 +102,7 @@ export class WccDashboard extends LitElement {
if (typeof this.selectedItem === 'function') { if (typeof this.selectedItem === 'function') {
return this.selectedItem(); return this.selectedItem();
} else { } else {
console.error('The selected item looks strange:') console.error('The selected item looks strange:');
console.log(this.selectedItem); console.log(this.selectedItem);
} }
} else if (this.selectedType === 'element' && this.selectedItem) { } else if (this.selectedType === 'element' && this.selectedItem) {
@ -138,22 +138,25 @@ export class WccDashboard extends LitElement {
public async firstUpdated() { public async firstUpdated() {
this.domtools = await plugins.deesDomtools.DomTools.setupDomTools(); this.domtools = await plugins.deesDomtools.DomTools.setupDomTools();
this.domtools.router.on('/wcctools-route/:itemType/:itemName/:viewport/:theme', async (routeInfo) => { this.domtools.router.on(
this.selectedType = routeInfo.params.itemType as TElementType; '/wcctools-route/:itemType/:itemName/:viewport/:theme',
this.selectedItemName = routeInfo.params.itemName; async (routeInfo) => {
this.selectedViewport = routeInfo.params.viewport as TViewport; this.selectedType = routeInfo.params.itemType as TElementType;
this.selectedTheme = routeInfo.params.theme as TTheme; this.selectedItemName = routeInfo.params.itemName;
if (routeInfo.params.itemType === 'element') { this.selectedViewport = routeInfo.params.viewport as TViewport;
this.selectedItem = this.elements[routeInfo.params.itemName]; this.selectedTheme = routeInfo.params.theme as TTheme;
} else if (routeInfo.params.itemType === 'page') { if (routeInfo.params.itemType === 'element') {
this.selectedItem = this.pages[routeInfo.params.itemName]; this.selectedItem = this.elements[routeInfo.params.itemName];
} else if (routeInfo.params.itemType === 'page') {
this.selectedItem = this.pages[routeInfo.params.itemName];
}
const domtoolsInstance = await plugins.deesDomtools.elementBasic.setup();
domtoolsInstance.setVirtualViewport(routeInfo.params.viewport as TViewport);
this.selectedTheme === 'bright'
? domtoolsInstance.themeManager.goBright()
: domtoolsInstance.themeManager.goDark();
} }
const domtoolsInstance = await plugins.deesDomtools.elementBasic.setup(); );
domtoolsInstance.setVirtualViewport(routeInfo.params.viewport as TViewport);
this.selectedTheme === 'bright' ?
domtoolsInstance.themeManager.goBright() :
domtoolsInstance.themeManager.goDark();
});
} }
private updating = false; private updating = false;
@ -178,9 +181,7 @@ export class WccDashboard extends LitElement {
public buildUrl() { public buildUrl() {
this.domtools.router.pushUrl( this.domtools.router.pushUrl(
`/wcctools-route/${this.selectedType}/${this.selectedItemName}/${this.selectedViewport}/${ `/wcctools-route/${this.selectedType}/${this.selectedItemName}/${this.selectedViewport}/${this.selectedTheme}`
this.selectedTheme
}`
); );
} }
} }