From e87d25de85eb4c5c249fc16d6f0c4cfc8d15ad8b Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Tue, 12 Nov 2024 15:30:18 +0700 Subject: [PATCH] fix: calculate base layout with system monitor panel (#3999) --- .../BottomPanel/SystemMonitor/index.tsx | 3 +-- .../Thread/ThreadCenterPanel/index.tsx | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/web/containers/Layout/BottomPanel/SystemMonitor/index.tsx b/web/containers/Layout/BottomPanel/SystemMonitor/index.tsx index 14055b535..3dfdff2f9 100644 --- a/web/containers/Layout/BottomPanel/SystemMonitor/index.tsx +++ b/web/containers/Layout/BottomPanel/SystemMonitor/index.tsx @@ -79,7 +79,7 @@ const SystemMonitor = () => { {showSystemMonitorPanel && (
{ {ramUtilitized}%
- {gpus.length > 0 && (
{gpus.map((gpu, index) => { diff --git a/web/screens/Thread/ThreadCenterPanel/index.tsx b/web/screens/Thread/ThreadCenterPanel/index.tsx index 3f74181f7..1f23e9dc5 100644 --- a/web/screens/Thread/ThreadCenterPanel/index.tsx +++ b/web/screens/Thread/ThreadCenterPanel/index.tsx @@ -147,6 +147,20 @@ const ThreadCenterPanel = () => { const showSystemMonitorPanel = useAtomValue(showSystemMonitorPanelAtom) + const [height, setHeight] = useState(0) + + useEffect(() => { + if (showSystemMonitorPanel) { + const element = document.querySelector('.system-monitor-panel') + + if (element) { + setHeight(element.clientHeight) // You can also use offsetHeight if needed + } + } else { + setHeight(0) + } + }, [showSystemMonitorPanel]) + return (
{ )}
{activeThread ? (