refactor: move logo to topbar and clip menu under topbar

Signed-off-by: steadyjaw <martin.keilaus@gmail.com>
This commit is contained in:
steadyjaw committed 2021-11-12 21:05:23 +01:00
1 parent 9af6427d66
commit 03408a026e
3 files changed
+27 -38

No files matched your search

+5 -34
View File
@@ -23,18 +23,7 @@
</style>
<template>
<v-navigation-drawer v-model="naviDrawer" :src="sidebarBackground" :mini-variant="!boolWideNavDrawer" :key="boolWideNavDrawer ? 'wide' : 'mini'" width="200px" app>
<v-list-item class="pa-0 justify-center no-text-decoration no-background small-list-item" router to="/" :ripple="false">
<v-list-item-content tile>
<template v-if="sidebarLogo">
<img :src="sidebarLogo" style="height: 32px;" class="mr-3 nav-logo" alt="Logo" />
</template>
<template v-else>
<mainsail-logo :color="logoColor" style="height: 32px;" class="mr-3 nav-logo"></mainsail-logo>
</template>
</v-list-item-content>
</v-list-item>
<v-divider></v-divider>
<v-navigation-drawer v-model="naviDrawer" :src="sidebarBackground" :mini-variant="!boolWideNavDrawer" :key="boolWideNavDrawer ? 'wide' : 'mini'" width="200px" clipped app>
<v-list class="pr-0 pt-0 ml-0">
<v-list-item-group active-class="active-nav-item">
<template v-if="countPrinters">
@@ -42,7 +31,7 @@
router to="/allPrinters"
class="small-list-item mt-1"
>
<v-list-item-icon>
<v-list-item-icon class="my-3 mr-3">
<v-icon>mdi-view-dashboard-outline</v-icon>
</v-list-item-icon>
<v-list-item-content>
@@ -58,7 +47,7 @@
v-if="showInNavi(category)"
class="small-list-item"
>
<v-list-item-icon>
<v-list-item-icon class="my-3 mr-3">
<v-icon>mdi-{{ category.icon }}</v-icon>
</v-list-item-icon>
<v-list-item-content>
@@ -116,14 +105,11 @@ import BaseMixin from '@/components/mixins/base'
import {PrinterStateKlipperConfig} from '@/store/printer/types'
import TheSelectPrinterDialog from '@/components/TheSelectPrinterDialog.vue'
import TheSidebarPrinterMenu from '@/components/TheSidebarPrinterMenu.vue'
import MainsailLogo from '@/components/ui/MainsailLogo.vue'
@Component({
components: {
MainsailLogo,
TheSidebarPrinterMenu,
TheSelectPrinterDialog
}
})
export default class TheSidebarAlt extends Mixins(BaseMixin) {
@@ -131,20 +117,12 @@ export default class TheSidebarAlt extends Mixins(BaseMixin) {
return this.$store.state.naviDrawer
}
get boolWideNavDrawer() {
return this.$store.state.gui.dashboard.boolWideNavDrawer ?? false
}
set naviDrawer(newVal: boolean) {
this.$store.dispatch('setNaviDrawer', newVal)
}
get logoColor(): string {
return this.$store.state.gui.theme.logo
}
get sidebarLogo(): string {
return this.$store.getters['files/getSidebarLogo']
get boolWideNavDrawer() {
return this.$store.state.gui.dashboard.boolWideNavDrawer ?? false
}
get sidebarBackground(): string {
@@ -163,13 +141,6 @@ export default class TheSidebarAlt extends Mixins(BaseMixin) {
return routes.filter((element) => element.showInNavi)
}
get printerName():string {
if (this.$store.state.gui.general.printername.length)
return this.$store.state.gui.general.printername
return this.$store.state.printer.hostname
}
get klippy_state(): string {
return this.$store.state.server.klippy_state
}
+21 -3
View File
@@ -6,9 +6,17 @@
<template>
<div>
<v-app-bar app elevate-on-scroll height="48px">
<v-app-bar app elevate-on-scroll height="48px" clipped-left>
<v-app-bar-nav-icon @click.stop="naviDrawer = !naviDrawer"></v-app-bar-nav-icon>
<v-toolbar-title class="text-no-wrap mr-2">{{ printerName }}</v-toolbar-title>
<router-link to="/">
<template v-if="sidebarLogo">
<img :src="sidebarLogo" style="height: 32px;" class="nav-logo ml-4 mr-1 d-none d-sm-flex" alt="Logo" />
</template>
<template v-else>
<mainsail-logo :color="logoColor" style="height: 32px;" class="nav-logo ml-4 mr-1 d-none d-sm-flex" router to="/" :ripple="false"></mainsail-logo>
</template>
</router-link>
<v-toolbar-title class="text-no-wrap ml-0 pl-2 mr-2">{{ printerName }}</v-toolbar-title>
<printer-selector v-if="countPrinters"></printer-selector>
<v-spacer></v-spacer>
<the-throttled-states></the-throttled-states>
@@ -99,6 +107,7 @@ import TheSettingsMenu from '@/components/TheSettingsMenu.vue'
import TheThrottledStates from '@/components/TheThrottledStates.vue'
import Panel from '@/components/ui/Panel.vue'
import PrinterSelector from '@/components/ui/PrinterSelector.vue'
import MainsailLogo from '@/components/ui/MainsailLogo.vue'
type uploadSnackbar = {
status: boolean
@@ -119,7 +128,8 @@ type uploadSnackbar = {
TheThrottledStates,
TheSettingsMenu,
TheTopCornerMenu,
PrinterSelector
PrinterSelector,
MainsailLogo
}
})
export default class TheTopbar extends Mixins(BaseMixin) {
@@ -183,6 +193,14 @@ export default class TheTopbar extends Mixins(BaseMixin) {
return this.$store.state.gui.dashboard.boolHideUploadAndPrintButton ?? false
}
get sidebarLogo(): string {
return this.$store.getters['files/getSidebarLogo']
}
get logoColor(): string {
return this.$store.state.gui.theme.logo
}
btnEmergencyStop() {
const confirmOnEmergencyStop = this.$store.state.gui.general.confirmOnEmergencyStop
if (confirmOnEmergencyStop) {
+1 -1
View File
@@ -237,6 +237,6 @@ export const getters: GetterTree<FarmPrinterState, any> = {
},
getPrinterWebcams: (state) => {
return state.data.gui.webcam.configs ?? []
return state.data.gui.webcam?.configs ?? []
}
}