Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: light mode ui #1580

Merged
merged 23 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
627ae4d
light mode, theme mixin created
Oct 4, 2023
2e3affd
Load default theme from config.json, conditional dark attributes, lig…
Oct 15, 2023
db6b9cb
Merge branch 'develop' into lightMode
meteyou Dec 10, 2023
ff6f32f
fix: remove moonraker db check in init process
meteyou Dec 10, 2023
3e8f0eb
refactor: remove unused dark attribute in v-card and v-app elements
meteyou Dec 11, 2023
b725339
refactor: remove unused dark attribute in v-snackbar, v-tab
meteyou Dec 11, 2023
a11a94a
refactor: remove darkAttribute getter
meteyou Dec 11, 2023
f90d910
fix: change color of scrollbars in theme--light
meteyou Dec 11, 2023
08be219
fix: change border color of console entries in default size
meteyou Dec 11, 2023
b125f74
fix: fix issue in SettingsMacrosTabExpert
meteyou Dec 13, 2023
9855ca3
refactor: add some null checks
meteyou Dec 13, 2023
f059f39
refactor: change type of gui.uiSettings.theme from string to dark/light
meteyou Dec 13, 2023
6df40c1
refactor: remove unused ThemeMixin imports
meteyou Dec 13, 2023
1e4e9a3
fix: printer farm background image
meteyou Dec 13, 2023
6974817
fix: fix border color in BarsControl
meteyou Dec 13, 2023
7716aa1
fix: fix border-top in default console
meteyou Dec 13, 2023
f5dc948
fix: fix border in TheSettingsMenu
meteyou Dec 13, 2023
ed2b021
fix: fix border in ExtruderControlPanel
meteyou Dec 13, 2023
2bfbb5f
fix: fix border in ExtruderControlPanelTools
meteyou Dec 13, 2023
46417ae
fix: fix border in MiniconsolePanel
meteyou Dec 13, 2023
7b2790b
fix: fix border in ZoffsetControl
meteyou Dec 13, 2023
c60104f
refactor: refactor theme--light css block
meteyou Dec 13, 2023
001de44
fix: add light mode to circle control
meteyou Dec 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<v-app dark :style="cssVars">
<v-app :style="cssVars">
meteyou marked this conversation as resolved.
Show resolved Hide resolved
<template v-if="socketIsConnected && guiIsReady">
<the-sidebar />
<the-topbar />
Expand Down Expand Up @@ -119,6 +119,10 @@ export default class App extends Mixins(BaseMixin) {
return this.$store.state.printer.print_stats?.filename ?? ''
}

get theme(): string {
return this.$store.state.gui.uiSettings.theme
}

get logoColor(): string {
return this.$store.state.gui.uiSettings.logo
}
Expand Down Expand Up @@ -195,6 +199,11 @@ export default class App extends Mixins(BaseMixin) {
})
}

@Watch('theme')
themeChanged(newVal: string): void {
this.$vuetify.theme.dark = newVal == 'dark' ? true : false
meteyou marked this conversation as resolved.
Show resolved Hide resolved
}

