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.

1.2 KB
Raw Blame
import { useActions } from 'kea'
import { ComponentType, memo, Suspense } from 'react'

import { Spinner } from 'lib/lemon-ui/Spinner'
import { ChunkLoadErrorBoundary } from 'scenes/ChunkLoadErrorBoundary'

import { ErrorBoundary } from '~/layout/ErrorBoundary'
import { CoreFilterDefinitionsGate } from '~/taxonomy/CoreFilterDefinitionsGate'
import { SidePanelTab } from '~/types'

import { SidePanelNavigation } from './SidePanelNavigation'
import { sidePanelStateLogic } from './sidePanelStateLogic'

export const SidePanelContent = memo(function SidePanelContent({
    activeTab,
    Content,
}: {
    activeTab: SidePanelTab
    Content: ComponentType
}): JSX.Element {
    const { openSidePanel } = useActions(sidePanelStateLogic)

    return (
        <SidePanelNavigation activeTab={activeTab} onTabChange={openSidePanel}>
            <ErrorBoundary>
                <ChunkLoadErrorBoundary>
                    <Suspense fallback={<Spinner className="text-4xl mx-auto mt-16" />}>
                        <CoreFilterDefinitionsGate>
                            <Content />
                        </CoreFilterDefinitionsGate>
                    </Suspense>
                </ChunkLoadErrorBoundary>
            </ErrorBoundary>
        </SidePanelNavigation>
    )
})