Skip to content

Commit

Permalink
refactor: change variable bool to show in themes
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Dej <[email protected]>
  • Loading branch information
meteyou committed Jul 6, 2024
1 parent 5d0be7f commit 0492411
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export default class App extends Mixins(BaseMixin, ThemeMixin) {
}
// if a theme sidebar logo is set, use it
if ((this.theme.sidebarLogo ?? false) !== false && this.sidebarLogo.endsWith('.svg')) {
if ((this.theme?.logo?.show ?? false) && this.sidebarLogo.endsWith('.svg')) {
const response = await fetch(this.sidebarLogo)
if (!response.ok) return
Expand Down
6 changes: 3 additions & 3 deletions src/components/mixins/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class ThemeMixin extends Vue {
}

get sidebarBgImage() {
if (this.theme.sidebarBackground?.bool) {
if (this.theme.sidebarBackground?.show) {
if (this.theme.sidebarBackground?.light && this.themeMode === 'light')
return `/img/themes/sidebarBackground-${this.themeName}-light.png`

Expand All @@ -69,7 +69,7 @@ export default class ThemeMixin extends Vue {
if (url !== '' || this.themeName === 'mainsail') return url

// if no theme is set, return empty string to load the default logo
if (!(this.theme.logo?.bool ?? false)) return ''
if (!(this.theme.logo?.show ?? false)) return ''

// return light logo if theme is light and sidebarLogo is set to both
if (this.theme.logo?.light && this.themeMode === 'light')
Expand All @@ -83,7 +83,7 @@ export default class ThemeMixin extends Vue {
const url = this.$store.getters['files/getMainBackground']
if (url || this.themeName === 'mainsail') return url

if (!this.theme.mainBackground?.bool) return null
if (!this.theme.mainBackground?.show) return null

if (this.theme.mainBackground?.light && this.themeMode === 'light')
return `/img/themes/mainBackground-${this.themeName}-light.png`
Expand Down
6 changes: 3 additions & 3 deletions src/store/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ export interface Theme {
colorLogo: string
colorPrimary?: string
logo?: {
bool: boolean
show: boolean
light: boolean
}
sidebarBackground?: {
bool: boolean
show: boolean
light: boolean
}
mainBackground?: {
bool: boolean
show: boolean
light: boolean
}
}
2 changes: 1 addition & 1 deletion src/store/variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,6 @@ export const themes: Theme[] = [
name: 'klipper',
displayName: 'Klipper',
colorLogo: '#b12f35',
logo: { bool: true, light: false },
logo: { show: true, light: false },
},
]

0 comments on commit 0492411

Please sign in to comment.