import { OpencodeChatPanel } from './OpencodeChatPanel'; import { useNavigate } from 'react-router-dom'; function getNavigationDraft(state: unknown): string | undefined { if (!state || typeof state !== 'object') return undefined; const draft = (state as { draft?: unknown }).draft; return typeof draft === 'string' && draft.trim() ? draft : undefined; } function getNavigationDraftFromHistory(): string | undefined { if (typeof window === 'undefined') return undefined; const historyState = window.history.state as { usr?: unknown } | unknown; const userState = historyState && typeof historyState === 'object' && 'usr' in historyState ? (historyState as { usr?: unknown }).usr : historyState; return getNavigationDraft(userState); } export function Chat() { const navigate = useNavigate(); const navigationDraft = getNavigationDraftFromHistory(); return (
navigate('/project-config')} />
); } export default Chat;