dify/web/app/components/plugins/readme-panel/store.ts
yyh 8f93bb36ba
feat(dify-ui): add drawer (#35917)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-05-08 08:53:32 +00:00

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 }),
}))