@@ -22,6 +22,7 @@ import {
2222 TreeStructure ,
2323 Wrench ,
2424} from "@phosphor-icons/react" ;
25+ import { MenuLabel } from "@posthog/quill" ;
2526import { BILLING_FLAG } from "@posthog/shared" ;
2627import { useOptionalAuthenticatedClient } from "@posthog/ui/features/auth/authClient" ;
2728import { useAuthStateValue } from "@posthog/ui/features/auth/store" ;
@@ -31,6 +32,7 @@ import { getUserInitials } from "@posthog/ui/features/auth/userInitials";
3132import { useFeatureFlag } from "@posthog/ui/features/feature-flags/useFeatureFlag" ;
3233import { SettingsPageContent } from "@posthog/ui/features/settings/components/SettingsPageContent" ;
3334import { closeSettings } from "@posthog/ui/features/settings/hooks/useOpenSettings" ;
35+ import { getHiddenSettingsCategories } from "@posthog/ui/features/settings/settingsVisibility" ;
3436import { useSettingsPageStore } from "@posthog/ui/features/settings/stores/settingsPageStore" ;
3537import type { SettingsCategory } from "@posthog/ui/features/settings/types" ;
3638import { useSpendAnalysisEnabled } from "@posthog/ui/features/usage/useSpendAnalysisEnabled" ;
@@ -122,43 +124,6 @@ const SIDEBAR_GROUPS: SidebarGroup[] = [
122124
123125const SIDEBAR_ITEMS = SIDEBAR_GROUPS . flatMap ( ( group ) => group . items ) ;
124126
125- // Settings that only make sense with a local filesystem/host (local worktrees,
126- // terminal, the local `claude` CLI, the desktop app itself). Hidden on the
127- // cloud-only web host.
128- const LOCAL_ONLY_CATEGORIES : ReadonlySet < SettingsCategory > = new Set ( [
129- "workspaces" ,
130- "worktrees" ,
131- "terminal" ,
132- "claude-code" ,
133- "discord" ,
134- "updates" ,
135- ] ) ;
136-
137- interface SettingsVisibility {
138- billingEnabled : boolean ;
139- spendAnalysisEnabled : boolean ;
140- localWorkspaces : boolean ;
141- }
142-
143- function getHiddenSettingsCategories ( {
144- billingEnabled,
145- spendAnalysisEnabled,
146- localWorkspaces,
147- } : SettingsVisibility ) : ReadonlySet < SettingsCategory > {
148- const hiddenCategories = new Set < SettingsCategory > ( ) ;
149-
150- if ( ! billingEnabled && ! spendAnalysisEnabled ) {
151- hiddenCategories . add ( "plan-usage" ) ;
152- }
153- if ( ! localWorkspaces ) {
154- for ( const category of LOCAL_ONLY_CATEGORIES ) {
155- hiddenCategories . add ( category ) ;
156- }
157- }
158-
159- return hiddenCategories ;
160- }
161-
162127export interface SettingsPanelProps {
163128 /**
164129 * Override the active category. Defaults to the `$category` URL param
@@ -206,10 +171,11 @@ export function SettingsPanel({
206171 // Guard direct navigation (URL, deep link, programmatic openSettings) to a
207172 // category hidden on this host. Fall back to General so a hidden section is
208173 // never rendered.
209- const resolvedCategory : SettingsCategory =
210- ! localWorkspaces && LOCAL_ONLY_CATEGORIES . has ( activeCategory )
211- ? "general"
212- : activeCategory ;
174+ const resolvedCategory : SettingsCategory = hiddenCategories . has (
175+ activeCategory ,
176+ )
177+ ? "general"
178+ : activeCategory ;
213179 const activeSidebarCategory : SettingsCategory =
214180 resolvedCategory === "cloud-environments"
215181 ? "environments"
@@ -266,9 +232,9 @@ export function SettingsPanel({
266232 < div className = "flex flex-col gap-3 py-2" >
267233 { sidebarGroups . map ( ( group ) => (
268234 < div key = { group . label } >
269- < Text className = "px-3 pb-1 font-medium text-[10px] text- gray-9 uppercase tracking-wider " >
235+ < MenuLabel className = "px-3 pb-1 text-gray-9" >
270236 { group . label }
271- </ Text >
237+ </ MenuLabel >
272238 { group . items . map ( ( item ) => {
273239 const isActive = activeSidebarCategory === item . id ;
274240 return (
0 commit comments