Files
ComfyUI_frontend/src/stores/dialogStore.ts
Chenlei Hu 79469bd2b1 Missing node dialog revamp (#322)
* Basic rework of load workflow warning dialog

* Better style

* Add vue jest support

* Mock vue component in jest test

* nit

* Make dialog maximizable
2024-08-06 20:11:05 -04:00

39 lines
880 B
TypeScript

// We should consider moving to https://primevue.org/dynamicdialog/ once everything is in Vue.
// Currently we need to bridge between legacy app code and Vue app with a Pinia store.
import { defineStore } from 'pinia'
import { Component } from 'vue'
interface DialogState {
isVisible: boolean
title: string
component: Component | null
props: Record<string, any>
}
export const useDialogStore = defineStore('dialog', {
state: (): DialogState => ({
isVisible: false,
title: '',
component: null,
props: {}
}),
actions: {
showDialog(options: {
title?: string
component: Component
props?: Record<string, any>
}) {
this.title = options.title
this.component = options.component
this.props = options.props || {}
this.isVisible = true
},
closeDialog() {
this.isVisible = false
}
}
})