diff --git a/web/containers/MainViewContainer/index.tsx b/web/containers/MainViewContainer/index.tsx index 811f19c6e..6417ec63a 100644 --- a/web/containers/MainViewContainer/index.tsx +++ b/web/containers/MainViewContainer/index.tsx @@ -1,4 +1,4 @@ -import { memo } from 'react' +import { memo, useEffect, useState } from 'react' import { motion as m } from 'framer-motion' import { useAtomValue } from 'jotai' @@ -12,10 +12,27 @@ import LocalServerScreen from '@/screens/LocalServer' import SettingsScreen from '@/screens/Settings' import ThreadScreen from '@/screens/Thread' -import { mainViewStateAtom } from '@/helpers/atoms/App.atom' +import { + mainViewStateAtom, + showSystemMonitorPanelAtom, +} from '@/helpers/atoms/App.atom' const MainViewContainer = () => { const mainViewState = useAtomValue(mainViewStateAtom) + 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]) let children = null switch (mainViewState) { @@ -37,7 +54,10 @@ const MainViewContainer = () => { } return ( -
+
{ const isGeneratingResponse = useAtomValue(isGeneratingResponseAtom) - 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 ? (