mirror of
https://github.com/johndoe6345789/docker-swarm-termina.git
synced 2026-04-24 21:55:13 +00:00
ContainerCard: 354 -> 91 LOC - Extract useContainerActions custom hook (88 LOC) - Split into sub-components: - ContainerHeader (77 LOC) - ContainerInfo (54 LOC) - ContainerActions (125 LOC) - DeleteConfirmDialog (41 LOC) Dashboard: 249 -> 89 LOC - Extract useContainerList hook (39 LOC) - Extract useTerminalModal hook (24 LOC) - Split into sub-components: - DashboardHeader (118 LOC) - EmptyState (44 LOC) All React components now under 150 LOC for better maintainability https://claude.ai/code/session_01U3wVqokhrL3dTeq2dTq73n
25 lines
605 B
TypeScript
25 lines
605 B
TypeScript
import { useState } from 'react';
|
|
import { Container } from '@/lib/api';
|
|
|
|
export function useTerminalModal() {
|
|
const [selectedContainer, setSelectedContainer] = useState<Container | null>(null);
|
|
const [isTerminalOpen, setIsTerminalOpen] = useState(false);
|
|
|
|
const openTerminal = (container: Container) => {
|
|
setSelectedContainer(container);
|
|
setIsTerminalOpen(true);
|
|
};
|
|
|
|
const closeTerminal = () => {
|
|
setIsTerminalOpen(false);
|
|
setTimeout(() => setSelectedContainer(null), 300);
|
|
};
|
|
|
|
return {
|
|
selectedContainer,
|
|
isTerminalOpen,
|
|
openTerminal,
|
|
closeTerminal,
|
|
};
|
|
}
|