: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { useValues } from 'kea'
import { useState } from 'react'
import { Fade } from 'lib/components/Fade/Fade'
import { FloatingContainerContext } from 'lib/hooks/useFloatingContainerContext'
import { toolbarLogic } from '../../shared/bar/toolbarLogic'
import { toolbarConfigLogic } from '../../shared/toolbarConfigLogic'
import { Toolbar } from './bar/Toolbar'
import { ToolbarFixedZones } from './bar/ToolbarFixedZones'
import { Elements } from './elements/Elements'
import { HedgehogButton } from './hedgehog/HedgehogButton'
export function ToolbarContainer(): JSX.Element {
const { buttonVisible } = useValues(toolbarConfigLogic)
const { theme } = useValues(toolbarLogic)
// KLUDGE: if we put theme directly on the div then
// linting and typescript complain about it not being
// a valid attribute. So we put it in a variable and
// spread it in. 🤷
const themeProps = { theme }
const [floatingContainer, setFloatingContainer] = useState<HTMLDivElement | null>(null)
return (
<Fade visible={buttonVisible} className="toolbar-global-fade-container">
<FloatingContainerContext.Provider value={floatingContainer}>
<Elements />
<ToolbarFixedZones />
<div id="button-toolbar" {...themeProps}>
<Toolbar />
</div>
<HedgehogButton />
<div
ref={setFloatingContainer}
{...themeProps}
className="fixed inset-0 pointer-events-none z-[2147483647] [&>*]:pointer-events-auto"
/>
</FloatingContainerContext.Provider>
</Fade>
)
}