ultisuite-client/lib/ai/use-docs-ai-panel.ts
R3D347HR4Y 303b2b1074
Some checks are pending
E2E / Playwright e2e (push) Waiting to run
wow
2026-06-11 01:22:40 +02:00

32 lines
792 B
TypeScript

"use client"
import { create } from "zustand"
type DocsAiPanelState = {
open: boolean
widthPx: number
toggle: () => void
openPanel: () => void
closePanel: () => void
setWidthPx: (width: number) => void
}
export const DOCS_AI_PANEL_DEFAULT_WIDTH_PX = 380
export const DOCS_AI_PANEL_MIN_WIDTH_PX = 280
export const DOCS_AI_PANEL_MAX_WIDTH_PX = 560
export const useDocsAiPanelStore = create<DocsAiPanelState>((set) => ({
open: false,
widthPx: DOCS_AI_PANEL_DEFAULT_WIDTH_PX,
toggle: () => set((s) => ({ open: !s.open })),
openPanel: () => set({ open: true }),
closePanel: () => set({ open: false }),
setWidthPx: (width) =>
set({
widthPx: Math.min(
DOCS_AI_PANEL_MAX_WIDTH_PX,
Math.max(DOCS_AI_PANEL_MIN_WIDTH_PX, width)
),
}),
}))