Makelore 2.0 initial clean snapshot
This commit is contained in:
28
src/pages/Chat/index.tsx
Normal file
28
src/pages/Chat/index.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import { OpencodeChatPanel } from './OpencodeChatPanel';
|
||||
|
||||
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 navigationDraft = getNavigationDraftFromHistory();
|
||||
|
||||
return (
|
||||
<div data-testid="chat-operation-page" className="flex h-[calc(100%_+_3rem)] min-h-0 -m-6 bg-background">
|
||||
<OpencodeChatPanel variant="main" navigationDraft={navigationDraft} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Chat;
|
||||
Reference in New Issue
Block a user