drawFavicon(val: number): void {
const favicon16: HTMLLinkElement | null = document.querySelector("link[rel*='icon'][sizes='16x16']")
const favicon32: HTMLLinkElement | null = document.querySelector("link[rel*='icon'][sizes='32x32']")
Expand Down
4 changes: 2 additions & 2 deletions src/components/TheConnectingDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<template>
<v-dialog v-model="showDialog" persistent :width="400">
<v-card dark>
<v-card>
<v-toolbar flat dense>
<v-toolbar-title>
<span class="subheading">
Expand All @@ -28,7 +28,7 @@
</div>
</v-card-text>
<v-card-text v-else class="pt-5">
<v-progress-linear color="white" indeterminate></v-progress-linear>
meteyou marked this conversation as resolved.
Show resolved Hide resolved
<v-progress-linear indeterminate></v-progress-linear>
</v-card-text>
</v-card>
</v-dialog>
Expand Down
2 changes: 1 addition & 1 deletion src/components/TheEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</v-card-text>
</panel>
</v-dialog>
<v-snackbar v-model="loaderBool" :timeout="-1" :value="true" fixed right bottom dark>
<v-snackbar v-model="loaderBool" :timeout="-1" :value="true" fixed right bottom>
meteyou marked this conversation as resolved.
Show resolved Hide resolved
<div>
{{ snackbarHeadline }}
<br />
Expand Down
23 changes: 15 additions & 8 deletions src/components/TheSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
<v-navigation-drawer
:key="navigationStyle"
v-model="naviDrawer"
:src="sidebarBackground"
:mini-variant="navigationStyle === 'iconsOnly'"
:width="navigationWidth"
:temporary="boolNaviTemp"
clipped
app
:style="sidebarCssVars">
<template #img>
<v-img :src="sidebarBackground" height="100%" :style="backgroundImageStyle" />
</template>

<overlay-scrollbars class="nav-scrollbar">
<v-list class="pr-0 pt-0 ml-0">
<v-list-item-group active-class="active-nav-item">
Expand Down Expand Up @@ -53,6 +56,7 @@ import { navigationWidth, topbarHeight } from '@/store/variables'
import MainsailLogo from '@/components/ui/MainsailLogo.vue'
import SidebarItem from '@/components/ui/SidebarItem.vue'
import NavigationMixin from '@/components/mixins/navigation'
import { CSSProperties } from 'vue/types/jsx'

@Component({
components: {
Expand Down Expand Up @@ -90,14 +94,17 @@ export default class TheSidebar extends Mixins(NavigationMixin, BaseMixin) {
return !this.isMobile && this.$vuetify.breakpoint.mdAndDown
}

get sidebarCssVars(): any {
if (this.boolNaviTemp) {
return {
top: `${topbarHeight}px !important`,
'padding-bottom': `${topbarHeight}px`,
}
get sidebarCssVars(): CSSProperties {
let vars: CSSProperties = {
...(this.boolNaviTemp && { top: `${topbarHeight}px !important` }),
meteyou marked this conversation as resolved.
Show resolved Hide resolved
...(this.boolNaviTemp && { paddingBottom: `${topbarHeight}px` }),
}
return {}

return vars
}

get backgroundImageStyle(): CSSProperties {
return !this.$vuetify.theme.dark ? { filter: 'invert(1)' } : {}
meteyou marked this conversation as resolved.
Show resolved Hide resolved
}

get sidebarLogo(): string {
Expand Down
4 changes: 2 additions & 2 deletions src/components/TheTimelapseRenderingSnackbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

<template>
<div>
<v-snackbar v-model="boolShowDialogRunning" :timeout="-1" :value="true" fixed right bottom dark>
<v-snackbar v-model="boolShowDialogRunning" :timeout="-1" :value="true" fixed right bottom>
meteyou marked this conversation as resolved.
Show resolved Hide resolved
<div>{{ $t('Timelapse.TimelapseRendering') }}...</div>
<v-progress-linear v-if="progress > 0" class="mt-2" :value="progress" indeterminate></v-progress-linear>
<v-progress-linear v-if="progress === 0" class="mt-2" indeterminate></v-progress-linear>
</v-snackbar>
<v-snackbar v-model="boolShowDialogSuccess" :timeout="5000" :value="true" fixed right bottom dark>
<v-snackbar v-model="boolShowDialogSuccess" :timeout="5000" :value="true" fixed right bottom>
meteyou marked this conversation as resolved.
Show resolved Hide resolved
<div>
{{ $t('Timelapse.TimelapseRenderingSuccessful') }}
<br />
Expand Down
2 changes: 1 addition & 1 deletion src/components/TheTopbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<the-settings-menu />
<the-top-corner-menu />
</v-app-bar>
<v-snackbar v-model="uploadSnackbar.status" :timeout="-1" :value="true" fixed right bottom dark>
<v-snackbar v-model="uploadSnackbar.status" :timeout="-1" :value="true" fixed right bottom>
meteyou marked this conversation as resolved.
Show resolved Hide resolved
<strong>{{ $t('App.TopBar.Uploading') }} {{ uploadSnackbar.filename }}</strong>
<br />
{{ Math.round(uploadSnackbar.percent) }} % @ {{ formatFilesize(Math.round(uploadSnackbar.speed)) }}/s
Expand Down
2 changes: 1 addition & 1 deletion src/components/TheUpdateDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<template>
<v-dialog :value="application !== ''" persistent max-width="800" class="mx-0">
<v-card dark :loading="!complete">
<v-card :loading="!complete">
meteyou marked this conversation as resolved.
Show resolved Hide resolved
<template slot="progress">
<v-progress-linear color="primary" indeterminate></v-progress-linear>
</template>
Expand Down
60 changes: 33 additions & 27 deletions src/components/charts/HistoryAllPrintStatusChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,46 +12,52 @@
import Component from 'vue-class-component'
import { Mixins, Watch } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import ThemeMixin from '@/components/mixins/theme'
import type { ECharts } from 'echarts/core'
import { ECBasicOption } from 'echarts/types/dist/shared.d'
import { ServerHistoryStateAllPrintStatusEntry } from '@/store/server/history/types'

@Component({
components: {},
})
export default class HistoryAllPrintStatusChart extends Mixins(BaseMixin) {
export default class HistoryAllPrintStatusChart extends Mixins(BaseMixin, ThemeMixin) {
declare $refs: {
historyAllPrintStatus: any
}

private chartOptions: ECBasicOption = {
darkMode: true,
animation: false,
grid: {
top: 10,
right: 0,
bottom: 0,
left: 10,
},
tooltip: {
trigger: 'item',
borderWidth: 0,
},
series: [
{
type: 'pie',
data: [],
avoidLabelOverlap: false,
radius: ['35%', '60%'],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)',
private get chartOptions(): ECBasicOption {
return {
animation: false,
grid: {
top: 10,
right: 0,
bottom: 0,
left: 10,
},
tooltip: {
trigger: 'item',
borderWidth: 0,
},
series: [
{
type: 'pie',
data: [],
avoidLabelOverlap: false,
radius: ['35%', '60%'],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
// shadowColor: 'rgba(0, 0, 0, 0.5)',
shadowColor: 'red',
},
},
label: {
color: this.fgColorHi,
},
},
},
],
],
}
}

get selectedJobs() {
Expand Down
Loading
Loading