mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
fix: remove panelWidth prop in panel slice, use default value 420 in layout slice(single source)
This commit is contained in:
@ -26,12 +26,12 @@ const Wrap = ({
|
|||||||
isExpand,
|
isExpand,
|
||||||
children,
|
children,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const panelWidth = useStore(state => state.panelWidth)
|
const nodePanelWidth = useStore(state => state.nodePanelWidth)
|
||||||
const wrapStyle = (() => {
|
const wrapStyle = (() => {
|
||||||
if (isExpand) {
|
if (isExpand) {
|
||||||
return {
|
return {
|
||||||
...style,
|
...style,
|
||||||
width: panelWidth - 1,
|
width: nodePanelWidth - 1,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return style
|
return style
|
||||||
|
|||||||
@ -32,7 +32,7 @@ export const createLayoutSlice: StateCreator<LayoutSliceShape> = set => ({
|
|||||||
setWorkflowCanvasHeight: height => set(() => ({ workflowCanvasHeight: height })),
|
setWorkflowCanvasHeight: height => set(() => ({ workflowCanvasHeight: height })),
|
||||||
rightPanelWidth: undefined,
|
rightPanelWidth: undefined,
|
||||||
setRightPanelWidth: width => set(() => ({ rightPanelWidth: width })),
|
setRightPanelWidth: width => set(() => ({ rightPanelWidth: width })),
|
||||||
nodePanelWidth: storage.getNumber(STORAGE_KEYS.WORKFLOW.NODE_PANEL_WIDTH, 400),
|
nodePanelWidth: storage.getNumber(STORAGE_KEYS.WORKFLOW.NODE_PANEL_WIDTH, 420),
|
||||||
setNodePanelWidth: width => set(() => ({ nodePanelWidth: width })),
|
setNodePanelWidth: width => set(() => ({ nodePanelWidth: width })),
|
||||||
previewPanelWidth: storage.getNumber(STORAGE_KEYS.WORKFLOW.PREVIEW_PANEL_WIDTH, 400),
|
previewPanelWidth: storage.getNumber(STORAGE_KEYS.WORKFLOW.PREVIEW_PANEL_WIDTH, 400),
|
||||||
setPreviewPanelWidth: width => set(() => ({ previewPanelWidth: width })),
|
setPreviewPanelWidth: width => set(() => ({ previewPanelWidth: width })),
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
import type { StateCreator } from 'zustand'
|
import type { StateCreator } from 'zustand'
|
||||||
import { STORAGE_KEYS } from '@/config/storage-keys'
|
|
||||||
import { storage } from '@/utils/storage'
|
|
||||||
|
|
||||||
export type PanelSliceShape = {
|
export type PanelSliceShape = {
|
||||||
panelWidth: number
|
|
||||||
showFeaturesPanel: boolean
|
showFeaturesPanel: boolean
|
||||||
setShowFeaturesPanel: (showFeaturesPanel: boolean) => void
|
setShowFeaturesPanel: (showFeaturesPanel: boolean) => void
|
||||||
showWorkflowVersionHistoryPanel: boolean
|
showWorkflowVersionHistoryPanel: boolean
|
||||||
@ -29,7 +26,6 @@ export type PanelSliceShape = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const createPanelSlice: StateCreator<PanelSliceShape> = set => ({
|
export const createPanelSlice: StateCreator<PanelSliceShape> = set => ({
|
||||||
panelWidth: storage.getNumber(STORAGE_KEYS.WORKFLOW.NODE_PANEL_WIDTH, 420),
|
|
||||||
showFeaturesPanel: false,
|
showFeaturesPanel: false,
|
||||||
setShowFeaturesPanel: showFeaturesPanel => set(() => ({ showFeaturesPanel })),
|
setShowFeaturesPanel: showFeaturesPanel => set(() => ({ showFeaturesPanel })),
|
||||||
showWorkflowVersionHistoryPanel: false,
|
showWorkflowVersionHistoryPanel: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user