diff --git a/app.vue b/app.vue index a0c03ea..4c9d7a0 100644 --- a/app.vue +++ b/app.vue @@ -86,6 +86,7 @@ export default defineComponent({ this.loading = false; this.setTimeout(); dataJson.fonts.forEach(font => this.injectFontFace(font.font_name, font.font)); + this.redirectIfOneBrand(dataJson.items); }); }, mounted() { @@ -103,6 +104,9 @@ export default defineComponent({ t(text: string, params: Record = {}, localeToUse: string|null = null): string { return ToolboxHelper.trans(text, params, localeToUse); }, + transField(model: Typei18nModel, field: Typei18nFieldList) { + return ToolboxHelper.getTranslatableField(model, field); + }, injectFontFace(fontName: string, fontPath: string|null) { const newStyle = document.createElement("style"); if(fontPath) { @@ -113,7 +117,18 @@ export default defineComponent({ } document.head.appendChild(newStyle); }, - /** Prolong le timer pour revenir au home screen */ + /** Redirect to ranges.index if there is only one brand. */ + redirectIfOneBrand(brands: Array): void { + if (brands.length === 1) { + useAppStore().setActiveBrand(brands[0]); + this.activeBrand = brands[0]; + navigateTo(useLocaleRoute()({"name": "brands-slug", "params": {"slug": this.transField(brands[0], "slug")}})); + } else { + useAppStore().setActiveBrand(null); + this.activeBrand = null; + } + }, + /** Prolong le timer pour revenir au home screen. */ setTimeout(): void { if(this.timeout) { clearTimeout(this.timeout); @@ -121,7 +136,9 @@ export default defineComponent({ this.$nextTick(() => { this.timeout = setTimeout(() => { useAppStore().setActiveRange(null); - useAppStore().setActiveBrand(null); + window.ipcRendererObject.getJsonData().then((dataJson) => { + this.redirectIfOneBrand(dataJson.items); + }); navigateTo(useLocaleRoute()({"name": "index"})); }, useAppStore().getSettings().home_timeout * 1000); }); diff --git a/components/layout/AppFooter.vue b/components/layout/AppFooter.vue index f4348b2..400454c 100644 --- a/components/layout/AppFooter.vue +++ b/components/layout/AppFooter.vue @@ -170,7 +170,6 @@ export default defineComponent({ return ToolboxHelper.getContrastYIQ(hexcolor); }, gotoBrand(brand: TypeBrand) { - useAppStore().setActiveBrand(null); useAppStore().setActiveRange(null); useAppStore().setActiveBrand(brand); navigateTo(useLocaleRoute()({"name": "brands-slug", "params": {"slug": this.transField(brand, "slug")}})); diff --git a/components/layout/AppHeader-ldcgroup.vue b/components/layout/AppHeader-ldcgroup.vue deleted file mode 100644 index d127922..0000000 --- a/components/layout/AppHeader-ldcgroup.vue +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - - - diff --git a/components/layout/AppHeader.vue b/components/layout/AppHeader.vue index fc0d950..368d310 100644 --- a/components/layout/AppHeader.vue +++ b/components/layout/AppHeader.vue @@ -14,14 +14,14 @@ 'mx-auto': !activeRange, }" > - - +
+
+ Top bar +
+
+
+ +
+
+
-