mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-27 09:13:07 +08:00
feat: Update layout management in TerminalGrid to use updateLayoutSizes for size changes
This commit is contained in:
@@ -80,13 +80,13 @@ function GridGroupRenderer({ group, minSize, onSizeChange }: GridGroupRendererPr
|
||||
export function TerminalGrid({ className }: { className?: string }) {
|
||||
const layout = useTerminalGridStore(selectTerminalGridLayout);
|
||||
const panes = useTerminalGridStore(selectTerminalGridPanes);
|
||||
const setLayout = useTerminalGridStore((s) => s.setLayout);
|
||||
const updateLayoutSizes = useTerminalGridStore((s) => s.updateLayoutSizes);
|
||||
|
||||
const handleSizeChange = useCallback(
|
||||
(sizes: number[]) => {
|
||||
setLayout({ ...layout, sizes });
|
||||
updateLayoutSizes(sizes);
|
||||
},
|
||||
[layout, setLayout]
|
||||
[updateLayoutSizes]
|
||||
);
|
||||
|
||||
const content = useMemo(() => {
|
||||
|
||||
@@ -31,6 +31,7 @@ export interface TerminalGridState {
|
||||
|
||||
export interface TerminalGridActions {
|
||||
setLayout: (layout: AllotmentLayoutGroup) => void;
|
||||
updateLayoutSizes: (sizes: number[]) => void;
|
||||
splitPane: (paneId: PaneId, direction: 'horizontal' | 'vertical') => PaneId;
|
||||
closePane: (paneId: PaneId) => void;
|
||||
assignSession: (paneId: PaneId, sessionId: string | null) => void;
|
||||
@@ -82,6 +83,14 @@ export const useTerminalGridStore = create<TerminalGridStore>()(
|
||||
set({ layout }, false, 'terminalGrid/setLayout');
|
||||
},
|
||||
|
||||
updateLayoutSizes: (sizes) => {
|
||||
const currentLayout = get().layout;
|
||||
// Only update if sizes actually changed
|
||||
if (JSON.stringify(currentLayout.sizes) !== JSON.stringify(sizes)) {
|
||||
set({ layout: { ...currentLayout, sizes } }, false, 'terminalGrid/updateLayoutSizes');
|
||||
}
|
||||
},
|
||||
|
||||
splitPane: (paneId, direction) => {
|
||||
const state = get();
|
||||
const newPaneId = generatePaneId(state.nextPaneIdCounter);
|
||||
|
||||
Reference in New Issue
Block a user