57 lines
1.5 KiB
TypeScript
57 lines
1.5 KiB
TypeScript
import { defineStore } from 'pinia'
|
|
|
|
export const useUIStore = defineStore('ui', {
|
|
state: () => ({
|
|
showSettingsModal: false,
|
|
showKBEditorModal: false,
|
|
kbEditorMode: 'create' as 'create' | 'edit',
|
|
currentKBId: null as string | null,
|
|
kbEditorInitialSection: null as string | null,
|
|
settingsInitialSection: null as string | null,
|
|
settingsInitialSubSection: null as string | null
|
|
}),
|
|
|
|
actions: {
|
|
openSettings(section?: string, subSection?: string) {
|
|
this.settingsInitialSection = section || null
|
|
this.settingsInitialSubSection = subSection || null
|
|
this.showSettingsModal = true
|
|
},
|
|
|
|
closeSettings() {
|
|
this.showSettingsModal = false
|
|
this.settingsInitialSection = null
|
|
this.settingsInitialSubSection = null
|
|
},
|
|
|
|
toggleSettings() {
|
|
this.showSettingsModal = !this.showSettingsModal
|
|
},
|
|
|
|
openKBSettings(kbId: string, initialSection?: string) {
|
|
this.currentKBId = kbId
|
|
this.kbEditorMode = 'edit'
|
|
this.kbEditorInitialSection = initialSection || null
|
|
this.showKBEditorModal = true
|
|
},
|
|
|
|
openEditKB(kbId: string, initialSection?: string) {
|
|
this.openKBSettings(kbId, initialSection)
|
|
},
|
|
|
|
openCreateKB() {
|
|
this.currentKBId = null
|
|
this.kbEditorMode = 'create'
|
|
this.kbEditorInitialSection = null
|
|
this.showKBEditorModal = true
|
|
},
|
|
|
|
closeKBEditor() {
|
|
this.showKBEditorModal = false
|
|
this.currentKBId = null
|
|
this.kbEditorInitialSection = null
|
|
}
|
|
}
|
|
})
|
|
|