diff --git a/admin-lehrer/app/(admin)/ai/rag/components/ChunkBrowserQA.tsx b/admin-lehrer/app/(admin)/ai/rag/components/ChunkBrowserQA.tsx index 2a48a3a..8b4dbfa 100644 --- a/admin-lehrer/app/(admin)/ai/rag/components/ChunkBrowserQA.tsx +++ b/admin-lehrer/app/(admin)/ai/rag/components/ChunkBrowserQA.tsx @@ -52,6 +52,7 @@ export function ChunkBrowserQA({ apiProxy }: ChunkBrowserQAProps) { // Split-View const [splitViewActive, setSplitViewActive] = useState(true) const [chunksPerPage, setChunksPerPage] = useState(6) + const [fullscreen, setFullscreen] = useState(false) // Collection — default to bp_compliance_ce where we have PDFs downloaded const [collection, setCollection] = useState('bp_compliance_ce') @@ -242,21 +243,24 @@ export function ChunkBrowserQA({ apiProxy }: ChunkBrowserQAProps) { } const handleKeyDown = useCallback((e: KeyboardEvent) => { - if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') { + if (e.key === 'Escape' && fullscreen) { + e.preventDefault() + setFullscreen(false) + } else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') { e.preventDefault() setDocChunkIndex(i => Math.max(0, i - 1)) } else if (e.key === 'ArrowRight' || e.key === 'ArrowDown') { e.preventDefault() setDocChunkIndex(i => Math.min(docChunksRef.current.length - 1, i + 1)) } - }, []) + }, [fullscreen]) useEffect(() => { - if (selectedRegulation && docChunks.length > 0) { + if (fullscreen || (selectedRegulation && docChunks.length > 0)) { window.addEventListener('keydown', handleKeyDown) return () => window.removeEventListener('keydown', handleKeyDown) } - }, [selectedRegulation, docChunks.length, handleKeyDown]) + }, [selectedRegulation, docChunks.length, handleKeyDown, fullscreen]) const toggleGroup = (group: string) => { setCollapsedGroups(prev => { @@ -340,7 +344,10 @@ export function ChunkBrowserQA({ apiProxy }: ChunkBrowserQAProps) { const structInfo = getStructuralInfo(currentChunk) return ( -
+
{/* Header bar — fixed height */}
@@ -424,6 +431,15 @@ export function ChunkBrowserQA({ apiProxy }: ChunkBrowserQAProps) { > {splitViewActive ? 'Split-View an' : 'Split-View aus'} +
)}