fix(ui): resolve build errors and unused variable warnings

- Fixed 'refreshStatic' use-before-declaration in AppContainer.tsx.
- Removed unused 'version' and 'showHeaderDetails' variables in MainContent.tsx.
- Cleaned up unused 'useAppContext' import in MainContent.tsx.
- This commit ensures the branch builds successfully after the sticky topic header implementation.
This commit is contained in:
Abhijit Balaji
2026-04-02 10:50:37 -04:00
parent 0d50b16f69
commit ba207ad00b
2 changed files with 12 additions and 16 deletions
+12 -12
View File
@@ -257,18 +257,6 @@ export const AppContainer = (props: AppContainerProps) => {
return topic || summary ? { title: topic, summary } : null;
});
useEffect(() => {
const handleTopicUpdated = (payload: { title?: string; summary?: string }) => {
setCurrentTopic({ title: payload.title, summary: payload.summary });
refreshStatic();
};
coreEvents.on(CoreEvent.TopicUpdated, handleTopicUpdated);
return () => {
coreEvents.off(CoreEvent.TopicUpdated, handleTopicUpdated);
};
}, [refreshStatic]);
const [adminSettingsChanged, setAdminSettingsChanged] = useState(false);
const [expandedTools, setExpandedTools] = useState<Set<string>>(new Set());
@@ -698,6 +686,18 @@ export const AppContainer = (props: AppContainerProps) => {
}
}, [bannerVisible, bannerText, settings, config, refreshStatic]);
useEffect(() => {
const handleTopicUpdated = (payload: { title?: string; summary?: string }) => {
setCurrentTopic({ title: payload.title, summary: payload.summary });
refreshStatic();
};
coreEvents.on(CoreEvent.TopicUpdated, handleTopicUpdated);
return () => {
coreEvents.off(CoreEvent.TopicUpdated, handleTopicUpdated);
};
}, [refreshStatic]);
const { isSettingsDialogOpen, openSettingsDialog, closeSettingsDialog } =
useSettingsCommand();
@@ -8,7 +8,6 @@ import { Box, Static } from 'ink';
import { HistoryItemDisplay } from './HistoryItemDisplay.js';
import { useUIState } from '../contexts/UIStateContext.js';
import { useSettings } from '../contexts/SettingsContext.js';
import { useAppContext } from '../contexts/AppContext.js';
import { useAlternateBuffer } from '../hooks/useAlternateBuffer.js';
import {
@@ -29,7 +28,6 @@ const MemoizedHistoryItemDisplay = memo(HistoryItemDisplay);
// This threshold is arbitrary but should be high enough to never impact normal
// usage.
export const MainContent = () => {
const { version } = useAppContext();
const uiState = useUIState();
const isAlternateBuffer = useAlternateBuffer();
@@ -50,9 +48,7 @@ export const MainContent = () => {
mainAreaWidth,
staticAreaMaxItemHeight,
availableTerminalHeight,
cleanUiDetailsVisible,
} = uiState;
const showHeaderDetails = cleanUiDetailsVisible;
const lastUserPromptIndex = useMemo(() => {
for (let i = uiState.history.length - 1; i >= 0; i--) {