Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

828 B
Raw Blame
import { ReactNode } from 'react'

import { useResizeBreakpoints } from 'lib/hooks/useResizeObserver'

import { NotebookBtw } from './NotebookBtw'
import type { NotebookBtwSession } from './notebookBtwLogic'

export function NotebookBtwLayout({
    children,
    session,
    onClose,
}: {
    children: ReactNode
    session: NotebookBtwSession | null
    onClose: () => void
}): JSX.Element {
    // Leave room for the notebook beside the conversation, including inside another side panel.
    const { ref, size } = useResizeBreakpoints({ 0: 'modal', 900: 'sidebar' })

    return (
        <div ref={ref} className="flex min-w-0 flex-1 gap-4">
            <div className="min-w-0 flex-1">{children}</div>
            {session && <NotebookBtw session={session} onClose={onClose} presentation={size} />}
        </div>
    )
}