: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
feat(desktop): overhaul settings with compact card layout (#81523)
Adam Bowkerab48e82ec5a1
diff --git a/products/desktop/packages/ui/src/features/canvas/components/ChannelNav.tsx b/products/desktop/packages/ui/src/features/canvas/components/ChannelNav.tsxindex 2c2f6377066e..2e5da710b4b5 100644--- a/products/desktop/packages/ui/src/features/canvas/components/ChannelNav.tsx+++ b/products/desktop/packages/ui/src/features/canvas/components/ChannelNav.tsx@@ -1,8 +1,8 @@import {BellIcon,EnvelopeSimple,+ GearSix,Lightning,- SlidersHorizontal,} from "@phosphor-icons/react";import {Button,@@ -261,10 +261,10 @@ export function ChannelNav() {/>) : null}<NavIcon- icon={<SlidersHorizontal size={16} />}- label="Configure"+ icon={<GearSix size={16} />}+ label="Settings"isActive={false}- onClick={withTrack("configure", () => openSettings("agents"))}+ onClick={withTrack("configure", () => openSettings())}/></div></TooltipProvider>diff --git a/products/desktop/packages/ui/src/features/settings/components/NotificationDeliveryCard.tsx b/products/desktop/packages/ui/src/features/settings/components/NotificationDeliveryCard.tsxnew file mode 100644index 000000000000..8cb43fb0a93a--- /dev/null+++ b/products/desktop/packages/ui/src/features/settings/components/NotificationDeliveryCard.tsx@@ -0,0 +1,157 @@+import { cn } from "@posthog/quill";+import type { ReactNode } from "react";++// Purely visual switch mirroring quill Switch's tokens: the whole card is the+// interactive control, and a real switch would nest a button inside a button.+function SwitchPill({ checked }: { checked: boolean }) {+ return (+ <span+ aria-hidden+ className={cn(+ "relative inline-block h-4 w-7 shrink-0 rounded-full transition-colors",+ checked ? "bg-(--primary)" : "bg-(--input)",+ )}+ >+ <span+ className={cn(+ "absolute top-0.5 left-0.5 size-3 rounded-full transition-transform",+ checked+ ? "translate-x-3 bg-(--primary-foreground)"+ : "bg-(--background)",+ )}+ />+ </span>+ );+}++export type DeliveryIllustration =+ | "push"+ | "toast"+ | "dock-badge"+ | "dock-bounce";++function AppTile({ className }: { className?: string }) {+ return (+ <div+ className={cn(+ "relative size-8 rounded-[9px] border border-(--gray-7) bg-(--gray-5)",+ className,+ )}+ >+ <div className="absolute inset-x-2 top-2 h-1 rounded-full bg-(--gray-8)" />+ <div className="absolute top-4 left-2 h-1 w-3 rounded-full bg-(--gray-7)" />+ </div>+ );+}++function Illustration({ kind }: { kind: DeliveryIllustration }) {+ switch (kind) {+ case "push":+ return (+ <div className="relative h-full w-full overflow-hidden">+ <div className="absolute top-2.5 right-2.5 flex w-24 items-center gap-1.5 rounded-md border border-(--gray-6) bg-(--color-panel-solid) p-1.5 shadow-sm">+ <div className="size-4 shrink-0 rounded-[5px] bg-(--gray-6)" />+ <div className="flex min-w-0 flex-1 flex-col gap-1">+ <div className="h-1 w-3/4 rounded-full bg-(--gray-8)" />+ <div className="h-1 w-full rounded-full bg-(--gray-6)" />+ </div>+ </div>+ </div>+ );+ case "toast":+ return (+ <div className="relative flex h-full w-full items-center justify-center">+ <div className="relative h-12 w-24 rounded-md border border-(--gray-6) bg-(--color-panel-solid)">+ <div className="absolute top-1.5 left-1.5 flex gap-0.5">+ <div className="size-1 rounded-full bg-(--gray-7)" />+ <div className="size-1 rounded-full bg-(--gray-7)" />+ </div>+ <div className="absolute right-1.5 bottom-1.5 flex w-14 items-center gap-1 rounded-sm border border-(--gray-6) bg-(--gray-4) p-1">+ <div className="size-1.5 shrink-0 rounded-full bg-(--green-9)" />+ <div className="h-1 flex-1 rounded-full bg-(--gray-8)" />+ </div>+ </div>+ </div>+ );+ case "dock-badge":+ return (+ <div className="relative flex h-full w-full items-center justify-center">+ <div className="relative">+ <AppTile />+ <div+ className="absolute size-2.5 rounded-full border-(--gray-2) border-2 bg-(--red-9)"+ style={{ top: -4, right: -4 }}+ />+ </div>+ </div>+ );+ case "dock-bounce":+ return (+ <div className="relative flex h-full w-full items-center justify-center">+ <div className="flex flex-col items-center gap-1">+ <AppTile className="-translate-y-0.5" />+ <div className="flex items-center gap-1">+ <div className="h-0.5 w-2 rounded-full bg-(--gray-7)" />+ <div className="h-0.5 w-4 rounded-full bg-(--gray-8)" />+ <div className="h-0.5 w-2 rounded-full bg-(--gray-7)" />+ </div>+ </div>+ </div>+ );+ }+}++interface NotificationDeliveryCardProps {+ title: string;+ caption: ReactNode;+ illustration: DeliveryIllustration;+ checked: boolean;+ onCheckedChange: (checked: boolean) => void;+ disabled?: boolean;+}++export function NotificationDeliveryCard({+ title,+ caption,+ illustration,+ checked,+ onCheckedChange,+ disabled = false,+}: NotificationDeliveryCardProps) {+ return (+ <button+ type="button"+ role="switch"+ aria-checked={checked}+ aria-label={title}+ disabled={disabled}+ onClick={() => onCheckedChange(!checked)}+ className={cn(+ "flex cursor-pointer flex-col overflow-hidden rounded-(--radius-3) border border-(--gray-5) bg-(--color-panel-solid) p-0 text-left transition-colors hover:border-(--gray-8)",+ disabled && "cursor-not-allowed opacity-50",+ )}+ >+ <div+ className={cn(+ "h-16 w-full border-(--gray-4) border-b bg-(--gray-3) transition-opacity",+ !checked && "opacity-45",+ )}+ >+ <Illustration kind={illustration} />+ </div>+ <div className="flex w-full flex-1 items-start justify-between gap-2 px-2.5 py-2">+ <div className="flex min-w-0 flex-col gap-0.5">+ <span className="font-medium text-[12px] text-gray-12 leading-4">+ {title}+ </span>+ <span className="text-[11px] text-gray-10 leading-snug">+ {caption}+ </span>+ </div>+ <span className="mt-0.5">+ <SwitchPill checked={checked} />+ </span>+ </div>+ </button>+ );+}diff --git a/products/desktop/packages/ui/src/features/settings/components/SettingsCard.stories.tsx b/products/desktop/packages/ui/src/features/settings/components/SettingsCard.stories.tsxnew file mode 100644index 000000000000..d8bb490e5fd7--- /dev/null+++ b/products/desktop/packages/ui/src/features/settings/components/SettingsCard.stories.tsx@@ -0,0 +1,199 @@+import { Button, Switch } from "@posthog/quill";+import { NotificationDeliveryCard } from "@posthog/ui/features/settings/components/NotificationDeliveryCard";+import {+ SettingsCard,+ SettingsCardRow,+ SettingsSection,+} from "@posthog/ui/features/settings/components/SettingsCard";+import { SettingsSegmented } from "@posthog/ui/features/settings/components/SettingsSegmented";+import { SettingsSelect } from "@posthog/ui/features/settings/components/SettingsSelect";+import { ThemePicker } from "@posthog/ui/features/settings/components/ThemePicker";+import type { ThemePreference } from "@posthog/ui/shell/themeStore";+import type { Meta, StoryObj } from "@storybook/react-vite";+import { useState } from "react";++const meta: Meta = {+ title: "Settings/SettingsKit",+ // Match the settings page content column so cards size realistically.+ decorators: [+ (Story) => (+ <div style={{ maxWidth: 800, margin: "2rem auto", padding: "0 1.5rem" }}>+ <Story />+ </div>+ ),+ ],+};++export default meta;+type Story = StoryObj;++export const GeneralPage: Story = {+ render: function GeneralPageStory() {+ const [theme, setTheme] = useState<ThemePreference>("dark");+ const [startIn, setStartIn] = useState("plan");+ const [localMode, setLocalMode] = useState("queue");+ const [cloudMode, setCloudMode] = useState("steer");+ const [sendWith, setSendWith] = useState("enter");+ const [convert, setConvert] = useState("2500");+ const [keepAwake, setKeepAwake] = useState(false);++ return (+ <div className="flex flex-col gap-7">+ <SettingsSection label="Appearance">+ <ThemePicker value={theme} onChange={setTheme} />+ </SettingsSection>++ <SettingsSection+ label="New tasks"+ description="Defaults for every new task. You can change any of these per task in the composer."+ >+ <SettingsCard>+ <SettingsCardRow label="Start in">+ <SettingsSegmented+ ariaLabel="Initial task mode"+ value={startIn}+ options={[+ { value: "plan", label: "Plan" },+ { value: "last_used", label: "Last used" },+ ]}+ onValueChange={setStartIn}+ />+ </SettingsCardRow>+ <SettingsCardRow+ label="Messaging"+ description="Queue holds messages until the turn ends. Steer applies them mid-turn."+ >+ <div className="flex items-center gap-5">+ <div className="flex flex-col items-start gap-1">+ <span className="text-[10px] text-gray-9 uppercase tracking-wide">+ Local+ </span>+ <SettingsSegmented+ ariaLabel="Local messaging mode"+ value={localMode}+ options={[+ { value: "queue", label: "Queue" },+ { value: "steer", label: "Steer" },+ ]}+ onValueChange={setLocalMode}+ />+ </div>+ <div className="flex flex-col items-start gap-1">+ <span className="text-[10px] text-gray-9 uppercase tracking-wide">+ Cloud+ </span>+ <SettingsSegmented+ ariaLabel="Cloud messaging mode"+ value={cloudMode}+ options={[+ { value: "queue", label: "Queue" },+ { value: "steer", label: "Steer" },+ ]}+ onValueChange={setCloudMode}+ />+ </div>+ </div>+ </SettingsCardRow>+ </SettingsCard>+ </SettingsSection>++ <SettingsSection label="Composer">+ <SettingsCard>+ <SettingsCardRow+ label="Send messages with"+ description="Shift+Enter inserts a new line"+ >+ <SettingsSegmented+ ariaLabel="Send messages with"+ value={sendWith}+ options={[+ { value: "enter", label: "Enter" },+ { value: "cmd+enter", label: "⌘ Enter" },+ ]}+ onValueChange={setSendWith}+ />+ </SettingsCardRow>+ <SettingsCardRow+ label="Convert long pastes to attachments"+ description="Pasted text over this length becomes an attachment"+ >+ <SettingsSelect+ ariaLabel="Convert long pastes to attachments"+ value={convert}+ options={[+ { value: "off", label: "Off" },+ { value: "1000", label: "1,000 characters" },+ { value: "2500", label: "2,500 characters" },+ ]}+ onChange={(v) => v && setConvert(v)}+ triggerClassName="w-[160px]"+ />+ </SettingsCardRow>+ <SettingsCardRow+ label="Keep awake while agents work"+ description="Stops your computer from sleeping on its own during a task"+ >+ <Switch+ size="sm"+ checked={keepAwake}+ onCheckedChange={setKeepAwake}+ />+ </SettingsCardRow>+ </SettingsCard>+ </SettingsSection>+ </div>+ );+ },+};++export const NotificationDeliveryCards: Story = {+ render: function NotificationDeliveryCardsStory() {+ const [push, setPush] = useState(true);+ const [toast, setToast] = useState(true);+ const [badge, setBadge] = useState(true);+ const [bounce, setBounce] = useState(false);++ return (+ <SettingsSection+ label="Alerts"+ description="How agents get your attention when they finish or need you."+ action={+ <Button type="button" variant="link-muted" size="sm">+ Reset to defaults+ </Button>+ }+ >+ <div className="grid grid-cols-2 gap-2">+ <NotificationDeliveryCard+ title="System notifications"+ caption="When the app is in the background"+ illustration="push"+ checked={push}+ onCheckedChange={setPush}+ />+ <NotificationDeliveryCard+ title="In-app toasts"+ caption="While you're elsewhere in the app"+ illustration="toast"+ checked={toast}+ onCheckedChange={setToast}+ />+ <NotificationDeliveryCard+ title="Dock badge"+ caption="Unread dot on the app icon"+ illustration="dock-badge"+ checked={badge}+ onCheckedChange={setBadge}+ />+ <NotificationDeliveryCard+ title="Dock bounce"+ caption="Bounce the app icon once"+ illustration="dock-bounce"+ checked={bounce}+ onCheckedChange={setBounce}+ />+ </div>+ </SettingsSection>+ );+ },+};diff --git a/products/desktop/packages/ui/src/features/settings/components/SettingsCard.tsx b/products/desktop/packages/ui/src/features/settings/components/SettingsCard.tsxnew file mode 100644index 000000000000..591747c64025--- /dev/null+++ b/products/desktop/packages/ui/src/features/settings/components/SettingsCard.tsx@@ -0,0 +1,99 @@+import { cn } from "@posthog/quill";+import type { ReactNode } from "react";++interface SettingsSectionProps {+ label?: string;+ description?: ReactNode;+ action?: ReactNode;+ children: ReactNode;+}++/**+ * A labeled block on a settings page: an eyebrow label above one or more+ * cards. Pages are a stack of these instead of a flat run of divided rows.+ */+export function SettingsSection({+ label,+ description,+ action,+ children,+}: SettingsSectionProps) {+ return (+ <section className="flex flex-col gap-2">+ {(label || action) && (+ <div className="flex items-end justify-between gap-3 px-0.5">+ <div className="flex flex-col gap-0.5">+ {label && (+ <h3 className="font-semibold text-[11px] text-gray-9 uppercase tracking-[0.08em]">+ {label}+ </h3>+ )}+ {description && (+ <p className="m-0 text-[12px] text-gray-10 leading-snug">+ {description}+ </p>+ )}+ </div>+ {action && <div className="shrink-0">{action}</div>}+ </div>+ )}+ {children}+ </section>+ );+}++export function SettingsCard({+ className,+ children,+}: {+ className?: string;+ children: ReactNode;+}) {+ return (+ <div+ className={cn(+ "divide-y divide-(--gray-4) rounded-(--radius-3) border border-(--gray-5) bg-(--color-panel-solid)",+ className,+ )}+ >+ {children}+ </div>+ );+}++interface SettingsCardRowProps {+ label: ReactNode;+ description?: ReactNode;+ children?: ReactNode;+ stacked?: boolean;+}++export function SettingsCardRow({+ label,+ description,+ children,+ stacked = false,+}: SettingsCardRowProps) {+ return (+ <div+ className={cn(+ "flex min-h-11 gap-2 px-3.5 py-2",+ stacked ? "flex-col" : "flex-row items-center justify-between gap-6",+ )}+ >+ <div className="flex min-w-0 flex-col gap-0.5 py-0.5">+ <span className="font-medium text-[13px] text-gray-12 leading-5">+ {label}+ </span>+ {description && (+ <span className="text-[12px] text-gray-10 leading-snug">+ {description}+ </span>+ )}+ </div>+ {children && (+ <div className={cn("min-w-0", !stacked && "shrink-0")}>{children}</div>+ )}+ </div>+ );+}diff --git a/products/desktop/packages/ui/src/features/settings/components/SettingsPageContent.tsx b/products/desktop/packages/ui/src/features/settings/components/SettingsPageContent.tsxindex ec0ad4500a1a..7fe1866dad7f 100644--- a/products/desktop/packages/ui/src/features/settings/components/SettingsPageContent.tsx+++ b/products/desktop/packages/ui/src/features/settings/components/SettingsPageContent.tsx@@ -13,13 +13,11 @@ import { ShortcutsSettings } from "@posthog/ui/features/settings/sections/Shortcimport { SignalSourcesSettings } from "@posthog/ui/features/settings/sections/SignalSourcesSettings";import { SlackSettings } from "@posthog/ui/features/settings/sections/SlackSettings";import { TerminalSettings } from "@posthog/ui/features/settings/sections/TerminalSettings";-import { UpdatesSettings } from "@posthog/ui/features/settings/sections/UpdatesSettings";import { WorkspacesSettings } from "@posthog/ui/features/settings/sections/WorkspacesSettings";import { WorktreesSettings } from "@posthog/ui/features/settings/sections/worktrees/WorktreesSettings";import type { SettingsCategory } from "@posthog/ui/features/settings/types";import { CustomizeSidebarSettings } from "@posthog/ui/features/sidebar/components/CustomizeSidebarDialog";import { SkillsView } from "@posthog/ui/features/skills/SkillsView";-import { Box, Flex, ScrollArea, Text } from "@radix-ui/themes";import type { ComponentType, ReactNode } from "react";const SETTINGS_PAGE_LAYOUT = {@@ -82,7 +80,6 @@ const SETTINGS_PAGES: Record<SettingsCategory, SettingsPageDefinition> = {signals: defineSettingsPage("Self-driving", () => (<SignalSourcesSettings showSlackNotifications={false} />)),- updates: defineSettingsPage("Updates", UpdatesSettings),advanced: defineSettingsPage("Advanced", AdvancedSettings),};@@ -102,16 +99,14 @@ function SettingsPageHeader({if (formMode) return null;return (- <Flex- align="center"- gap="2"- className={- bordered ? "shrink-0 border-gray-5 border-b px-6 py-4" : undefined- }+ <div+ className={`flex items-center gap-2 ${+ bordered ? "shrink-0 border-gray-5 border-b px-6 py-4" : ""+ }`}>{icon && <span className="text-gray-10">{icon}</span>}- <Text className="font-medium text-lg leading-6.5">{title}</Text>- </Flex>+ <span className="font-medium text-lg leading-6.5">{title}</span>+ </div>);}@@ -122,14 +117,14 @@ function ContainedSettingsPageLayout({title,}: SettingsPageLayoutProps) {return (- <ScrollArea className="h-full w-full">- <Box p="6" mx="auto" className="relative z-[1] max-w-[800px]">- <Flex direction="column" gap="4">+ <div className="h-full w-full overflow-y-auto">+ <div className="relative z-[1] mx-auto max-w-[800px] p-6">+ <div className="flex flex-col gap-5"><SettingsPageHeader formMode={formMode} icon={icon} title={title} />{children}- </Flex>- </Box>- </ScrollArea>+ </div>+ </div>+ </div>);}@@ -140,7 +135,7 @@ function FullBleedSettingsPageLayout({title,}: SettingsPageLayoutProps) {return (- <Flex direction="column" className="relative z-[1] h-full min-h-0 w-full">+ <div className="relative z-[1] flex h-full min-h-0 w-full flex-col"><SettingsPageHeaderborderedformMode={formMode}@@ -148,7 +143,7 @@ function FullBleedSettingsPageLayout({title={title}/><div className="min-h-0 flex-1">{children}</div>- </Flex>+ </div>);}diff --git a/products/desktop/packages/ui/src/features/settings/components/SettingsPanel.tsx b/products/desktop/packages/ui/src/features/settings/components/SettingsPanel.tsxindex 84ae40d6e308..8259d14c3bb9 100644--- a/products/desktop/packages/ui/src/features/settings/components/SettingsPanel.tsx+++ b/products/desktop/packages/ui/src/features/settings/components/SettingsPanel.tsx@@ -1,6 +1,5 @@import {ArrowLeft,- ArrowsClockwise,Bell,CaretRight,Code,@@ -12,6 +11,7 @@ import {GithubLogo,Keyboard,Lightbulb,+ MagnifyingGlass,Palette,Plugs,Robot,@@ -23,7 +23,7 @@ import {TreeStructure,Wrench,} from "@phosphor-icons/react";-import { MenuLabel } from "@posthog/quill";+import { Avatar, AvatarFallback, Input, MenuLabel } from "@posthog/quill";import { BILLING_FLAG } from "@posthog/shared";import { useOptionalAuthenticatedClient } from "@posthog/ui/features/auth/authClient";import { useAuthStateValue } from "@posthog/ui/features/auth/store";@@ -34,19 +34,24 @@ import { useChannelsLayout } from "@posthog/ui/features/canvas/hooks/useChannelsimport { useFeatureFlag } from "@posthog/ui/features/feature-flags/useFeatureFlag";import { SettingsPageContent } from "@posthog/ui/features/settings/components/SettingsPageContent";import { closeSettings } from "@posthog/ui/features/settings/hooks/useOpenSettings";+import {+ type SettingsSearchEntry,+ searchSettings,+} from "@posthog/ui/features/settings/settingsSearch";import { getHiddenSettingsCategories } from "@posthog/ui/features/settings/settingsVisibility";import { useSettingsPageStore } from "@posthog/ui/features/settings/stores/settingsPageStore";-import type { SettingsCategory } from "@posthog/ui/features/settings/types";+import {+ SETTINGS_PAGE_LABELS,+ type SettingsCategory,+} from "@posthog/ui/features/settings/types";import { useSpendAnalysisEnabled } from "@posthog/ui/features/usage/useSpendAnalysisEnabled";import * as nav from "@posthog/ui/router/navigationBridge";import { useHostCapabilities } from "@posthog/ui/shell/useHostCapabilities";-import { Avatar, Flex, ScrollArea, Text } from "@radix-ui/themes";-import type { ReactNode } from "react";+import { type ReactNode, useState } from "react";import { useHotkeys } from "react-hotkeys-hook";interface SidebarItem {id: SettingsCategory;- label: string;icon: ReactNode;hasChevron?: boolean;}@@ -56,72 +61,54 @@ interface SidebarGroup {items: SidebarItem[];}+// Grouped by the question being asked: how the app behaves, where code+// lives, what agents can do, what's connected. Page names come from+// SETTINGS_PAGE_LABELS, keyed by id.const SIDEBAR_GROUPS: SidebarGroup[] = [{- label: "Account",+ label: "App",items: [- { id: "general", label: "General", icon: <GearSix size={16} /> },- { id: "notifications", label: "Notifications", icon: <Bell size={16} /> },- {- id: "plan-usage",- label: "Plan & usage",- icon: <CreditCard size={16} />,- },+ { id: "general", icon: <GearSix size={16} /> },+ { id: "notifications", icon: <Bell size={16} /> },+ { id: "personalization", icon: <Palette size={16} /> },+ { id: "sidebar", icon: <SidebarSimple size={16} /> },+ { id: "shortcuts", icon: <Keyboard size={16} /> },],},{- label: "Workspace",- items: [- { id: "workspaces", label: "Workspaces", icon: <Folder size={16} /> },- {- id: "worktrees",- label: "Worktrees",- icon: <TreeStructure size={16} />,- },- { id: "environments", label: "Environments", icon: <Cube size={16} /> },- ],+ label: "Account",+ items: [{ id: "plan-usage", icon: <CreditCard size={16} /> }],},{- label: "Configure",+ label: "Code",items: [- { id: "agents", label: "Agents", icon: <Robot size={16} /> },- { id: "skills", label: "Skills", icon: <Lightbulb size={16} /> },- { id: "mcp-servers", label: "MCP servers", icon: <Plugs size={16} /> },- { id: "harness", label: "Harness", icon: <Code size={16} /> },- {- id: "signals",- label: "Self-driving",- icon: <TrafficSignal size={16} />,- },+ { id: "workspaces", icon: <Folder size={16} /> },+ { id: "worktrees", icon: <TreeStructure size={16} /> },+ { id: "environments", icon: <Cube size={16} /> },+ { id: "terminal", icon: <Terminal size={16} /> },],},{- label: "Experience",+ label: "Agents",items: [- {- id: "personalization",- label: "Personalization",- icon: <Palette size={16} />,- },- { id: "sidebar", label: "Sidebar", icon: <SidebarSimple size={16} /> },- { id: "terminal", label: "Terminal", icon: <Terminal size={16} /> },- { id: "shortcuts", label: "Shortcuts", icon: <Keyboard size={16} /> },+ { id: "agents", icon: <Robot size={16} /> },+ { id: "signals", icon: <TrafficSignal size={16} /> },+ { id: "skills", icon: <Lightbulb size={16} /> },+ { id: "mcp-servers", icon: <Plugs size={16} /> },+ { id: "harness", icon: <Code size={16} /> },],},{- label: "Integrations",+ label: "Connections",items: [- { id: "github", label: "GitHub", icon: <GithubLogo size={16} /> },- { id: "slack", label: "Slack", icon: <SlackLogo size={16} /> },- { id: "discord", label: "Discord", icon: <DiscordLogo size={16} /> },+ { id: "github", icon: <GithubLogo size={16} /> },+ { id: "slack", icon: <SlackLogo size={16} /> },+ { id: "discord", icon: <DiscordLogo size={16} /> },],},{- label: "Application",- items: [- { id: "updates", label: "Updates", icon: <ArrowsClockwise size={16} /> },- { id: "advanced", label: "Advanced", icon: <Wrench size={16} /> },- ],+ label: "System",+ items: [{ id: "advanced", icon: <Wrench size={16} /> }],},];@@ -147,6 +134,7 @@ export function SettingsPanel({}: SettingsPanelProps = {}) {const formMode = useSettingsPageStore((s) => s.formMode);const activeCategory = activeCategoryProp ?? "general";+ const [searchQuery, setSearchQuery] = useState("");const close = onClose ?? closeSettings;const setCategory =onCategoryChange ??@@ -173,6 +161,7 @@ export function SettingsPanel({...group,items: group.items.filter((item) => !hiddenCategories.has(item.id)),})).filter((group) => group.items.length > 0);+ const searchResults = searchSettings(searchQuery, hiddenCategories);// Guard direct navigation (URL, deep link, programmatic openSettings) to a// category hidden on this host. Fall back to General so a hidden section is@@ -209,20 +198,14 @@ export function SettingsPanel({<div className="drag h-[36px] shrink-0 border-b border-b-(--gray-6)" />{isAuthenticated && user && (- <Flex- align="center"- gap="3"- px="3"- py="3"- className="border-b border-b-(--gray-5)"- >- <Avatar size="2" fallback={initials} radius="full" color="amber" />- <Flex direction="column" className="min-w-0">- <Text truncate className="font-medium text-sm">- {user.email}- </Text>- </Flex>- </Flex>+ <div className="flex items-center gap-3 border-b border-b-(--gray-5) px-3 py-3">+ <Avatar size="default">+ <AvatarFallback>{initials}</AvatarFallback>+ </Avatar>+ <div className="flex min-w-0 flex-col">+ <span className="truncate font-medium text-sm">{user.email}</span>+ </div>+ </div>)}<button@@ -234,28 +217,50 @@ export function SettingsPanel({<span>Back to app</span></button>- <ScrollArea className="flex-1">- <div className="flex flex-col gap-3 py-2">- {sidebarGroups.map((group) => (- <div key={group.label}>- <MenuLabel className="px-3 pb-1 text-gray-9">- {group.label}- </MenuLabel>- {group.items.map((item) => {- const isActive = activeSidebarCategory === item.id;- return (- <SidebarNavItem- key={item.id}- item={item}- isActive={isActive}- onClick={() => setCategory(item.id)}- />- );- })}- </div>- ))}- </div>- </ScrollArea>+ <SettingsSearchInput+ query={searchQuery}+ onQueryChange={setSearchQuery}+ onSubmit={() => {+ const first = searchResults[0];+ if (first) {+ setCategory(first.category);+ setSearchQuery("");+ }+ }}+ />++ <div className="flex-1 overflow-y-auto">+ {searchQuery.trim() ? (+ <SettingsSearchResults+ results={searchResults}+ onSelect={(category) => {+ setCategory(category);+ setSearchQuery("");+ }}+ />+ ) : (+ <div className="flex flex-col gap-3 py-2">+ {sidebarGroups.map((group) => (+ <div key={group.label}>+ <MenuLabel className="px-3 pb-1 text-gray-9">+ {group.label}+ </MenuLabel>+ {group.items.map((item) => {+ const isActive = activeSidebarCategory === item.id;+ return (+ <SidebarNavItem+ key={item.id}+ item={item}+ isActive={isActive}+ onClick={() => setCategory(item.id)}+ />+ );+ })}+ </div>+ ))}+ </div>+ )}+ </div>{isAuthenticated && (<button@@ -316,6 +321,81 @@ export function SettingsPanel({);}+function SettingsSearchInput({+ query,+ onQueryChange,+ onSubmit,+}: {+ query: string;+ onQueryChange: (query: string) => void;+ onSubmit: () => void;+}) {+ return (+ <div className="relative px-3 pt-1 pb-2">+ <MagnifyingGlass+ size={13}+ className="pointer-events-none absolute top-2.5 left-5 text-gray-9"+ />+ <Input+ value={query}+ onChange={(e) => onQueryChange(e.currentTarget.value)}+ onKeyDown={(e) => {+ // Escape clears the query before the panel-level hotkey can close+ // settings; a second Escape (empty query) closes as usual.+ if (e.key === "Escape" && query) {+ e.preventDefault();+ e.stopPropagation();+ onQueryChange("");+ }+ if (e.key === "Enter") {+ e.preventDefault();+ onSubmit();+ }+ }}+ placeholder="Search settings"+ aria-label="Search settings"+ className="h-7 pl-7 text-[13px]"+ />+ </div>+ );+}++function SettingsSearchResults({+ results,+ onSelect,+}: {+ results: SettingsSearchEntry[];+ onSelect: (category: SettingsCategory) => void;+}) {+ if (results.length === 0) {+ return (+ <p className="m-0 px-3 py-2 text-[12.5px] text-gray-10">+ No settings match. Try another word, like "sound" or "theme".+ </p>+ );+ }++ return (+ <div className="flex flex-col py-1">+ {results.map((result) => (+ <button+ key={`${result.category}:${result.label}`}+ type="button"+ className="flex w-full cursor-pointer items-center justify-between gap-2 border-0 bg-transparent px-3 py-1.5 text-left transition-colors hover:bg-gray-3"+ onClick={() => onSelect(result.category)}+ >+ <span className="min-w-0 truncate text-[13px] text-gray-12">+ {result.label}+ </span>+ <span className="shrink-0 text-[11px] text-gray-9">+ {SETTINGS_PAGE_LABELS[result.category]}+ </span>+ </button>+ ))}+ </div>+ );+}+interface SidebarNavItemProps {item: SidebarItem;isActive: boolean;@@ -332,7 +412,7 @@ function SidebarNavItem({ item, isActive, onClick }: SidebarNavItemProps) {><span className="flex items-center gap-2"><span className="text-gray-10">{item.icon}</span>- <span>{item.label}</span>+ <span>{SETTINGS_PAGE_LABELS[item.id]}</span></span>{item.hasChevron && <CaretRight size={12} className="text-gray-9" />}</button>diff --git a/products/desktop/packages/ui/src/features/settings/components/SettingsSegmented.tsx b/products/desktop/packages/ui/src/features/settings/components/SettingsSegmented.tsxnew file mode 100644index 000000000000..d4da3c8de002--- /dev/null+++ b/products/desktop/packages/ui/src/features/settings/components/SettingsSegmented.tsx@@ -0,0 +1,55 @@+import { cn, ToggleGroup, ToggleGroupItem } from "@posthog/quill";+import type { ReactNode } from "react";++export interface SettingsSegmentedOption {+ value: string;+ label: ReactNode;+}++interface SettingsSegmentedProps {+ value: string;+ options: SettingsSegmentedOption[];+ onValueChange: (value: string) => void;+ ariaLabel: string;+ disabled?: boolean;+ className?: string;+}++/**+ * Single-select segmented control for settings with two or three options,+ * so the choices read at a glance instead of hiding behind a dropdown.+ */+export function SettingsSegmented({+ value,+ options,+ onValueChange,+ ariaLabel,+ disabled,+ className,+}: SettingsSegmentedProps) {+ return (+ <ToggleGroup+ value={[value]}+ onValueChange={(next: string[]) => {+ const selected = next[0];+ if (selected && selected !== value) onValueChange(selected);+ }}+ aria-label={ariaLabel}+ disabled={disabled}+ className={cn("gap-1", className)}+ >+ {options.map((option) => (+ <ToggleGroupItem+ key={option.value}+ value={option.value}+ size="sm"+ variant="outline"+ disabled={disabled}+ className="h-6 px-2.5 text-[12px] text-gray-11 data-[pressed]:border-(--accent-9) data-[pressed]:bg-(--accent-3) data-[pressed]:text-(--accent-11)"+ >+ {option.label}+ </ToggleGroupItem>+ ))}+ </ToggleGroup>+ );+}diff --git a/products/desktop/packages/ui/src/features/settings/sections/environments/SettingsSelect.tsx b/products/desktop/packages/ui/src/features/settings/components/SettingsSelect.tsxsimilarity index 86%rename from products/desktop/packages/ui/src/features/settings/sections/environments/SettingsSelect.tsxrename to products/desktop/packages/ui/src/features/settings/components/SettingsSelect.tsxindex 3e477e48b94c..49f6d4346412 100644--- a/products/desktop/packages/ui/src/features/settings/sections/environments/SettingsSelect.tsx+++ b/products/desktop/packages/ui/src/features/settings/components/SettingsSelect.tsx@@ -19,12 +19,14 @@ export function SettingsSelect({onChange,ariaLabel,placeholder,+ triggerClassName = "w-full",}: {value: string | null;options: SettingsSelectOption[];onChange: (value: string | null) => void;ariaLabel: string;placeholder?: string;+ triggerClassName?: string;}) {return (<Select@@ -32,7 +34,11 @@ export function SettingsSelect({onValueChange={(next: string | null) => onChange(next)}items={options.map((o) => ({ value: o.value, label: o.label }))}>- <SelectTrigger size="sm" aria-label={ariaLabel} className="w-full">+ <SelectTrigger+ size="sm"+ aria-label={ariaLabel}+ className={triggerClassName}+ ><SelectValue placeholder={placeholder} /></SelectTrigger><SelectContent align="start" side="bottom" sideOffset={6}>diff --git a/products/desktop/packages/ui/src/features/settings/components/ThemePicker.tsx b/products/desktop/packages/ui/src/features/settings/components/ThemePicker.tsxnew file mode 100644index 000000000000..d9dcaeb63bf3--- /dev/null+++ b/products/desktop/packages/ui/src/features/settings/components/ThemePicker.tsx@@ -0,0 +1,158 @@+import { Check } from "@phosphor-icons/react";+import { cn } from "@posthog/quill";+import type { ThemePreference } from "@posthog/ui/shell/themeStore";+import type { CSSProperties } from "react";++interface ThemePalette {+ canvas: string;+ sidebar: string;+ bar: string;+ accent: string;+}++// Fixed hexes rather than theme tokens: each thumbnail must show its own+// theme regardless of the theme applied to the app.+const LIGHT_PALETTE: ThemePalette = {+ canvas: "#fdfdfc",+ sidebar: "#f1f0ee",+ bar: "#d9d7d3",+ accent: "#f54e00",+};++const DARK_PALETTE: ThemePalette = {+ canvas: "#191918",+ sidebar: "#232322",+ bar: "#403f3d",+ accent: "#f54e00",+};++const THEME_OPTIONS: { value: ThemePreference; label: string }[] = [+ { value: "light", label: "Light" },+ { value: "dark", label: "Dark" },+ { value: "system", label: "System" },+];++function MiniWindow({+ palette,+ className,+ style,+}: {+ palette: ThemePalette;+ className?: string;+ style?: CSSProperties;+}) {+ return (+ <div+ aria-hidden+ className={cn("flex", className)}+ style={{ backgroundColor: palette.canvas, ...style }}+ >+ <div+ className="flex w-1/4 flex-col gap-1 p-1.5"+ style={{ backgroundColor: palette.sidebar }}+ >+ <div+ className="h-1 w-full rounded-full"+ style={{ backgroundColor: palette.bar }}+ />+ <div+ className="h-1 w-2/3 rounded-full"+ style={{ backgroundColor: palette.bar }}+ />+ </div>+ <div className="flex flex-1 flex-col gap-1.5 p-2">+ <div className="flex items-center gap-1">+ <div+ className="size-1.5 shrink-0 rounded-full"+ style={{ backgroundColor: palette.accent }}+ />+ <div+ className="h-1 w-1/2 rounded-full"+ style={{ backgroundColor: palette.bar }}+ />+ </div>+ <div+ className="h-1 w-full rounded-full"+ style={{ backgroundColor: palette.bar }}+ />+ <div+ className="h-1 w-3/4 rounded-full"+ style={{ backgroundColor: palette.bar }}+ />+ </div>+ </div>+ );+}++function ThemeThumbnail({ theme }: { theme: ThemePreference }) {+ if (theme === "system") {+ return (+ <div className="relative h-16 w-full">+ <MiniWindow palette={LIGHT_PALETTE} className="absolute inset-0" />+ <MiniWindow+ palette={DARK_PALETTE}+ className="absolute inset-0"+ style={{ clipPath: "polygon(100% 0, 100% 100%, 0 100%)" }}+ />+ </div>+ );+ }+ return (+ <MiniWindow+ palette={theme === "light" ? LIGHT_PALETTE : DARK_PALETTE}+ className="h-16 w-full"+ />+ );+}++interface ThemePickerProps {+ value: ThemePreference;+ onChange: (theme: ThemePreference) => void;+}++/**+ * Theme choice as three mini window previews instead of a dropdown, so the+ * options show what they do.+ */+export function ThemePicker({ value, onChange }: ThemePickerProps) {+ return (+ <div className="grid grid-cols-3 gap-2">+ {THEME_OPTIONS.map((option) => {+ const selected = option.value === value;+ return (+ <label+ key={option.value}+ className={cn(+ "flex cursor-pointer flex-col overflow-hidden rounded-(--radius-3) border bg-(--color-panel-solid) transition-colors has-[:focus-visible]:ring-(--accent-8) has-[:focus-visible]:ring-2",+ selected+ ? "border-(--accent-9)"+ : "border-(--gray-5) hover:border-(--gray-8)",+ )}+ >+ <input+ type="radio"+ name="theme-preference"+ value={option.value}+ checked={selected}+ onChange={() => onChange(option.value)}+ className="sr-only"+ aria-label={`${option.label} theme`}+ />+ <ThemeThumbnail theme={option.value} />+ <div className="flex w-full items-center justify-between border-(--gray-4) border-t px-2.5 py-1.5">+ <span className="text-[12px] text-gray-12">{option.label}</span>+ <span+ className={cn(+ "flex size-3.5 items-center justify-center rounded-full bg-(--primary) text-(--primary-foreground) transition-opacity",+ selected ? "opacity-100" : "opacity-0",+ )}+ >+ <Check size={9} weight="bold" />+ </span>+ </div>+ </label>+ );+ })}+ </div>+ );+}diff --git a/products/desktop/packages/ui/src/features/settings/sections/GeneralSettings.tsx b/products/desktop/packages/ui/src/features/settings/sections/GeneralSettings.tsxindex b79262907267..735262c9ce6a 100644--- a/products/desktop/packages/ui/src/features/settings/sections/GeneralSettings.tsx+++ b/products/desktop/packages/ui/src/features/settings/sections/GeneralSettings.tsx@@ -2,6 +2,7 @@ import { ArrowSquareOut } from "@phosphor-icons/react";import { buildPostHogUrl } from "@posthog/core/settings/posthogUrl";import { useServiceOptional } from "@posthog/di/react";import { useHostTRPC } from "@posthog/host-router/react";+import { Button, Switch } from "@posthog/quill";import { ANALYTICS_EVENTS } from "@posthog/shared";import {EFFORT_LEVEL_DOCS_URLS,@@ -17,7 +18,15 @@ import {ReasoningLevelDropdown,type ReasoningLevelOption,} from "@posthog/ui/features/sessions/components/ReasoningLevelDropdown";-import { SettingRow } from "@posthog/ui/features/settings/SettingRow";+import {+ SettingsCard,+ SettingsCardRow,+ SettingsSection,+} from "@posthog/ui/features/settings/components/SettingsCard";+import { SettingsSegmented } from "@posthog/ui/features/settings/components/SettingsSegmented";+import { SettingsSelect } from "@posthog/ui/features/settings/components/SettingsSelect";+import { ThemePicker } from "@posthog/ui/features/settings/components/ThemePicker";+import { UpdatesSection } from "@posthog/ui/features/settings/sections/UpdatesSettings";import {type AutoConvertLongText,type DefaultInitialTaskMode,@@ -31,7 +40,6 @@ import { track } from "@posthog/ui/shell/analytics";import type { ThemePreference } from "@posthog/ui/shell/themeStore";import { useThemeStore } from "@posthog/ui/shell/themeStore";import { useHostCapabilities } from "@posthog/ui/shell/useHostCapabilities";-import { Button, Flex, Link, Select, Switch, Text } from "@radix-ui/themes";import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";import { useCallback, useEffect } from "react";@@ -44,6 +52,11 @@ const DEFAULT_EFFORT_OPTIONS: ReasoningLevelOption[] = [})),];+const MESSAGING_MODE_OPTIONS = [+ { value: "queue", label: "Queue" },+ { value: "steer", label: "Steer" },+];+export function GeneralSettings() {const hostTRPC = useHostTRPC();const isAuthenticated = useAuthStateValue(@@ -51,10 +64,9 @@ export function GeneralSettings() {);const cloudRegion = useAuthStateValue((state) => state.cloudRegion);- // Appearance stateconst theme = useThemeStore((state) => state.theme);const setTheme = useThemeStore((state) => state.setTheme);- // Power state+const { localWorkspaces } = useHostCapabilities();const { preventSleepWhileRunning, setPreventSleepWhileRunning } =useSettingsStore();@@ -125,7 +137,6 @@ export function GeneralSettings() {[missionControlMutation, queryClient],);- // Chat stateconst {autoConvertLongText,defaultInitialTaskMode,@@ -134,9 +145,6 @@ export function GeneralSettings() {defaultReasoningEffort,diffOpenMode,sendMessagesWith,- hedgehogMode,- slotMachineMode,- brainrotMode,setAutoConvertLongText,setDefaultInitialTaskMode,setDefaultMessagingMode,@@ -144,12 +152,8 @@ export function GeneralSettings() {setDefaultReasoningEffort,setDiffOpenMode,setSendMessagesWith,- setHedgehogMode,- setSlotMachineMode,- setBrainrotMode,} = useSettingsStore();- // Appearance handlersconst handleThemeChange = useCallback((value: ThemePreference) => {track(ANALYTICS_EVENTS.SETTING_CHANGED, {@@ -162,7 +166,6 @@ export function GeneralSettings() {[theme, setTheme],);- // Chat handlersconst handleAutoConvertLongTextChange = useCallback((value: AutoConvertLongText) => {track(ANALYTICS_EVENTS.SETTING_CHANGED, {@@ -247,333 +250,212 @@ export function GeneralSettings() {[sendMessagesWith, setSendMessagesWith],);- const handleHedgehogModeChange = useCallback(- (checked: boolean) => {- track(ANALYTICS_EVENTS.SETTING_CHANGED, {- setting_name: "hedgehog_mode",- new_value: checked,- old_value: hedgehogMode,- });- setHedgehogMode(checked);- },- [hedgehogMode, setHedgehogMode],- );-- const handleSlotMachineModeChange = useCallback(- (checked: boolean) => {- track(ANALYTICS_EVENTS.SETTING_CHANGED, {- setting_name: "slot_machine_mode",- new_value: checked,- old_value: slotMachineMode,- });- setSlotMachineMode(checked);- },- [slotMachineMode, setSlotMachineMode],- );-- const handleBrainrotModeChange = useCallback(- (checked: boolean) => {- track(ANALYTICS_EVENTS.SETTING_CHANGED, {- setting_name: "brainrot_mode",- new_value: checked,- old_value: brainrotMode,- });- setBrainrotMode(checked);- },- [brainrotMode, setBrainrotMode],- );-const accountUrl = buildPostHogUrl("/settings/user", cloudRegion);return (- <Flex direction="column">+ <div className="flex flex-col gap-7">{isAuthenticated && (- <SettingRow- label="Manage Account"- description="Manage your account and billing on PostHog"- >- <Button- size="1"- variant="outline"- disabled={!accountUrl}- onClick={() => {- if (accountUrl) window.open(accountUrl, "_blank");- }}+ <SettingsCard>+ <SettingsCardRow+ label="PostHog account"+ description="Account and billing details are managed on PostHog">- Manage- <ArrowSquareOut size={12} />- </Button>- </SettingRow>+ <Button+ type="button"+ variant="outline"+ size="sm"+ disabled={!accountUrl}+ onClick={() => {+ if (accountUrl) window.open(accountUrl, "_blank");+ }}+ >+ Manage+ <ArrowSquareOut size={12} />+ </Button>+ </SettingsCardRow>+ </SettingsCard>)}- {/* Appearance */}- <Text className="mb-2 pt-4 font-medium text-sm">Appearance</Text>-- <SettingRow- label="Theme"- description="Choose light, dark, or follow your system preference"- >- <Select.Root- value={theme}- onValueChange={(v) => handleThemeChange(v as ThemePreference)}- size="1"- >- <Select.Trigger className="min-w-[100px]" />- <Select.Content>- <Select.Item value="light">Light</Select.Item>- <Select.Item value="dark">Dark</Select.Item>- <Select.Item value="system">System</Select.Item>- </Select.Content>- </Select.Root>- </SettingRow>-- {missionControl != null && missionControlSupported === true && (- <SettingRow- label="Mission Control overlay"- description="Show the PostHog logo over the window while macOS Mission Control is open, so it's easy to spot among your other windows"- >- <Switch- checked={missionControlEnabled ?? false}- onCheckedChange={handleMissionControlOverlayChange}- size="1"- />- </SettingRow>- )}-- {/* Input */}- <Text className="mb-2 block border-gray-6 border-t pt-4 font-medium text-sm">- Input- </Text>-- <SettingRow- label="Initial task mode"- description="Choose whether new tasks always start in Plan mode or remember your last-used mode"- >- <Select.Root- value={defaultInitialTaskMode}- onValueChange={(value) =>- handleDefaultInitialTaskModeChange(value as DefaultInitialTaskMode)- }- size="1"- >- <Select.Trigger className="min-w-[100px]" />- <Select.Content>- <Select.Item value="plan">Plan</Select.Item>- <Select.Item value="last_used">Last used</Select.Item>- </Select.Content>- </Select.Root>- </SettingRow>-- <SettingRow- label="Default messaging mode"- description="Mode new local sessions start in. Steer applies messages mid-turn. Queue holds them until the turn ends."+ <SettingsSection label="Appearance">+ <ThemePicker value={theme} onChange={handleThemeChange} />+ {missionControl != null && missionControlSupported === true && (+ <SettingsCard>+ <SettingsCardRow+ label="Mission Control overlay"+ description="Show the PostHog logo over the window in macOS Mission Control"+ >+ <Switch+ size="sm"+ checked={missionControlEnabled ?? false}+ onCheckedChange={handleMissionControlOverlayChange}+ />+ </SettingsCardRow>+ </SettingsCard>+ )}+ </SettingsSection>++ <SettingsSection+ label="New tasks"+ description="Defaults for every new task. You can change any of these per task in the composer.">- <Select.Root- value={defaultMessagingMode}- onValueChange={(value) =>- handleDefaultMessagingModeChange(value as DefaultMessagingMode)- }- size="1"- >- <Select.Trigger className="min-w-[100px]" />- <Select.Content>- <Select.Item value="queue">Queue</Select.Item>- <Select.Item value="steer">Steer</Select.Item>- </Select.Content>- </Select.Root>- </SettingRow>-- <SettingRow- label="Default cloud messaging mode"- description="Mode new cloud sessions start in. Steer applies messages mid-turn. Queue holds them until the turn ends."- >- <Select.Root- value={defaultCloudMessagingMode}- onValueChange={(value) =>- handleDefaultCloudMessagingModeChange(value as DefaultMessagingMode)- }- size="1"- >- <Select.Trigger className="min-w-[100px]" />- <Select.Content>- <Select.Item value="queue">Queue</Select.Item>- <Select.Item value="steer">Steer</Select.Item>- </Select.Content>- </Select.Root>- </SettingRow>-- <SettingRow- label="Default effort level"- description="Choose the default reasoning effort for new tasks, or remember your last-used level"- >- <ReasoningLevelDropdown- value={defaultReasoningEffort}- options={DEFAULT_EFFORT_OPTIONS}- onChange={(value) =>- handleDefaultReasoningEffortChange(value as DefaultReasoningEffort)- }- side="bottom"- triggerVariant="outline"- triggerClassName="min-w-[140px] justify-between"- />- </SettingRow>-- <SettingRow- label="Send messages with"- description="Choose which key combination sends messages. Use Shift+Enter for new lines"- >- <Select.Root- value={sendMessagesWith}- onValueChange={(value) =>- handleSendMessagesWithChange(value as SendMessagesWith)- }- size="1"- >- <Select.Trigger className="min-w-[100px]" />- <Select.Content>- <Select.Item value="enter">Enter</Select.Item>- <Select.Item value="cmd+enter">⌘ Enter</Select.Item>- </Select.Content>- </Select.Root>- </SettingRow>-- <SettingRow- label="Auto-convert long text"- description="Automatically convert pasted text over this length into an attachment"- >- <Select.Root- value={autoConvertLongText}- onValueChange={(value) =>- handleAutoConvertLongTextChange(value as AutoConvertLongText)- }- size="1"- >- <Select.Trigger className="min-w-[120px]" />- <Select.Content>- <Select.Item value="off">Off</Select.Item>- <Select.Item value="1000">1,000 chars</Select.Item>- <Select.Item value="2500">2,500 chars</Select.Item>- <Select.Item value="5000">5,000 chars</Select.Item>- <Select.Item value="10000">10,000 chars</Select.Item>- </Select.Content>- </Select.Root>- </SettingRow>-- {/* Editor */}- <Text className="mb-2 block border-gray-6 border-t pt-4 font-medium text-sm">- Editor- </Text>-- <SettingRow- label="Open diffs in"- description="Choose how file diffs open when clicking a changed file"- noBorder- >- <Select.Root- value={diffOpenMode}- onValueChange={(value) =>- handleDiffOpenModeChange(value as DiffOpenMode)- }- size="1"- >- <Select.Trigger className="min-w-[140px]" />- <Select.Content>- <Select.Item value="auto">Auto</Select.Item>- <Select.Item value="split">Split pane</Select.Item>- <Select.Item value="same-pane">Same pane</Select.Item>- <Select.Item value="last-active-pane">Last active pane</Select.Item>- </Select.Content>- </Select.Root>- </SettingRow>-- {/* Power */}- {localWorkspaces && (- <>- <Text className="mb-2 block border-gray-6 border-t pt-4 font-medium text-sm">- Power- </Text>+ <SettingsCard>+ <SettingsCardRow label="Start in">+ <SettingsSegmented+ ariaLabel="Initial task mode"+ value={defaultInitialTaskMode}+ options={[+ { value: "plan", label: "Plan" },+ { value: "last_used", label: "Last used" },+ ]}+ onValueChange={(value) =>+ handleDefaultInitialTaskModeChange(+ value as DefaultInitialTaskMode,+ )+ }+ />+ </SettingsCardRow>++ <SettingsCardRow label="Effort">+ <ReasoningLevelDropdown+ value={defaultReasoningEffort}+ options={DEFAULT_EFFORT_OPTIONS}+ onChange={(value) =>+ handleDefaultReasoningEffortChange(+ value as DefaultReasoningEffort,+ )+ }+ side="bottom"+ triggerVariant="outline"+ triggerClassName="min-w-[120px] justify-between"+ />+ </SettingsCardRow>- <SettingRow- label="Keep awake while agents work"+ <SettingsCardRow+ label="Messaging"+ description="Queue holds messages until the turn ends. Steer applies them mid-turn."+ >+ <div className="flex items-center gap-5">+ <div className="flex flex-col items-start gap-1">+ <span className="text-[10px] text-gray-9 uppercase tracking-wide">+ Local+ </span>+ <SettingsSegmented+ ariaLabel="Local messaging mode"+ value={defaultMessagingMode}+ options={MESSAGING_MODE_OPTIONS}+ onValueChange={(value) =>+ handleDefaultMessagingModeChange(+ value as DefaultMessagingMode,+ )+ }+ />+ </div>+ <div className="flex flex-col items-start gap-1">+ <span className="text-[10px] text-gray-9 uppercase tracking-wide">+ Cloud+ </span>+ <SettingsSegmented+ ariaLabel="Cloud messaging mode"+ value={defaultCloudMessagingMode}+ options={MESSAGING_MODE_OPTIONS}+ onValueChange={(value) =>+ handleDefaultCloudMessagingModeChange(+ value as DefaultMessagingMode,+ )+ }+ />+ </div>+ </div>+ </SettingsCardRow>+ </SettingsCard>+ </SettingsSection>++ <SettingsSection label="Composer">+ <SettingsCard>+ <SettingsCardRow+ label="Send messages with"description={- hasBuiltInBattery- ? "Prevent your computer from going to sleep on its own while the agent is running a task. Closing the lid will still put it to sleep."- : "Prevent your computer from going to sleep on its own while the agent is running a task"+ sendMessagesWith === "enter"+ ? "Shift+Enter inserts a new line"+ : undefined}- noBorder>- <Switch- checked={preventSleepWhileRunning}- onCheckedChange={handlePreventSleepChange}- size="1"+ <SettingsSegmented+ ariaLabel="Send messages with"+ value={sendMessagesWith}+ options={[+ { value: "enter", label: "Enter" },+ { value: "cmd+enter", label: "⌘ Enter" },+ ]}+ onValueChange={(value) =>+ handleSendMessagesWithChange(value as SendMessagesWith)+ }/>- </SettingRow>- </>- )}+ </SettingsCardRow>- {/* Fun */}- <Text className="mb-2 block border-gray-6 border-t pt-4 font-medium text-sm">- Fun- </Text>-- <SettingRow label="Hedgehog mode" description={<HedgehogDescription />}>- <Switch- checked={hedgehogMode}- onCheckedChange={handleHedgehogModeChange}- size="1"- />- </SettingRow>-- <SettingRow- label="Slot machine mode 🎰"- description="Show a pull-able slot machine lever while a task is running. Every run is a gamble. Pull the handle and watch the reels spin."- >- <Switch- checked={slotMachineMode}- onCheckedChange={handleSlotMachineModeChange}- size="1"- />- </SettingRow>-- <SettingRow- label="Brainrot mode ⚡"- description="Add a Brainrot option to empty command center cells that fills them with a looping background video."- noBorder- >- <Switch- checked={brainrotMode}- onCheckedChange={handleBrainrotModeChange}- size="1"- />- </SettingRow>- </Flex>- );-}--function HedgehogDescription() {- const projectId = useAuthStateValue((state) => state.currentProjectId);- const cloudRegion = useAuthStateValue((state) => state.cloudRegion);-- const customizeUrl = projectId- ? buildPostHogUrl(- `/project/${projectId}/settings/user-customization`,- cloudRegion,- )- : null;-- return (- <Flex direction="column" gap="1">- <Text color="gray" className="text-[13px]">- Release a hedgehog buddy to walk around your screen. It might take a few- seconds to appear.- </Text>- {customizeUrl && (- <Text color="gray" className="text-[13px]">- <Link href={customizeUrl} target="_blank">- Customize your hedgehog- </Link>- </Text>- )}- </Flex>+ <SettingsCardRow+ label="Convert long pastes to attachments"+ description="Pasted text over this length becomes an attachment"+ >+ <SettingsSelect+ ariaLabel="Convert long pastes to attachments"+ value={autoConvertLongText}+ options={[+ { value: "off", label: "Off" },+ { value: "1000", label: "1,000 characters" },+ { value: "2500", label: "2,500 characters" },+ { value: "5000", label: "5,000 characters" },+ { value: "10000", label: "10,000 characters" },+ ]}+ onChange={(value) => {+ if (value)+ handleAutoConvertLongTextChange(value as AutoConvertLongText);+ }}+ triggerClassName="w-[160px]"+ />+ </SettingsCardRow>+ </SettingsCard>+ </SettingsSection>++ <SettingsSection label="Editor">+ <SettingsCard>+ <SettingsCardRow label="Open diffs in">+ <SettingsSelect+ ariaLabel="Open diffs in"+ value={diffOpenMode}+ options={[+ { value: "auto", label: "Auto" },+ { value: "split", label: "Split pane" },+ { value: "same-pane", label: "Same pane" },+ { value: "last-active-pane", label: "Last active pane" },+ ]}+ onChange={(value) => {+ if (value) handleDiffOpenModeChange(value as DiffOpenMode);+ }}+ triggerClassName="w-[160px]"+ />+ </SettingsCardRow>++ {localWorkspaces && (+ <SettingsCardRow+ label="Keep awake while agents work"+ description={+ hasBuiltInBattery+ ? "Stops your computer from sleeping on its own during a task. Closing the lid still puts it to sleep."+ : "Stops your computer from sleeping on its own during a task"+ }+ >+ <Switch+ size="sm"+ checked={preventSleepWhileRunning}+ onCheckedChange={handlePreventSleepChange}+ />+ </SettingsCardRow>+ )}+ </SettingsCard>+ </SettingsSection>++ {localWorkspaces && <UpdatesSection />}+ </div>);}diff --git a/products/desktop/packages/ui/src/features/settings/sections/NotificationsSettings.tsx b/products/desktop/packages/ui/src/features/settings/sections/NotificationsSettings.tsxindex 87161d8f5ff5..f72c00866eb3 100644--- a/products/desktop/packages/ui/src/features/settings/sections/NotificationsSettings.tsx+++ b/products/desktop/packages/ui/src/features/settings/sections/NotificationsSettings.tsx@@ -1,4 +1,4 @@-import { Play, Plus, Trash } from "@phosphor-icons/react";+import { CaretDown, Play, Plus, Trash } from "@phosphor-icons/react";import { useServiceOptional } from "@posthog/di/react";import {type INotifications,@@ -6,14 +6,36 @@ import {} from "@posthog/platform/notifications";import { type ISpeech, SPEECH_SERVICE } from "@posthog/platform/speech";import {- ANALYTICS_EVENTS,- PROJECT_BLUEBIRD_FLAG,- SPOKEN_NARRATION_FLAG,-} from "@posthog/shared";+ Button,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+ Input,+ Select,+ SelectContent,+ SelectGroup,+ SelectGroupLabel,+ SelectItem,+ SelectSeparator,+ SelectTrigger,+ SelectValue,+ Slider,+ Switch,+ ToggleGroup,+ ToggleGroupItem,+} from "@posthog/quill";+import { ANALYTICS_EVENTS, SPOKEN_NARRATION_FLAG } from "@posthog/shared";import type { Task } from "@posthog/shared/domain-types";import { useFeatureFlag } from "@posthog/ui/features/feature-flags/useFeatureFlag";import { NotificationBus } from "@posthog/ui/features/notifications/notifications";-import { SettingRow } from "@posthog/ui/features/settings/SettingRow";+import { NotificationDeliveryCard } from "@posthog/ui/features/settings/components/NotificationDeliveryCard";+import {+ SettingsCard,+ SettingsCardRow,+ SettingsSection,+} from "@posthog/ui/features/settings/components/SettingsCard";+import { SettingsSelect } from "@posthog/ui/features/settings/components/SettingsSelect";import { AddCustomSoundDialog } from "@posthog/ui/features/settings/sections/AddCustomSoundDialog";import { SlackCommentNotificationsSettings } from "@posthog/ui/features/settings/sections/SlackCommentNotificationsSettings";import {@@ -34,18 +56,26 @@ import { track } from "@posthog/ui/shell/analytics";import { useHostCapabilities } from "@posthog/ui/shell/useHostCapabilities";import { formatDurationSeconds } from "@posthog/ui/utils/customSound";import { playCompletionSound } from "@posthog/ui/utils/sounds";-import {- Button,- Flex,- IconButton,- Select,- Slider,- Switch,- Text,- TextField,-} from "@radix-ui/themes";import { useCallback, useEffect, useState } from "react";+const BUILT_IN_SOUND_OPTIONS: { value: CompletionSound; label: string }[] = [+ { value: "guitar", label: "Guitar solo" },+ { value: "danilo", label: "I'm ready" },+ { value: "revi", label: "Cute noise" },+ { value: "meep", label: "Meep" },+ { value: "meep-smol", label: "Meep (smol)" },+ { value: "bubbles", label: "Bubbles" },+ { value: "drop", label: "Drop" },+ { value: "knock", label: "Knock" },+ { value: "ring", label: "Ring" },+ { value: "shoot", label: "Shoot" },+ { value: "slide", label: "Slide" },+ { value: "switch", label: "Switch" },+ { value: "wilhelm", label: "Wilhelm scream" },+ { value: "icq", label: "ICQ" },+ { value: "msn", label: "MSN Messenger" },+];+export function NotificationsSettings() {const {desktopNotifications,@@ -70,7 +100,7 @@ export function NotificationsSettings() {const [addSoundOpen, setAddSoundOpen] = useState(false);// Optional so non-desktop hosts (web) that don't bind these simply disable the- // native test buttons instead of throwing.+ // native test actions instead of throwing.const bus = useServiceOptional<NotificationBus>(NotificationBus);const notifications = useServiceOptional<INotifications>(NOTIFICATIONS_SERVICE,@@ -78,12 +108,6 @@ export function NotificationsSettings() {// Dock badge/bounce are macOS desktop-dock features.const { localWorkspaces } = useHostCapabilities();- // Canvases only exist behind the bluebird flag, so only mention them when on.- const canvasEnabled = useFeatureFlag(- PROJECT_BLUEBIRD_FLAG,- import.meta.env.DEV,- );-// Spoken narration is behind a flag for a staged rollout; always on in dev.const spokenNarrationEnabled = useFeatureFlag(SPOKEN_NARRATION_FLAG,@@ -185,250 +209,247 @@ export function NotificationsSettings() {setScaleSoundWithTaskLength,]);+ const soundItems = [+ { value: "none", label: "None" },+ { value: "random-all", label: "Random (all)" },+ ...(customSounds.length > 0+ ? [{ value: "random-custom", label: "Random (custom)" }]+ : []),+ ...BUILT_IN_SOUND_OPTIONS,+ ...customSounds.map((sound) => ({+ value: `custom:${sound.id}`,+ label: sound.name,+ })),+ ];+return (- <Flex direction="column">+ <div className="flex flex-col gap-7">{notificationsDenied && (- <Text color="yellow" className="mb-2 text-[13px]">- Notifications are blocked in your system settings. Enable- notifications for PostHog to receive them.- </Text>+ <div className="rounded-(--radius-3) border border-(--amber-6) bg-(--amber-2) px-3.5 py-2.5 text-[12.5px] text-amber-11">+ Notifications are blocked in your system settings. Allow them for+ PostHog to receive alerts.+ </div>)}- <Flex align="center" justify="between" className="mb-2 pt-2">- <Text className="font-medium text-sm">Defaults</Text>- <Button variant="soft" size="1" onClick={resetToDefaults}>- Reset to defaults- </Button>- </Flex>-- <SettingRow- label="Push notifications"- description="Receive a native OS notification when the app is in the background and an agent finishes or needs your input"- >- <Switch- checked={desktopNotifications}- onCheckedChange={handleDesktopNotificationsChange}- disabled={notificationsDenied}- size="1"- />- </SettingRow>-- {localWorkspaces && (- <>- <SettingRow- label="Dock badge"- description="Display a badge on the dock icon when the agent finishes a task or needs your input"- >- <Switch- checked={dockBadgeNotifications}- onCheckedChange={setDockBadgeNotifications}- size="1"- />- </SettingRow>-- <SettingRow- label="Bounce dock icon"- description="Bounce the dock icon when the agent finishes a task or needs your input"+ <SettingsSection+ label="Alerts"+ description="How agents get your attention when they finish or need you."+ action={+ <Button+ type="button"+ variant="link-muted"+ size="sm"+ onClick={resetToDefaults}>- <Switch- checked={dockBounceNotifications}- onCheckedChange={setDockBounceNotifications}- size="1"- />- </SettingRow>- </>- )}-- <SettingRow- label="In-app toasts"- description="Show an in-app toast when the agent finishes a task or needs your input, and for other in-app confirmations. Error messages always show."- >- <Switch- checked={toastNotifications}- onCheckedChange={handleToastNotificationsChange}- size="1"- />- </SettingRow>-- <SettingRow- label="Sound effect"- description="Play a sound when the agent finishes a task or needs your input"- noBorder={completionSound === "none"}+ Reset to defaults+ </Button>+ }>- <Flex align="center" gap="2">- <Select.Root- value={completionSound}- onValueChange={(value) =>- handleCompletionSoundChange(value as CompletionSound)+ <div className="grid grid-cols-2 gap-2">+ <NotificationDeliveryCard+ title="System notifications"+ caption="When the app is in the background"+ illustration="push"+ checked={desktopNotifications}+ onCheckedChange={(checked) =>+ void handleDesktopNotificationsChange(checked)}- size="1"+ disabled={notificationsDenied}+ />+ <NotificationDeliveryCard+ title="In-app toasts"+ caption="While you're elsewhere in the app"+ illustration="toast"+ checked={toastNotifications}+ onCheckedChange={handleToastNotificationsChange}+ />+ {localWorkspaces && (+ <>+ <NotificationDeliveryCard+ title="Dock badge"+ caption="Unread dot on the app icon"+ illustration="dock-badge"+ checked={dockBadgeNotifications}+ onCheckedChange={setDockBadgeNotifications}+ />+ <NotificationDeliveryCard+ title="Dock bounce"+ caption="Bounce the app icon once"+ illustration="dock-bounce"+ checked={dockBounceNotifications}+ onCheckedChange={setDockBounceNotifications}+ />+ </>+ )}+ </div>+ </SettingsSection>++ <SettingsSection label="Sound">+ <SettingsCard>+ <SettingsCardRow+ label="Completion sound"+ description="Plays when an agent finishes or needs your input">- <Select.Trigger className="min-w-[100px]" />- <Select.Content>- <Select.Item value="none">None</Select.Item>- <Select.Item value="random-all">Random (all)</Select.Item>- {customSounds.length > 0 && (- <Select.Item value="random-custom">Random (custom)</Select.Item>- )}- <Select.Item value="guitar">Guitar solo</Select.Item>- <Select.Item value="danilo">I'm ready</Select.Item>- <Select.Item value="revi">Cute noise</Select.Item>- <Select.Item value="meep">Meep</Select.Item>- <Select.Item value="meep-smol">Meep (smol)</Select.Item>- <Select.Item value="bubbles">Bubbles</Select.Item>- <Select.Item value="drop">Drop</Select.Item>- <Select.Item value="knock">Knock</Select.Item>- <Select.Item value="ring">Ring</Select.Item>- <Select.Item value="shoot">Shoot</Select.Item>- <Select.Item value="slide">Slide</Select.Item>- <Select.Item value="switch">Switch</Select.Item>- <Select.Item value="wilhelm">Wilhelm scream</Select.Item>- <Select.Item value="icq">ICQ</Select.Item>- <Select.Item value="msn">MSN Messenger</Select.Item>- {customSounds.length > 0 && (- <Select.Group>- <Select.Label>Custom</Select.Label>- {customSounds.map((sound) => (- <Select.Item key={sound.id} value={`custom:${sound.id}`}>- {sound.name}- </Select.Item>+ <div className="flex items-center gap-1.5">+ <Select+ value={completionSound}+ onValueChange={(value: string | null) => {+ if (value)+ handleCompletionSoundChange(value as CompletionSound);+ }}+ items={soundItems}+ >+ <SelectTrigger+ size="sm"+ aria-label="Completion sound"+ className="w-[150px]"+ >+ <SelectValue />+ </SelectTrigger>+ <SelectContent align="end" side="bottom" sideOffset={6}>+ <SelectItem value="none">None</SelectItem>+ <SelectItem value="random-all">Random (all)</SelectItem>+ {customSounds.length > 0 && (+ <SelectItem value="random-custom">+ Random (custom)+ </SelectItem>+ )}+ <SelectSeparator />+ {BUILT_IN_SOUND_OPTIONS.map((option) => (+ <SelectItem key={option.value} value={option.value}>+ {option.label}+ </SelectItem>))}- </Select.Group>+ {customSounds.length > 0 && (+ <>+ <SelectSeparator />+ <SelectGroup>+ <SelectGroupLabel>Custom</SelectGroupLabel>+ {customSounds.map((sound) => (+ <SelectItem+ key={sound.id}+ value={`custom:${sound.id}`}+ >+ {sound.name}+ </SelectItem>+ ))}+ </SelectGroup>+ </>+ )}+ </SelectContent>+ </Select>+ {completionSound !== "none" && (+ <Tooltip content="Preview">+ <Button+ type="button"+ variant="outline"+ size="icon-sm"+ aria-label="Preview sound"+ onClick={() =>+ playCompletionSound(+ completionSound,+ completionVolume,+ customSounds,+ )+ }+ >+ <Play weight="fill" size={12} />+ </Button>+ </Tooltip>)}- </Select.Content>- </Select.Root>+ <Tooltip content="Record or import your own sound">+ <Button+ type="button"+ variant="outline"+ size="icon-sm"+ aria-label="Add a custom sound"+ onClick={() => setAddSoundOpen(true)}+ >+ <Plus size={12} />+ </Button>+ </Tooltip>+ </div>+ </SettingsCardRow>++ {customSounds.length > 0 && (+ <SettingsCardRow label="Custom sounds" stacked>+ <div className="flex w-full flex-col gap-1.5">+ {customSounds.map((sound) => (+ <CustomSoundRow+ key={sound.id}+ sound={sound}+ volume={completionVolume}+ onRename={renameCustomSound}+ onRemove={removeCustomSound}+ />+ ))}+ </div>+ </SettingsCardRow>+ )}+{completionSound !== "none" && (- <Tooltip content="Test sound">- <IconButton- variant="soft"- size="1"- aria-label="Test sound"- onClick={() =>- playCompletionSound(- completionSound,- completionVolume,- customSounds,- )- }+ <>+ <SettingsCardRow label="Volume">+ <div className="flex items-center gap-3">+ <Slider+ aria-label="Sound volume"+ value={[completionVolume]}+ onValueChange={(next: number | readonly number[]) => {+ const raw = Array.isArray(next) ? next[0] : next;+ if (typeof raw === "number") setCompletionVolume(raw);+ }}+ min={0}+ max={100}+ step={1}+ className="w-[120px]"+ />+ <span className="w-8 text-right text-[12px] text-gray-10 tabular-nums">+ {completionVolume}%+ </span>+ </div>+ </SettingsCardRow>++ <SettingsCardRow+ label="Match speed to task length"+ description="Quick tasks play the sound faster, long ones slower">- <Play weight="fill" />- </IconButton>- </Tooltip>+ <Switch+ size="sm"+ checked={scaleSoundWithTaskLength}+ onCheckedChange={handleScaleSoundChange}+ />+ </SettingsCardRow>+ </>)}- </Flex>- </SettingRow>-- <SettingRow- label="Custom sounds"- description={- customSounds.length > 0- ? "Sounds you recorded or imported. Rename or remove them here."- : "Record or import your own sound to play when an agent finishes a task or needs your input."- }- >- <Flex direction="column" gap="2" className="w-full max-w-[260px]">- {customSounds.map((sound) => (- <CustomSoundRow- key={sound.id}- sound={sound}- volume={completionVolume}- onRename={renameCustomSound}- onRemove={removeCustomSound}- />- ))}- <Button- variant="soft"- size="1"- className="self-start"- onClick={() => setAddSoundOpen(true)}- >- <Plus /> Add- </Button>- </Flex>- </SettingRow>+ </SettingsCard>+ </SettingsSection><AddCustomSoundDialogopen={addSoundOpen}onOpenChange={setAddSoundOpen}/>- {completionSound !== "none" && (- <SettingRow label="Sound volume">- <Flex align="center" gap="3">- <Slider- value={[completionVolume]}- onValueChange={([value]) => setCompletionVolume(value)}- min={0}- max={100}- step={1}- size="1"- className="w-[120px]"- />- <Text color="gray" className="text-[13px]">- {completionVolume}%- </Text>- </Flex>- </SettingRow>- )}-- {completionSound !== "none" && (- <SettingRow- label="Scale sound speed with task length"- description="Play the sound faster for quick tasks and slower for long ones"- noBorder- >- <Switch- checked={scaleSoundWithTaskLength}- onCheckedChange={handleScaleSoundChange}- size="1"- />- </SettingRow>- )}-- {spokenNarrationEnabled && <SpokenNotificationsSection />}+ {spokenNarrationEnabled && <VoiceSection />}<SlackCommentNotificationsSettings />- <NotificationTestHarness+ <TestSectionbus={bus}notifications={notifications}deepLinkTask={deepLinkTask}- canvasEnabled={canvasEnabled}+ localWorkspaces={localWorkspaces}/>- </Flex>+ </div>);}-function SpeechSwitchRow({- label,- description,- checked,- onCheckedChange,- disabled,-}: {- label: string;- description: string;- checked: boolean;- onCheckedChange: (checked: boolean) => void;- disabled?: boolean;-}) {- return (- <SettingRow label={label} description={description}>- <Switch- checked={checked}- onCheckedChange={onCheckedChange}- disabled={disabled}- size="1"- />- </SettingRow>- );-}+type SpeakAboutKey = "needs_input" | "completion" | "progress";// Voice narration: the agent speaks a short line when it needs the user or-// finishes. The master toggle gates the whole feature; sub-controls disable-// when it's off. The ElevenLabs key is written to encrypted host storage via an-// injected capability (never kept in packages/ui or the persisted blob).-function SpokenNotificationsSection() {+// finishes. The master toggle reveals the sub-controls. The ElevenLabs key is+// written to encrypted host storage via an injected capability (never kept in+// packages/ui or the persisted blob).+function VoiceSection() {const {spokenNotifications,spokenNotifyNeedsInput,@@ -451,7 +472,24 @@ function SpokenNotificationsSection() {const [keyDraft, setKeyDraft] = useState("");const [savingKey, setSavingKey] = useState(false);- const disabled = !spokenNotifications;+ const speakAbout: SpeakAboutKey[] = [+ ...(spokenNotifyNeedsInput ? (["needs_input"] as const) : []),+ ...(spokenNotifyCompletion ? (["completion"] as const) : []),+ ...(spokenNotifyProgress ? (["progress"] as const) : []),+ ];++ const handleSpeakAboutChange = useCallback(+ (next: string[]) => {+ setSpokenNotifyNeedsInput(next.includes("needs_input"));+ setSpokenNotifyCompletion(next.includes("completion"));+ setSpokenNotifyProgress(next.includes("progress"));+ },+ [+ setSpokenNotifyNeedsInput,+ setSpokenNotifyCompletion,+ setSpokenNotifyProgress,+ ],+ );const saveKey = useCallback(async () => {if (!keyStore || !keyDraft.trim()) return;@@ -486,141 +524,158 @@ function SpokenNotificationsSection() {}, [speech, elevenLabsVoiceId]);return (- <>- <Text className="mt-4 mb-1 block border-gray-6 border-t pt-4 font-medium text-sm">- Spoken notifications- </Text>- <Text color="gray" className="mb-1 text-[13px]">- Have the agent say a short line out loud when it needs you or finishes,- so you hear it across parallel tasks without watching the screen. Lines- are serialized so agents never talk over each other.- </Text>-- <SpeechSwitchRow- label="Enable spoken notifications"- description="Let the agent speak up out loud when it decides it's worth interrupting you."- checked={spokenNotifications}- onCheckedChange={setSpokenNotifications}- />-- <SpeechSwitchRow- label="Speak when I'm needed"- description="Blocked on a question, decision, or confirmation. Always spoken — even for the task you're viewing."- checked={spokenNotifyNeedsInput}- onCheckedChange={setSpokenNotifyNeedsInput}- disabled={disabled}- />-- <SpeechSwitchRow- label="Speak when a task finishes"- description="Announce completion so you can review and ship."- checked={spokenNotifyCompletion}- onCheckedChange={setSpokenNotifyCompletion}- disabled={disabled}- />-- <SpeechSwitchRow- label="Speak on progress"- description="Narrate meaningful new phases too. Off by default — can get chatty."- checked={spokenNotifyProgress}- onCheckedChange={setSpokenNotifyProgress}- disabled={disabled}- />-- <SettingRow- label="When to speak"- description="Choose how spoken lines behave relative to what's on screen. Needs-you lines always play."- >- <Select.Root- value={spokenFocusMode}- onValueChange={(v) => setSpokenFocusMode(v as SpokenFocusMode)}- disabled={disabled}- size="1"+ <SettingsSection+ label="Voice"+ description="The agent says a short line out loud, so you catch it across parallel tasks without watching the screen."+ >+ <SettingsCard>+ <SettingsCardRow+ label="Spoken narration"+ description="Lines are serialized so agents never talk over each other">- <Select.Trigger className="min-w-[180px]" />- <Select.Content>- <Select.Item value="unviewed_task">- Quiet for the task I'm viewing- </Select.Item>- <Select.Item value="app_unfocused">- Only when app is in background- </Select.Item>- <Select.Item value="always">Always</Select.Item>- </Select.Content>- </Select.Root>- </SettingRow>-- <SettingRow- label="ElevenLabs API key"- description={- elevenLabsKeyConfigured- ? "A key is saved — expressive Eleven v3 voice is on."- : "Optional. Add a key for an expressive Eleven v3 voice; otherwise your system voice is used."- }- >- {elevenLabsKeyConfigured ? (- <Flex align="center" gap="2">- <Text color="green" className="text-[13px]">- Key saved- </Text>- <Button- variant="soft"- size="1"- color="red"- onClick={clearKey}- disabled={!keyStore}- >- Remove- </Button>- </Flex>- ) : (- <Flex align="center" gap="2">- <TextField.Root- type="password"- placeholder="xi-…"- size="1"- className="w-[180px]"- value={keyDraft}- onChange={(e) => setKeyDraft(e.currentTarget.value)}- disabled={disabled || !keyStore}- />- <Button- variant="soft"- size="1"- onClick={saveKey}- disabled={disabled || !keyStore || !keyDraft.trim() || savingKey}+ <Switch+ size="sm"+ checked={spokenNotifications}+ onCheckedChange={setSpokenNotifications}+ />+ </SettingsCardRow>++ {spokenNotifications && (+ <>+ <SettingsCardRow+ label="Speak about"+ description="Needing you is always spoken, even for the task on screen">- Save- </Button>- </Flex>+ <ToggleGroup+ multiple+ value={speakAbout}+ onValueChange={handleSpeakAboutChange}+ aria-label="Speak about"+ className="gap-1"+ >+ <ToggleGroupItem+ value="needs_input"+ size="sm"+ variant="outline"+ className="h-6 px-2.5 text-[12px] text-gray-11 data-[pressed]:border-(--accent-9) data-[pressed]:bg-(--accent-3) data-[pressed]:text-(--accent-11)"+ >+ Needs you+ </ToggleGroupItem>+ <ToggleGroupItem+ value="completion"+ size="sm"+ variant="outline"+ className="h-6 px-2.5 text-[12px] text-gray-11 data-[pressed]:border-(--accent-9) data-[pressed]:bg-(--accent-3) data-[pressed]:text-(--accent-11)"+ >+ Task finished+ </ToggleGroupItem>+ <ToggleGroupItem+ value="progress"+ size="sm"+ variant="outline"+ className="h-6 px-2.5 text-[12px] text-gray-11 data-[pressed]:border-(--accent-9) data-[pressed]:bg-(--accent-3) data-[pressed]:text-(--accent-11)"+ >+ Progress+ </ToggleGroupItem>+ </ToggleGroup>+ </SettingsCardRow>++ <SettingsCardRow label="When to speak">+ <SettingsSelect+ ariaLabel="When to speak"+ value={spokenFocusMode}+ options={[+ {+ value: "unviewed_task",+ label: "Quiet for the task I'm viewing",+ },+ {+ value: "app_unfocused",+ label: "Only when app is in background",+ },+ { value: "always", label: "Always" },+ ]}+ onChange={(value) => {+ if (value) setSpokenFocusMode(value as SpokenFocusMode);+ }}+ triggerClassName="w-[220px]"+ />+ </SettingsCardRow>+ </>)}- </SettingRow>- <SettingRow- label="Voice"- description="Optional ElevenLabs voice id. Leave blank for the default voice."- noBorder- >- <Flex align="center" gap="2">- <TextField.Root- size="1"- className="w-[180px]"- placeholder="default"- value={elevenLabsVoiceId}- onChange={(e) => setElevenLabsVoiceId(e.currentTarget.value)}- disabled={disabled}- />- <Button- variant="soft"- size="1"- onClick={testVoice}- disabled={disabled || !speech}+ {(spokenNotifications || elevenLabsKeyConfigured) && (+ <SettingsCardRow+ label="ElevenLabs voice"+ description={+ elevenLabsKeyConfigured+ ? "Key saved. The expressive Eleven v3 voice is on."+ : "Optional. Add an API key for an expressive voice; otherwise your system voice is used."+ }>- <Play weight="fill" /> Test- </Button>- </Flex>- </SettingRow>- </>+ {elevenLabsKeyConfigured ? (+ <div className="flex items-center gap-1.5">+ <Input+ className="h-7 w-[140px] text-[12px]"+ placeholder="Default voice"+ aria-label="ElevenLabs voice id"+ value={elevenLabsVoiceId}+ onChange={(e) => setElevenLabsVoiceId(e.currentTarget.value)}+ />+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={testVoice}+ disabled={!speech}+ >+ <Play weight="fill" size={11} /> Test+ </Button>+ <Button+ type="button"+ variant="link-muted"+ size="sm"+ onClick={clearKey}+ disabled={!keyStore}+ >+ Remove key+ </Button>+ </div>+ ) : (+ <div className="flex items-center gap-1.5">+ <Input+ type="password"+ placeholder="xi-…"+ aria-label="ElevenLabs API key"+ className="h-7 w-[140px] text-[12px]"+ value={keyDraft}+ onChange={(e) => setKeyDraft(e.currentTarget.value)}+ disabled={!keyStore}+ />+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={() => void saveKey()}+ disabled={!keyStore || !keyDraft.trim() || savingKey}+ >+ Save+ </Button>+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={testVoice}+ disabled={!speech}+ >+ <Play weight="fill" size={11} /> Test+ </Button>+ </div>+ )}+ </SettingsCardRow>+ )}+ </SettingsCard>+ </SettingsSection>);}@@ -650,64 +705,61 @@ function CustomSoundRow({};return (- <Flex align="center" gap="2">- <TextField.Root+ <div className="flex items-center gap-1.5">+ <Inputkey={sound.name}- className="flex-1"- size="1"+ className="h-7 flex-1 text-[12px]"defaultValue={sound.name}maxLength={60}+ aria-label={`Rename ${sound.name}`}onBlur={(event) => commitName(event.currentTarget)}onKeyDown={(event) => {if (event.key === "Enter") event.currentTarget.blur();}}/>- <Text color="gray" className="text-[12px] tabular-nums">+ <span className="text-[11px] text-gray-9 tabular-nums">{formatDurationSeconds(sound.durationMs)}- </Text>+ </span><Tooltip content={`Play ${sound.name}`}>- <IconButton- variant="soft"- size="1"+ <Button+ type="button"+ variant="outline"+ size="icon-sm"aria-label={`Play ${sound.name}`}onClick={() =>playCompletionSound(`custom:${sound.id}`, volume, [sound])}>- <Play weight="fill" />- </IconButton>+ <Play weight="fill" size={11} />+ </Button></Tooltip>- <IconButton- variant="ghost"- color="gray"- size="1"+ <Button+ type="button"+ variant="link-muted"+ size="icon-sm"aria-label={`Remove ${sound.name}`}onClick={() => onRemove(sound.id)}>- <Trash />- </IconButton>- </Flex>+ <Trash size={13} />+ </Button>+ </div>);}-// Fires each delivery channel directly (bypassing the focus-aware routing, since-// you're focused on Settings) so each tier can be verified in isolation.-function NotificationTestHarness({+// Fires each delivery channel directly (bypassing the focus-aware routing,+// since you're focused on Settings) so each tier can be verified in isolation.+function TestSection({bus,notifications,deepLinkTask,- canvasEnabled,+ localWorkspaces,}: {bus: NotificationBus | null;notifications: INotifications | null;deepLinkTask: Task | undefined;- canvasEnabled: boolean;+ localWorkspaces: boolean;}) {const nativeUnavailable = !notifications;- // Deep links (OS URL scheme) and the dock are desktop concepts; hide those- // test rows on cloud-only hosts. Clicking a native notification still opens- // its task in-app on web.- const { localWorkspaces } = useHostCapabilities();const testToast = () =>bus?.notify({@@ -750,113 +802,69 @@ function NotificationTestHarness({};return (- <>- <Text className="mt-4 mb-1 block border-gray-6 border-t pt-4 font-medium text-sm">- Test- </Text>- <Text color="gray" className="mb-1 text-[13px]">- Fire each delivery channel directly to check it works end to end.- {nativeUnavailable- ? " Native notifications aren't available on this host."- : ""}- </Text>-- <SettingRow- label="In-app toast"- description={`Shows an in-app toast — the tier used when the app is focused but you're not on the relevant task${canvasEnabled ? " or canvas" : ""}.`}- >- <Button variant="soft" size="1" onClick={testToast} disabled={!bus}>- Send- </Button>- </SettingRow>-- {localWorkspaces && (- <SettingRow- label="Deep-link toast"+ <SettingsSection label="Test">+ <SettingsCard>+ <SettingsCardRow+ label="Send a test alert"description={- deepLinkTask- ? `Toast with a "View" action that opens "${deepLinkTask.title}".`- : "Run a task first to test deep-linking from a toast."+ nativeUnavailable+ ? "System notifications aren't available on this host"+ : "Fire a channel directly to check it works end to end"}>- <Button- variant="soft"- size="1"- onClick={testToastDeepLink}- disabled={!bus || !deepLinkTask}- >- Send- </Button>- </SettingRow>- )}-- <SettingRow- label="Native OS notification"- description="Shows a system notification — the tier used when the app is in the background."- noBorder={!localWorkspaces}- >- <Button- variant="soft"- size="1"- onClick={testNative}- disabled={nativeUnavailable}- >- Send- </Button>- </SettingRow>-- {localWorkspaces && (- <SettingRow- label="Deep-link notification"- description={- deepLinkTask- ? `Fires a native notification that opens "${deepLinkTask.title}" when clicked.`- : "Run a task first to test deep-linking from a notification."- }- >- <Button- variant="soft"- size="1"- onClick={testNativeDeepLink}- disabled={nativeUnavailable || !deepLinkTask}- >- Send- </Button>- </SettingRow>- )}-- {localWorkspaces && (- <SettingRow- label="Dock badge"- description="Adds the unread dot to the dock icon (clears on next focus)."- >- <Button- variant="soft"- size="1"- onClick={() => notifications?.showUnreadIndicator()}- disabled={nativeUnavailable}- >- Show- </Button>- </SettingRow>- )}-- {localWorkspaces && (- <SettingRow- label="Dock bounce"- description="Bounces the dock icon once to request attention."- noBorder- >- <Button- variant="soft"- size="1"- onClick={() => notifications?.requestAttention()}- disabled={nativeUnavailable}- >- Bounce- </Button>- </SettingRow>- )}- </>+ <DropdownMenu>+ <DropdownMenuTrigger+ render={+ <Button type="button" variant="outline" size="sm">+ Send test+ <CaretDown size={10} weight="bold" />+ </Button>+ }+ />+ <DropdownMenuContent align="end" side="bottom" sideOffset={6}>+ <DropdownMenuItem onClick={testToast} disabled={!bus}>+ In-app toast+ </DropdownMenuItem>+ {localWorkspaces && (+ <DropdownMenuItem+ onClick={testToastDeepLink}+ disabled={!bus || !deepLinkTask}+ >+ Toast that opens the latest task+ </DropdownMenuItem>+ )}+ <DropdownMenuItem+ onClick={testNative}+ disabled={nativeUnavailable}+ >+ System notification+ </DropdownMenuItem>+ {localWorkspaces && (+ <>+ <DropdownMenuItem+ onClick={testNativeDeepLink}+ disabled={nativeUnavailable || !deepLinkTask}+ >+ Notification that opens the latest task+ </DropdownMenuItem>+ <DropdownMenuItem+ onClick={() => notifications?.showUnreadIndicator()}+ disabled={nativeUnavailable}+ >+ Dock badge+ </DropdownMenuItem>+ <DropdownMenuItem+ onClick={() => notifications?.requestAttention()}+ disabled={nativeUnavailable}+ >+ Dock bounce+ </DropdownMenuItem>+ </>+ )}+ </DropdownMenuContent>+ </DropdownMenu>+ </SettingsCardRow>+ </SettingsCard>+ </SettingsSection>);}diff --git a/products/desktop/packages/ui/src/features/settings/sections/PersonalizationSettings.tsx b/products/desktop/packages/ui/src/features/settings/sections/PersonalizationSettings.tsxindex 5539e5e94d45..4e850a65c6ae 100644--- a/products/desktop/packages/ui/src/features/settings/sections/PersonalizationSettings.tsx+++ b/products/desktop/packages/ui/src/features/settings/sections/PersonalizationSettings.tsx@@ -1,12 +1,18 @@+import { buildPostHogUrl } from "@posthog/core/settings/posthogUrl";+import { Switch, Textarea } from "@posthog/quill";import { ANALYTICS_EVENTS } from "@posthog/shared";-import { SettingRow } from "@posthog/ui/features/settings/SettingRow";+import { useAuthStateValue } from "@posthog/ui/features/auth/store";+import {+ SettingsCard,+ SettingsCardRow,+ SettingsSection,+} from "@posthog/ui/features/settings/components/SettingsCard";import {type SyncedCustomInstructions,useSettingsStore,} from "@posthog/ui/features/settings/settingsStore";import { useDebounce } from "@posthog/ui/primitives/hooks/useDebounce";import { track } from "@posthog/ui/shell/analytics";-import { Callout, Flex, Switch, Text, TextArea } from "@radix-ui/themes";import { useCallback, useEffect, useState } from "react";const MAX_INSTRUCTIONS_LENGTH = 2000;@@ -20,8 +26,8 @@ export interface PersonalizationSettingsViewProps {synced: SyncedCustomInstructions | null;}-// Pure render of the tab — the container below owns the store wiring,-// debounce and analytics. Storybook targets this.+// Pure render of the instructions block. The container below owns the store+// wiring, debounce and analytics. Storybook targets this.export function PersonalizationSettingsView({instructions,onInstructionsChange,@@ -31,65 +37,64 @@ export function PersonalizationSettingsView({synced,}: PersonalizationSettingsViewProps) {return (- <Flex direction="column">- <SettingRow- label="Sync from AGENTS.md / CLAUDE.md"- description="On start, read your user-level AGENTS.md (or CLAUDE.md if you have no AGENTS.md) and use it instead of the custom instructions below, so they only live in one place"- >- <Switch- checked={syncFromFile}- onCheckedChange={onSyncToggle}- size="1"- />- </SettingRow>-- <Flex direction="column" gap="1" py="4">- <Flex direction="column" gap="1" className="mb-2">- <Text className="font-medium text-sm">Custom instructions</Text>- <Text color="gray" className="text-[13px]">- Instructions included in every agent session- </Text>- </Flex>-- {syncFromFile && !synced && (- <Callout.Root size="1" color="amber" mb="2">- <Callout.Text>+ <SettingsSection+ label="Custom instructions"+ description="Included in every agent session."+ >+ <SettingsCard>+ <SettingsCardRow+ label="Sync from AGENTS.md / CLAUDE.md"+ description="Use your user-level AGENTS.md (or CLAUDE.md) instead of the instructions below, so they live in one place"+ >+ <Switch+ size="sm"+ checked={syncFromFile}+ onCheckedChange={onSyncToggle}+ />+ </SettingsCardRow>++ <div className="flex flex-col gap-1.5 px-3.5 py-3">+ {syncFromFile && !synced && (+ <div className="rounded-(--radius-2) border border-(--amber-6) bg-(--amber-2) px-2.5 py-2 text-[12px] text-amber-11">No AGENTS.md or CLAUDE.md found in your home directory or in- ~/.agents, ~/.codex or ~/.claude. Nothing is synced — add one of+ ~/.agents, ~/.codex or ~/.claude. Nothing is synced. Add one ofthose files, or turn sync off to use the instructions below.- </Callout.Text>- </Callout.Root>- )}-- <TextArea- value={instructions}- onChange={(e) => onInstructionsChange(e.target.value)}- onBlur={onInstructionsBlur}- maxLength={MAX_INSTRUCTIONS_LENGTH}- placeholder="e.g. Always write tests for new code. Prefer functional patterns."- rows={6}- size="1"- resize="vertical"- // Radix's disabled state is subtle in dark mode; drop the opacity so- // the box clearly reads as inactive while the file is in charge.- className={syncFromFile ? "w-full opacity-50" : "w-full"}- disabled={syncFromFile}- />- {syncFromFile ? (- synced && (- <Text color="gray" align="right" className="text-[13px]">- Using {synced.displayPath}- {synced.truncated ? " (truncated)" : ""} — edit that file to- change your personalization- </Text>- )- ) : (- <Text color="gray" align="right" className="text-[13px]">- {instructions.length}/{MAX_INSTRUCTIONS_LENGTH}- </Text>- )}- </Flex>- </Flex>+ </div>+ )}++ <Textarea+ value={instructions}+ onChange={(e) => onInstructionsChange(e.target.value)}+ onBlur={onInstructionsBlur}+ maxLength={MAX_INSTRUCTIONS_LENGTH}+ placeholder="e.g. Always write tests for new code. Prefer functional patterns."+ rows={6}+ className={+ syncFromFile+ ? "w-full resize-y text-[12.5px] opacity-50"+ : "w-full resize-y text-[12.5px]"+ }+ disabled={syncFromFile}+ />+ {syncFromFile ? (+ synced && (+ <span className="text-right text-[12px] text-gray-10">+ Using{" "}+ <span className="font-mono text-[11px]">+ {synced.displayPath}+ </span>+ {synced.truncated ? " (truncated)" : ""}. Edit that file to+ change your personalization.+ </span>+ )+ ) : (+ <span className="text-right text-[12px] text-gray-10 tabular-nums">+ {instructions.length}/{MAX_INSTRUCTIONS_LENGTH}+ </span>+ )}+ </div>+ </SettingsCard>+ </SettingsSection>);}@@ -151,13 +156,134 @@ export function PersonalizationSettings() {);return (- <PersonalizationSettingsView- instructions={draft ?? customInstructions}- onInstructionsChange={setDraft}- onInstructionsBlur={handleInstructionsBlur}- syncFromFile={syncFromFile}- onSyncToggle={handleSyncToggle}- synced={synced}- />+ <div className="flex flex-col gap-7">+ <PersonalizationSettingsView+ instructions={draft ?? customInstructions}+ onInstructionsChange={setDraft}+ onInstructionsBlur={handleInstructionsBlur}+ syncFromFile={syncFromFile}+ onSyncToggle={handleSyncToggle}+ synced={synced}+ />+ <FunSection />+ </div>+ );+}++function FunSection() {+ const {+ hedgehogMode,+ slotMachineMode,+ brainrotMode,+ setHedgehogMode,+ setSlotMachineMode,+ setBrainrotMode,+ } = useSettingsStore();++ const handleHedgehogModeChange = useCallback(+ (checked: boolean) => {+ track(ANALYTICS_EVENTS.SETTING_CHANGED, {+ setting_name: "hedgehog_mode",+ new_value: checked,+ old_value: hedgehogMode,+ });+ setHedgehogMode(checked);+ },+ [hedgehogMode, setHedgehogMode],+ );++ const handleSlotMachineModeChange = useCallback(+ (checked: boolean) => {+ track(ANALYTICS_EVENTS.SETTING_CHANGED, {+ setting_name: "slot_machine_mode",+ new_value: checked,+ old_value: slotMachineMode,+ });+ setSlotMachineMode(checked);+ },+ [slotMachineMode, setSlotMachineMode],+ );++ const handleBrainrotModeChange = useCallback(+ (checked: boolean) => {+ track(ANALYTICS_EVENTS.SETTING_CHANGED, {+ setting_name: "brainrot_mode",+ new_value: checked,+ old_value: brainrotMode,+ });+ setBrainrotMode(checked);+ },+ [brainrotMode, setBrainrotMode],+ );++ return (+ <SettingsSection label="Fun">+ <SettingsCard>+ <SettingsCardRow+ label="Hedgehog mode"+ description={<HedgehogDescription />}+ >+ <Switch+ size="sm"+ checked={hedgehogMode}+ onCheckedChange={handleHedgehogModeChange}+ />+ </SettingsCardRow>++ <SettingsCardRow+ label="Slot machine mode 🎰"+ description="A pull-able lever while a task runs. Every run is a gamble."+ >+ <Switch+ size="sm"+ checked={slotMachineMode}+ onCheckedChange={handleSlotMachineModeChange}+ />+ </SettingsCardRow>++ <SettingsCardRow+ label="Brainrot mode ⚡"+ description="Adds a Brainrot option to empty command center cells that fills them with a looping video"+ >+ <Switch+ size="sm"+ checked={brainrotMode}+ onCheckedChange={handleBrainrotModeChange}+ />+ </SettingsCardRow>+ </SettingsCard>+ </SettingsSection>+ );+}++function HedgehogDescription() {+ const projectId = useAuthStateValue((state) => state.currentProjectId);+ const cloudRegion = useAuthStateValue((state) => state.cloudRegion);++ const customizeUrl = projectId+ ? buildPostHogUrl(+ `/project/${projectId}/settings/user-customization`,+ cloudRegion,+ )+ : null;++ return (+ <span>+ A hedgehog buddy walks around your screen. It can take a few seconds to+ appear.+ {customizeUrl && (+ <>+ {" "}+ <a+ href={customizeUrl}+ target="_blank"+ rel="noreferrer"+ className="text-accent-11 underline hover:text-accent-12"+ >+ Customize your hedgehog+ </a>+ </>+ )}+ </span>);}diff --git a/products/desktop/packages/ui/src/features/settings/sections/UpdatesSettings.tsx b/products/desktop/packages/ui/src/features/settings/sections/UpdatesSettings.tsxindex d7206240de1a..48e5f244bd0d 100644--- a/products/desktop/packages/ui/src/features/settings/sections/UpdatesSettings.tsx+++ b/products/desktop/packages/ui/src/features/settings/sections/UpdatesSettings.tsx@@ -4,20 +4,24 @@ import {resolveCheckResultAction,} from "@posthog/core/settings/updateStatus";import { useHostTRPC } from "@posthog/host-router/react";+import { Button, Spinner, Switch } from "@posthog/quill";import { ANALYTICS_EVENTS } from "@posthog/shared";-import { SettingRow } from "@posthog/ui/features/settings/SettingRow";+import {+ SettingsCard,+ SettingsCardRow,+ SettingsSection,+} from "@posthog/ui/features/settings/components/SettingsCard";import { useSettingsStore } from "@posthog/ui/features/settings/settingsStore";import { useWhatsNewStore } from "@posthog/ui/features/updates/whatsNewStore";import { track } from "@posthog/ui/shell/analytics";import { logger } from "@posthog/ui/shell/logger";-import { Badge, Button, Flex, Spinner, Switch, Text } from "@radix-ui/themes";import { useMutation, useQuery } from "@tanstack/react-query";import { useSubscription } from "@trpc/tanstack-react-query";import { useCallback, useEffect, useRef, useState } from "react";const log = logger.scope("updates-settings");-export function UpdatesSettings() {+export function UpdatesSection() {const trpc = useHostTRPC();const { data: appVersion } = useQuery(trpc.os.getAppVersion.queryOptions());const { data: updatesEnabled } = useQuery(@@ -119,91 +123,93 @@ export function UpdatesSettings() {}),);- return (- <Flex direction="column">- <SettingRow label="Current version">- <Flex align="center" gap="2">- <Button- variant="ghost"- size="1"- onClick={() => useWhatsNewStore.getState().open()}- >- View changelog- </Button>- <Badge size="1" variant="soft" color="gray">- {appVersion || "Loading..."}- </Badge>- </Flex>- </SettingRow>-- {updatesEnabled?.enabled ? (- <>- <SettingRow- label="Download updates automatically"- description="Download new versions in the background and install them on the next quit. When off, you choose when to download each update."- >- <Switch- checked={downloadUpdatesAutomatically}- onCheckedChange={handleAutoDownloadChange}- size="1"- />- </SettingRow>- <SettingRow- label="Dismissible update banners"- description="Reveal a dismiss button when hovering update banners. A dismissed banner stays hidden until a new update arrives or the app restarts."- >- <Switch- checked={dismissibleUpdateBanners}- onCheckedChange={handleDismissibleBannersChange}- size="1"- />- </SettingRow>- </>- ) : null}-- <SettingRow- label="Check for updates"- description="Automatically checks for new versions on startup"- noBorder+ const statusLine = updateStatus.message && (+ <span className="inline-flex items-center gap-1">+ {updateStatus.type === "info" && checkingForUpdates && (+ <Spinner className="size-3" />+ )}+ {updateStatus.type === "success" && (+ <CheckCircle size={13} weight="fill" className="text-green-9" />+ )}+ {updateStatus.type === "error" && (+ <XCircle size={13} weight="fill" className="text-red-9" />+ )}+ <span+ className={+ updateStatus.type === "error"+ ? "text-red-11"+ : updateStatus.type === "success"+ ? "text-green-11"+ : undefined+ }>- <Flex align="center" gap="3">- {updateStatus.message && (- <Flex align="center" gap="1">- {updateStatus.type === "info" && checkingForUpdates && (- <Spinner size="1" />- )}- {updateStatus.type === "success" && (- <CheckCircle size={14} weight="fill" className="text-green-9" />- )}- {updateStatus.type === "error" && (- <XCircle size={14} weight="fill" className="text-red-9" />- )}- <Text- color={- updateStatus.type === "error"- ? "red"- : updateStatus.type === "success"- ? "green"- : "gray"- }- className="text-[13px]"- >- {updateStatus.message}- </Text>- </Flex>- )}- {!updatesDisabled && (+ {updateStatus.message}+ </span>+ </span>+ );++ return (+ <SettingsSection label="Updates">+ <SettingsCard>+ <SettingsCardRow+ label={+ <span className="inline-flex items-baseline gap-2">+ Version+ <span className="font-mono font-normal text-[12px] text-gray-11">+ {appVersion ?? "…"}+ </span>+ </span>+ }+ description={statusLine}+ >+ <div className="flex items-center gap-2"><Button- variant="soft"- size="1"- onClick={handleCheckForUpdates}- disabled={checkingForUpdates}+ type="button"+ variant="link-muted"+ size="sm"+ onClick={() => useWhatsNewStore.getState().open()}>- {checkingForUpdates ? "Checking..." : "Check now"}+ Changelog</Button>- )}- </Flex>- </SettingRow>- </Flex>+ {!updatesDisabled && (+ <Button+ type="button"+ variant="outline"+ size="sm"+ onClick={handleCheckForUpdates}+ disabled={checkingForUpdates}+ >+ {checkingForUpdates ? "Checking..." : "Check now"}+ </Button>+ )}+ </div>+ </SettingsCardRow>++ {updatesEnabled?.enabled && (+ <>+ <SettingsCardRow+ label="Download updates automatically"+ description="New versions download in the background and install on the next quit"+ >+ <Switch+ size="sm"+ checked={downloadUpdatesAutomatically}+ onCheckedChange={handleAutoDownloadChange}+ />+ </SettingsCardRow>+ <SettingsCardRow+ label="Dismissible update banners"+ description="Hovering an update banner reveals a dismiss button"+ >+ <Switch+ size="sm"+ checked={dismissibleUpdateBanners}+ onCheckedChange={handleDismissibleBannersChange}+ />+ </SettingsCardRow>+ </>+ )}+ </SettingsCard>+ </SettingsSection>);}diff --git a/products/desktop/packages/ui/src/features/settings/sections/environments/CloudEnvironmentsSettings.tsx b/products/desktop/packages/ui/src/features/settings/sections/environments/CloudEnvironmentsSettings.tsxindex 2252998d4c16..cb320fa95ee2 100644--- a/products/desktop/packages/ui/src/features/settings/sections/environments/CloudEnvironmentsSettings.tsx+++ b/products/desktop/packages/ui/src/features/settings/sections/environments/CloudEnvironmentsSettings.tsx@@ -25,6 +25,10 @@ import {import { useHandleOpenTask } from "@posthog/ui/features/deep-links/useHandleOpenTask";import { GitHubRepoPicker } from "@posthog/ui/features/folder-picker/GitHubRepoPicker";import { useCloudRepoPicker } from "@posthog/ui/features/integrations/useCloudRepoPicker";+import {+ SettingsSelect,+ type SettingsSelectOption,+} from "@posthog/ui/features/settings/components/SettingsSelect";import { useSettingsPageStore } from "@posthog/ui/features/settings/stores/settingsPageStore";import { ChevronDownIcon } from "@radix-ui/react-icons";import {@@ -48,7 +52,6 @@ import {} from "react";import { toast } from "../../../../primitives/toast";import { imageFailureDetail } from "./imageBuildWatcher";-import { SettingsSelect, type SettingsSelectOption } from "./SettingsSelect";import {useSandboxCustomImageDetail,useSandboxCustomImages,diff --git a/products/desktop/packages/ui/src/features/settings/settingsSearch.test.ts b/products/desktop/packages/ui/src/features/settings/settingsSearch.test.tsnew file mode 100644index 000000000000..111eacc57960--- /dev/null+++ b/products/desktop/packages/ui/src/features/settings/settingsSearch.test.ts@@ -0,0 +1,30 @@+import { describe, expect, it } from "vitest";+import { searchSettings } from "./settingsSearch";+import type { SettingsCategory } from "./types";++const NO_HIDDEN: ReadonlySet<SettingsCategory> = new Set();++describe("searchSettings", () => {+ it.each([+ ["matches labels case-insensitively", "THEME", "Theme"],+ [+ "matches keywords the label doesn't contain",+ "elevenlabs",+ "Spoken narration",+ ],+ ["ranks a label prefix above keyword hits", "dock badge", "Dock badge"],+ ])("%s", (_name, query, expectedFirstLabel) => {+ const results = searchSettings(query, NO_HIDDEN);+ expect(results[0]?.label).toBe(expectedFirstLabel);+ });++ it("requires every token to match", () => {+ expect(searchSettings("dock zzzz", NO_HIDDEN)).toEqual([]);+ });++ it("excludes entries from hidden categories", () => {+ const hidden: ReadonlySet<SettingsCategory> = new Set(["terminal"]);+ const results = searchSettings("terminal", hidden);+ expect(results.every((r) => r.category !== "terminal")).toBe(true);+ });+});diff --git a/products/desktop/packages/ui/src/features/settings/settingsSearch.ts b/products/desktop/packages/ui/src/features/settings/settingsSearch.tsnew file mode 100644index 000000000000..fd8c22345965--- /dev/null+++ b/products/desktop/packages/ui/src/features/settings/settingsSearch.ts@@ -0,0 +1,297 @@+import {+ SETTINGS_PAGE_LABELS,+ type SettingsCategory,+} from "@posthog/ui/features/settings/types";++export interface SettingsSearchEntry {+ category: SettingsCategory;+ label: string;+ keywords?: string[];+}++// Hand-curated index of the settings each page holds. When a page gains or+// loses a setting, update its entries here so search keeps finding it. Page+// display names come from SETTINGS_PAGE_LABELS, not repeated per entry.+export const SETTINGS_SEARCH_INDEX: SettingsSearchEntry[] = [+ {+ category: "general",+ label: "Theme",+ keywords: ["appearance", "light", "dark", "system"],+ },+ {+ category: "general",+ label: "PostHog account",+ keywords: ["billing", "manage account", "email"],+ },+ {+ category: "general",+ label: "Mission Control overlay",+ keywords: ["macos", "logo"],+ },+ {+ category: "general",+ label: "Start in",+ keywords: ["plan mode", "initial task mode", "new tasks"],+ },+ {+ category: "general",+ label: "Effort",+ keywords: ["reasoning", "effort level"],+ },+ {+ category: "general",+ label: "Messaging",+ keywords: ["queue", "steer", "messaging mode"],+ },+ {+ category: "general",+ label: "Send messages with",+ keywords: ["enter", "cmd enter", "submit"],+ },+ {+ category: "general",+ label: "Convert long pastes to attachments",+ keywords: ["paste", "attachment", "long text"],+ },+ {+ category: "general",+ label: "Open diffs in",+ keywords: ["diff", "split pane", "editor"],+ },+ {+ category: "general",+ label: "Keep awake while agents work",+ keywords: ["sleep", "power", "battery"],+ },+ {+ category: "general",+ label: "Updates",+ keywords: [+ "version",+ "changelog",+ "check for updates",+ "download automatically",+ "update banner",+ ],+ },++ {+ category: "notifications",+ label: "System notifications",+ keywords: ["push", "native", "os notification", "alerts"],+ },+ {+ category: "notifications",+ label: "In-app toasts",+ keywords: ["toast"],+ },+ {+ category: "notifications",+ label: "Dock badge",+ keywords: ["badge", "unread dot"],+ },+ {+ category: "notifications",+ label: "Dock bounce",+ keywords: ["bounce", "attention"],+ },+ {+ category: "notifications",+ label: "Completion sound",+ keywords: ["sound", "volume", "chime", "custom sound"],+ },+ {+ category: "notifications",+ label: "Match speed to task length",+ keywords: ["sound speed", "playback rate", "scale sound", "task length"],+ },+ {+ category: "notifications",+ label: "Spoken narration",+ keywords: ["voice", "speech", "speak", "elevenlabs", "narration"],+ },+ {+ category: "notifications",+ label: "Send a test alert",+ keywords: ["test notification"],+ },++ {+ category: "personalization",+ label: "Custom instructions",+ keywords: ["agents.md", "claude.md", "instructions", "sync"],+ },+ {+ category: "personalization",+ label: "Hedgehog mode",+ keywords: ["hedgehog", "buddy", "fun"],+ },+ {+ category: "personalization",+ label: "Slot machine mode",+ keywords: ["slot", "lever", "fun"],+ },+ {+ category: "personalization",+ label: "Brainrot mode",+ keywords: ["video", "fun"],+ },++ {+ category: "plan-usage",+ label: "Plan & usage",+ keywords: ["billing", "credits", "spend", "subscription"],+ },+ {+ category: "workspaces",+ label: "Workspaces",+ keywords: ["repos", "folders", "projects", "directories"],+ },+ {+ category: "worktrees",+ label: "Worktrees",+ keywords: ["git worktree", "cleanup", "disk"],+ },+ {+ category: "environments",+ label: "Environments",+ keywords: ["sandbox", "cloud environment", "image", "setup commands"],+ },+ {+ category: "terminal",+ label: "Terminal font",+ keywords: ["font", "monospace", "berkeley"],+ },+ {+ category: "terminal",+ label: "GPU rendering",+ keywords: ["webgl", "terminal"],+ },+ {+ category: "agents",+ label: "Agents",+ keywords: ["responders", "scouts", "signal sources", "setup agent"],+ },+ {+ category: "signals",+ label: "Self-driving",+ keywords: ["signals", "sources", "autostart", "base branches"],+ },+ {+ category: "skills",+ label: "Skills",+ keywords: ["slash commands"],+ },+ {+ category: "mcp-servers",+ label: "MCP servers",+ keywords: ["mcp", "tools", "connectors"],+ },+ {+ category: "harness",+ label: "Permission rules",+ keywords: ["allowed", "denied", "bypass permissions", "claude config"],+ },+ {+ category: "harness",+ label: "Claude Code & Codex",+ keywords: ["harness", "hooks", "memory", "claude", "codex"],+ },+ {+ category: "shortcuts",+ label: "Keyboard shortcuts",+ keywords: ["hotkeys", "keybindings"],+ },+ {+ category: "github",+ label: "GitHub",+ keywords: ["repositories", "connect", "integration"],+ },+ {+ category: "slack",+ label: "Slack",+ keywords: ["channels", "integration"],+ },+ {+ category: "discord",+ label: "Discord",+ keywords: ["presence", "integration"],+ },+ {+ category: "sidebar",+ label: "Sidebar",+ keywords: ["nav", "customize", "reorder"],+ },++ {+ category: "advanced",+ label: "Always create pull requests for cloud runs",+ keywords: ["auto publish", "draft pr", "pull request"],+ },+ {+ category: "advanced",+ label: "Compress command output",+ keywords: ["rtk", "tokens"],+ },+ {+ category: "advanced",+ label: "Reset onboarding and tours",+ keywords: ["tour", "tutorial"],+ },+ {+ category: "advanced",+ label: "Clear application storage",+ keywords: ["reset app", "delete data"],+ },+ {+ category: "advanced",+ label: "Debug logs for cloud runs",+ keywords: ["debug", "console output"],+ },+ {+ category: "advanced",+ label: "Developer mode",+ keywords: ["dev toolbar"],+ },+];++const MAX_RESULTS = 12;++function tokenScore(entry: SettingsSearchEntry, token: string): number {+ const label = entry.label.toLowerCase();+ if (label.startsWith(token)) return 3;+ if (label.includes(token)) return 2;+ const inKeywords = entry.keywords?.some((k) => k.includes(token));+ const page = SETTINGS_PAGE_LABELS[entry.category].toLowerCase();+ if (inKeywords || page.includes(token)) return 1;+ return 0;+}++/**+ * Case-insensitive search over the settings index. Every whitespace-separated+ * token must match the entry's label, keywords, or page name.+ */+export function searchSettings(+ query: string,+ hiddenCategories: ReadonlySet<SettingsCategory>,+): SettingsSearchEntry[] {+ const tokens = query.trim().toLowerCase().split(/\s+/).filter(Boolean);+ if (tokens.length === 0) return [];++ return SETTINGS_SEARCH_INDEX.filter(+ (entry) => !hiddenCategories.has(entry.category),+ )+ .map((entry) => {+ let score = 0;+ for (const token of tokens) {+ const s = tokenScore(entry, token);+ if (s === 0) return { entry, score: 0 };+ score += s;+ }+ return { entry, score };+ })+ .filter((scored) => scored.score > 0)+ .sort((a, b) => b.score - a.score)+ .slice(0, MAX_RESULTS)+ .map((scored) => scored.entry);+}diff --git a/products/desktop/packages/ui/src/features/settings/settingsVisibility.test.ts b/products/desktop/packages/ui/src/features/settings/settingsVisibility.test.tsindex ed4b939e20d2..88f3e8fa8853 100644--- a/products/desktop/packages/ui/src/features/settings/settingsVisibility.test.ts+++ b/products/desktop/packages/ui/src/features/settings/settingsVisibility.test.ts@@ -28,14 +28,7 @@ describe("getHiddenSettingsCategories", () => {spendAnalysisEnabled: true,localWorkspaces: false,},- expected: [- "workspaces",- "worktrees",- "terminal",- "harness",- "discord",- "updates",- ],+ expected: ["workspaces", "worktrees", "terminal", "harness", "discord"],},{// The channels layout uses a fixed nav, so the Sidebar page'sdiff --git a/products/desktop/packages/ui/src/features/settings/settingsVisibility.ts b/products/desktop/packages/ui/src/features/settings/settingsVisibility.tsindex f2bddb8b0518..6afbcac9d05f 100644--- a/products/desktop/packages/ui/src/features/settings/settingsVisibility.ts+++ b/products/desktop/packages/ui/src/features/settings/settingsVisibility.ts@@ -9,7 +9,6 @@ const LOCAL_ONLY_CATEGORIES: ReadonlySet<SettingsCategory> = new Set(["terminal","harness","discord",- "updates",]);interface SettingsVisibility {diff --git a/products/desktop/packages/ui/src/features/settings/types.ts b/products/desktop/packages/ui/src/features/settings/types.tsindex 153a098e58c8..cf759c86f32f 100644--- a/products/desktop/packages/ui/src/features/settings/types.ts+++ b/products/desktop/packages/ui/src/features/settings/types.ts@@ -17,7 +17,6 @@ export type SettingsCategory =| "github"| "slack"| "signals"- | "updates"| "advanced"| "discord";@@ -40,7 +39,6 @@ export const SETTINGS_CATEGORIES: readonly SettingsCategory[] = ["github","slack","signals",- "updates","advanced","discord",];@@ -49,11 +47,39 @@ export function isSettingsCategory(value: string): value is SettingsCategory {return (SETTINGS_CATEGORIES as readonly string[]).includes(value);}+// The display name of each settings page. Single source for the sidebar nav+// and search. The `Record` type forces an entry per category, so a new page+// can't ship without a name. `cloud-environments` shares the Environments page.+export const SETTINGS_PAGE_LABELS: Record<SettingsCategory, string> = {+ general: "General",+ notifications: "Notifications",+ "plan-usage": "Plan & usage",+ workspaces: "Workspaces",+ worktrees: "Worktrees",+ environments: "Environments",+ "cloud-environments": "Environments",+ agents: "Agents",+ skills: "Skills",+ "mcp-servers": "MCP servers",+ personalization: "Personalization",+ sidebar: "Sidebar",+ terminal: "Terminal",+ harness: "Harness",+ shortcuts: "Shortcuts",+ github: "GitHub",+ slack: "Slack",+ signals: "Self-driving",+ advanced: "Advanced",+ discord: "Discord",+};+// The app restores the last location on startup, so a renamed category has to// keep resolving for anyone whose remembered URL still names the old one.const RENAMED_SETTINGS_CATEGORIES: Readonly<Record<string, SettingsCategory>> ={"claude-code": "harness",+ // The Updates page folded into General.+ updates: "general",};export function resolveSettingsCategory(diff --git a/products/desktop/packages/ui/src/features/sidebar/components/CustomizeSidebarDialog.test.tsx b/products/desktop/packages/ui/src/features/sidebar/components/CustomizeSidebarDialog.test.tsxindex 811b2f4d6c2e..5c62bacbc637 100644--- a/products/desktop/packages/ui/src/features/sidebar/components/CustomizeSidebarDialog.test.tsx+++ b/products/desktop/packages/ui/src/features/sidebar/components/CustomizeSidebarDialog.test.tsx@@ -154,7 +154,7 @@ describe("CustomizeSidebarSettings", () => {useSidebarStore.setState({ navItemOrder: ["configure", "inbox"] });renderSettings();- expect(rowLabels().slice(0, 2)).toEqual(["Configure", "Inbox"]);+ expect(rowLabels().slice(0, 2)).toEqual(["Settings", "Inbox"]);});it("previews on dragover and persists only on drop", () => {diff --git a/products/desktop/packages/ui/src/features/sidebar/components/SidebarNavSection.test.tsx b/products/desktop/packages/ui/src/features/sidebar/components/SidebarNavSection.test.tsxindex 47da00ef511f..f3263a61f2b7 100644--- a/products/desktop/packages/ui/src/features/sidebar/components/SidebarNavSection.test.tsx+++ b/products/desktop/packages/ui/src/features/sidebar/components/SidebarNavSection.test.tsx@@ -114,7 +114,7 @@ describe("SidebarNavSection", () => {["inbox", "Inbox"],["command-center", "Command Center"],["activity", "Activity"],- ["configure", "Configure"],+ ["configure", "Settings"],["loops", "Loops"],] as const)("removes %s from the sidebar when hidden", (id, label) => {useSidebarStore.setState({ navItemOverrides: { [id]: false } });diff --git a/products/desktop/packages/ui/src/features/sidebar/components/SidebarNavSection.tsx b/products/desktop/packages/ui/src/features/sidebar/components/SidebarNavSection.tsxindex 8901c91a0a4d..35ce94dc222d 100644--- a/products/desktop/packages/ui/src/features/sidebar/components/SidebarNavSection.tsx+++ b/products/desktop/packages/ui/src/features/sidebar/components/SidebarNavSection.tsx@@ -173,7 +173,7 @@ export function SidebarNavSection({configure: (depth) => (<ConfigureItemdepth={depth}- onClick={withNavTrack("configure", () => openSettings("agents"), depth)}+ onClick={withNavTrack("configure", () => openSettings(), depth)}/>),loops: (depth) => (diff --git a/products/desktop/packages/ui/src/features/sidebar/components/items/ConfigureItem.tsx b/products/desktop/packages/ui/src/features/sidebar/components/items/ConfigureItem.tsxindex 9c51be3f19f2..ba42b595dcc8 100644--- a/products/desktop/packages/ui/src/features/sidebar/components/items/ConfigureItem.tsx+++ b/products/desktop/packages/ui/src/features/sidebar/components/items/ConfigureItem.tsx@@ -1,4 +1,4 @@-import { SlidersHorizontal } from "@phosphor-icons/react";+import { GearSix } from "@phosphor-icons/react";import { SidebarItem } from "../SidebarItem";interface ConfigureItemProps {@@ -10,8 +10,8 @@ export function ConfigureItem({ onClick, depth = 0 }: ConfigureItemProps) {return (<SidebarItemdepth={depth}- icon={<SlidersHorizontal size={16} />}- label="Configure"+ icon={<GearSix size={16} />}+ label="Settings"onClick={onClick}/>);diff --git a/products/desktop/packages/ui/src/features/sidebar/constants.ts b/products/desktop/packages/ui/src/features/sidebar/constants.tsindex ef08be90bd6f..a7e10425ef1a 100644--- a/products/desktop/packages/ui/src/features/sidebar/constants.ts+++ b/products/desktop/packages/ui/src/features/sidebar/constants.ts@@ -32,7 +32,7 @@ export const CUSTOMIZABLE_NAV_ITEMS = [},{id: "configure",- label: "Configure",+ label: "Settings",analyticsId: "configure",defaultVisible: true,},