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

fix(Editor): fix docs link for Kalico #2080

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 7 additions & 5 deletions src/components/TheEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ import { Component, Mixins, Ref, Watch } from 'vue-property-decorator'
import BaseMixin from '@/components/mixins/base'
import { capitalize, formatFilesize, windowBeforeUnloadFunction } from '@/plugins/helpers'
import Panel from '@/components/ui/Panel.vue'
import { availableKlipperConfigReferenceTranslations } from '@/store/variables'
import { klipperRepos } from '@/store/variables'
import CodemirrorAsync from '@/components/inputs/CodemirrorAsync'
import {
mdiClose,
Expand Down Expand Up @@ -346,13 +346,15 @@ export default class TheEditor extends Mixins(BaseMixin) {

get klipperConfigReference(): string {
const currentLanguage = this.currentLanguage
const translations = availableKlipperConfigReferenceTranslations
let url = 'https://www.klipper3d.org/Config_Reference.html'
const klipperRepo = klipperRepos[this.klipperAppName] ?? klipperRepos.Klipper

if (translations.includes(currentLanguage)) {
url = `https://www.klipper3d.org/${currentLanguage}/Config_Reference.html`
let url = klipperRepo.url
if (klipperRepo.docsLanguages?.includes(currentLanguage)) {
url += `${currentLanguage}/`
}

url += 'Config_Reference.html'

return url
}

Expand Down
4 changes: 4 additions & 0 deletions src/components/mixins/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ export default class BaseMixin extends Vue {
return this.socketIsConnected && this.klipperState === 'ready'
}

get klipperAppName() {
return this.$store.state.printer.app_name ?? 'Klipper'
}

get printerIsPrinting() {
return this.klipperReadyForGui && ['printing', 'paused'].includes(this.printer_state)
}
Expand Down
7 changes: 7 additions & 0 deletions src/store/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,10 @@ export interface Theme {
}
css?: boolean
}

export interface KlipperRepos {
[name: string]: {
url: string
docsLanguages?: string[]
}
}
21 changes: 14 additions & 7 deletions src/store/variables.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Theme } from '@/store/types'
import { KlipperRepos, Theme } from '@/store/types'

export const defaultMode = 'dark'
export const defaultTheme = 'mainsail'
Expand Down Expand Up @@ -128,12 +128,6 @@ export const hiddenRootDirectories = ['gcodes', 'timelapse', 'timelapse_frames']
*/
export const hiddenDirectories = ['.git']

/*
* List of available Klipper config reference translations
* https://www.klipper3d.org/Config_Reference.html
*/
export const availableKlipperConfigReferenceTranslations = ['it', 'hu', 'zh']

/*
* List of all downloadable logfiles
*/
Expand Down Expand Up @@ -204,3 +198,16 @@ export const themes: Theme[] = [
logo: { show: true, light: false },
},
]

/*
* List of all supported Klipper-Repos
*/
export const klipperRepos: KlipperRepos = {
Klipper: {
url: 'https://www.klipper3d.org/',
docsLanguages: ['it', 'hu', 'zh'],
},
Kalico: {
url: 'https://docs.kalico.gg/',
},
}
Loading