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.

feat(settings): add settings button to SceneMenuBar (#82574)

Reece Jones306d598ddf7f
diff --git a/frontend/src/layout/scenes/components/SceneMenuBar.tsx b/frontend/src/layout/scenes/components/SceneMenuBar.tsx
index ce9e20e34247..b92fb0d857e1 100644
--- a/frontend/src/layout/scenes/components/SceneMenuBar.tsx
+++ b/frontend/src/layout/scenes/components/SceneMenuBar.tsx
@@ -2,7 +2,7 @@ import { useActions, useValues } from 'kea'
import posthog from 'posthog-js'
import { Children, ComponentProps, MouseEvent, ReactNode, useContext, useEffect } from 'react'
-import { IconExternal, IconSidePanel, IconSparkles } from '@posthog/icons'
+import { IconExternal, IconGear, IconSidePanel, IconSparkles } from '@posthog/icons'
import {
Badge,
Button,
@@ -29,11 +29,16 @@ import { IconBlank } from 'lib/lemon-ui/icons'
import { LinkPrimitive } from 'lib/lemon-ui/Link'
import { cn } from 'lib/utils/css-classes'
import { sceneLogic } from 'scenes/sceneLogic'
+import type { SettingSectionId } from 'scenes/settings/types'
+import { urls } from 'scenes/urls'
import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { sceneLayoutLogic } from '~/layout/scenes/sceneLayoutLogic'
+import { ProductKey } from '~/queries/schema/schema-general'
import { SidePanelTab } from '~/types'
+import { SceneContentContext } from './SceneContent'
+
/**
* Central instrumentation for the SceneMenuBar experiment (`SCENE_MENU_BAR` flag). Capturing
* here means every scene that adopts the bar reports engagement without per-scene wiring.
@@ -58,6 +63,23 @@ type SceneMenuBarProps = {
className?: string
}
+const SETTINGS_SECTION_BY_PRODUCT: Partial<Record<ProductKey, SettingSectionId>> = {
+ [ProductKey.PRODUCT_ANALYTICS]: 'environment-product-analytics',
+ [ProductKey.WEB_ANALYTICS]: 'environment-web-analytics',
+ [ProductKey.SESSION_REPLAY]: 'environment-replay',
+ [ProductKey.FEATURE_FLAGS]: 'environment-feature-flags',
+ [ProductKey.EXPERIMENTS]: 'environment-experiments',
+ [ProductKey.SURVEYS]: 'environment-surveys',
+ [ProductKey.AI_OBSERVABILITY]: 'environment-ai-observability',
+ [ProductKey.LOGS]: 'environment-logs',
+ [ProductKey.WORKFLOWS]: 'environment-workflows',
+}
+
+function getSettingsUrl(productKey: ProductKey | null): string | null {
+ const section = productKey ? SETTINGS_SECTION_BY_PRODUCT[productKey] : undefined
+ return section ? urls.settings(section) : null
+}
+
export function SceneMenuBar({ children, className }: SceneMenuBarProps): JSX.Element {
const { sceneLayoutConfig } = useValues(sceneLayoutLogic)
const layout = sceneLayoutConfig?.layout ?? 'app'
@@ -108,8 +130,22 @@ const RIGHT_TRIGGER_CLASSES = 'px-2 h-7 rounded-sm text-xs font-medium inline-fl
function SceneMenuBarRightLinks(): JSX.Element {
const { openSidePanel } = useActions(sidePanelStateLogic)
+ const { productKey } = useContext(SceneContentContext)
+ const settingsUrl = getSettingsUrl(productKey)
+
return (
<div className="flex items-center gap-px pr-1">
+ {settingsUrl && (
+ <Button
+ data-attr="scene-menu-bar-settings"
+ className={RIGHT_TRIGGER_CLASSES}
+ onClick={() => captureSceneMenuBar('scene menu bar right link clicked', { link: 'settings' })}
+ render={<LinkPrimitive to={settingsUrl} />}
+ >
+ Settings
+ <IconGear />
+ </Button>
+ )}
<Button
data-attr="scene-menu-bar-docs"
className={RIGHT_TRIGGER_CLASSES}
@@ -166,7 +202,7 @@ function SceneMenuBarRightLinks(): JSX.Element {
* Activity indicator, ExternalReferences.
* - **Staff only** *(conditional)* — Debug panels, internal toggles.
*
- * Right cluster is universal: PostHog AI / Docs / Support.
+ * Right cluster includes PostHog AI, Docs, Support, and Settings when configured for the scene's product.
*
* Full conventions: `.agents/skills/scene-menu-bar/SKILL.md`.
*/