mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-28 09:23:08 +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 }) {
|
export function TerminalGrid({ className }: { className?: string }) {
|
||||||
const layout = useTerminalGridStore(selectTerminalGridLayout);
|
const layout = useTerminalGridStore(selectTerminalGridLayout);
|
||||||
const panes = useTerminalGridStore(selectTerminalGridPanes);
|
const panes = useTerminalGridStore(selectTerminalGridPanes);
|
||||||
const setLayout = useTerminalGridStore((s) => s.setLayout);
|
const updateLayoutSizes = useTerminalGridStore((s) => s.updateLayoutSizes);
|
||||||
|
|
||||||
const handleSizeChange = useCallback(
|
const handleSizeChange = useCallback(
|
||||||
(sizes: number[]) => {
|
(sizes: number[]) => {
|
||||||
setLayout({ ...layout, sizes });
|
updateLayoutSizes(sizes);
|
||||||
},
|
},
|
||||||
[layout, setLayout]
|
[updateLayoutSizes]
|
||||||
);
|
);
|
||||||
|
|
||||||
const content = useMemo(() => {
|
const content = useMemo(() => {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export interface TerminalGridState {
|
|||||||
|
|
||||||
export interface TerminalGridActions {
|
export interface TerminalGridActions {
|
||||||
setLayout: (layout: AllotmentLayoutGroup) => void;
|
setLayout: (layout: AllotmentLayoutGroup) => void;
|
||||||
|
updateLayoutSizes: (sizes: number[]) => void;
|
||||||
splitPane: (paneId: PaneId, direction: 'horizontal' | 'vertical') => PaneId;
|
splitPane: (paneId: PaneId, direction: 'horizontal' | 'vertical') => PaneId;
|
||||||
closePane: (paneId: PaneId) => void;
|
closePane: (paneId: PaneId) => void;
|
||||||
assignSession: (paneId: PaneId, sessionId: string | null) => void;
|
assignSession: (paneId: PaneId, sessionId: string | null) => void;
|
||||||
@@ -82,6 +83,14 @@ export const useTerminalGridStore = create<TerminalGridStore>()(
|
|||||||
set({ layout }, false, 'terminalGrid/setLayout');
|
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) => {
|
splitPane: (paneId, direction) => {
|
||||||
const state = get();
|
const state = get();
|
||||||
const newPaneId = generatePaneId(state.nextPaneIdCounter);
|
const newPaneId = generatePaneId(state.nextPaneIdCounter);
|
||||||
|
|||||||
Reference in New Issue
Block a user