: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 { useActions, useValues } from 'kea'
import { IconPin, IconPinFilled } from '@posthog/icons'
import { DropdownMenuItem } from '@posthog/quill'
import { PinTarget, analyticsPinnedLogic, pinKey } from './analyticsPinnedLogic'
export function AnalyticsPinMenuItem({ target, dataAttr }: { target: PinTarget; dataAttr: string }): JSX.Element {
const { pinnedShortcutIds, shortcutDataLoading } = useValues(analyticsPinnedLogic)
const { togglePinned } = useActions(analyticsPinnedLogic)
const pinned = pinnedShortcutIds.has(pinKey(target.type, target.ref))
return (
<DropdownMenuItem disabled={shortcutDataLoading} onClick={() => togglePinned(target)} data-attr={dataAttr}>
{pinned ? <IconPinFilled /> : <IconPin />}
{pinned ? 'Unpin from sidebar' : 'Pin to sidebar'}
</DropdownMenuItem>
)
}