mirror of
https://github.com/langgenius/dify.git
synced 2026-05-10 22:28:55 +08:00
35 lines
848 B
TypeScript
35 lines
848 B
TypeScript
import type { PluginDetail } from '@/app/components/plugins/types'
|
|
import { create } from 'zustand'
|
|
|
|
export type ReadmePanelPresentation = 'drawer' | 'dialog'
|
|
|
|
type ReadmePanelState = {
|
|
detail: PluginDetail
|
|
presentation: ReadmePanelPresentation
|
|
triggerId?: string
|
|
}
|
|
|
|
type OpenReadmePanelPayload = {
|
|
detail: PluginDetail
|
|
presentation?: ReadmePanelPresentation
|
|
triggerId?: string
|
|
}
|
|
|
|
type Shape = {
|
|
currentPanel?: ReadmePanelState
|
|
openReadmePanel: (payload: OpenReadmePanelPayload) => void
|
|
closeReadmePanel: () => void
|
|
}
|
|
|
|
export const useReadmePanelStore = create<Shape>(set => ({
|
|
currentPanel: undefined,
|
|
openReadmePanel: ({ detail, presentation = 'drawer', triggerId }) => set({
|
|
currentPanel: {
|
|
detail,
|
|
presentation,
|
|
triggerId,
|
|
},
|
|
}),
|
|
closeReadmePanel: () => set({ currentPanel: undefined }),
|
|
}))
|