2025-12-07 19:32:53 +02:00
|
|
|
import React from 'react';
|
|
|
|
|
import { ChatContainer } from '@/components/chat/ChatContainer';
|
|
|
|
|
import { ChatErrorBoundary } from '@/components/chat/ChatErrorBoundary';
|
2026-03-31 18:47:00 +03:00
|
|
|
import { useSessionUIStore } from '@/sync/session-ui-store';
|
2025-12-07 19:32:53 +02:00
|
|
|
|
2026-05-15 22:16:04 +03:00
|
|
|
type ChatViewProps = {
|
2026-07-21 20:52:20 +03:00
|
|
|
active?: boolean;
|
2026-08-14 18:51:04 +00:00
|
|
|
/**
|
|
|
|
|
* Controls message-history subscription independently of `active`.
|
|
|
|
|
* Embedded session-chat panels keep this true so history stays visible
|
|
|
|
|
* while composer focus / background work remain gated by visibility.
|
|
|
|
|
*/
|
|
|
|
|
messagesEnabled?: boolean;
|
2026-05-15 22:16:04 +03:00
|
|
|
readOnly?: boolean;
|
2026-08-13 22:00:15 +03:00
|
|
|
initialAllowPromptingSubagentSessions?: boolean;
|
2026-05-15 22:16:04 +03:00
|
|
|
};
|
|
|
|
|
|
2026-08-14 18:51:04 +00:00
|
|
|
export const ChatView: React.FC<ChatViewProps> = ({
|
|
|
|
|
active = true,
|
|
|
|
|
messagesEnabled,
|
|
|
|
|
readOnly = false,
|
|
|
|
|
initialAllowPromptingSubagentSessions,
|
|
|
|
|
}) => {
|
2026-03-31 18:47:00 +03:00
|
|
|
const currentSessionId = useSessionUIStore((state) => state.currentSessionId);
|
2025-12-07 19:32:53 +02:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<ChatErrorBoundary sessionId={currentSessionId || undefined}>
|
2026-08-13 22:00:15 +03:00
|
|
|
<ChatContainer
|
|
|
|
|
active={active}
|
2026-08-14 18:51:04 +00:00
|
|
|
messagesEnabled={messagesEnabled}
|
2026-08-13 22:00:15 +03:00
|
|
|
readOnly={readOnly}
|
|
|
|
|
initialAllowPromptingSubagentSessions={initialAllowPromptingSubagentSessions}
|
|
|
|
|
/>
|
2025-12-07 19:32:53 +02:00
|
|
|
</ChatErrorBoundary>
|
|
|
|
|
);
|
|
|
|
|
};
|