From 0cb13e08fdd0fad61bb01ed4f5c7a0c7628d2450 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Wed, 25 Mar 2026 18:10:42 +0100 Subject: [PATCH] refactor(settings): wire all settings entry points to unified modal --- app/layout-content.tsx | 12 ++++-------- components/dashboard/Sidebar.tsx | 8 ++++---- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/app/layout-content.tsx b/app/layout-content.tsx index 8e91ea6..df84659 100644 --- a/app/layout-content.tsx +++ b/app/layout-content.tsx @@ -15,9 +15,8 @@ import { getUserOrganizations, switchContext, type OrganizationMember } from '@/ import { setSessionAction } from '@/app/actions/auth' import { LoadingOverlay } from '@ciphera-net/ui' import { useRouter } from 'next/navigation' -import { SettingsModalProvider, useSettingsModal } from '@/lib/settings-modal-context' -import { UnifiedSettingsProvider } from '@/lib/unified-settings-context' -import SettingsModalWrapper from '@/components/settings/SettingsModalWrapper' +import { SettingsModalProvider } from '@/lib/settings-modal-context' +import { UnifiedSettingsProvider, useUnifiedSettings } from '@/lib/unified-settings-context' import UnifiedSettingsModal from '@/components/settings/unified/UnifiedSettingsModal' const ORG_SWITCH_KEY = 'pulse_switching_org' @@ -54,7 +53,7 @@ function LayoutInner({ children }: { children: React.ReactNode }) { const router = useRouter() const pathname = usePathname() const isOnline = useOnlineStatus() - const { openSettings } = useSettingsModal() + const { openUnifiedSettings } = useUnifiedSettings() const [orgs, setOrgs] = useState([]) const [isSwitchingOrg, setIsSwitchingOrg] = useState(() => { if (typeof window === 'undefined') return false @@ -110,7 +109,6 @@ function LayoutInner({ children }: { children: React.ReactNode }) { <> {showOfflineBar && } {children} - ) @@ -138,12 +136,11 @@ function LayoutInner({ children }: { children: React.ReactNode }) { rightSideActions={} apps={CIPHERA_APPS} currentAppId="pulse" - onOpenSettings={openSettings} + onOpenSettings={() => openUnifiedSettings({ context: 'account', tab: 'profile' })} />
{children}
- ) @@ -161,7 +158,6 @@ function LayoutInner({ children }: { children: React.ReactNode }) { appName="Pulse" isAuthenticated={false} /> - ) } diff --git a/components/dashboard/Sidebar.tsx b/components/dashboard/Sidebar.tsx index 91f0a62..0f5b7d9 100644 --- a/components/dashboard/Sidebar.tsx +++ b/components/dashboard/Sidebar.tsx @@ -7,7 +7,7 @@ import Link from 'next/link' import { usePathname, useRouter } from 'next/navigation' import { listSites, type Site } from '@/lib/api/sites' import { useAuth } from '@/lib/auth/context' -import { useSettingsModal } from '@/lib/settings-modal-context' +import { useUnifiedSettings } from '@/lib/unified-settings-context' import { useSidebar } from '@/lib/sidebar-context' // `,` shortcut handled globally by UnifiedSettingsModal import { getUserOrganizations, switchContext, type OrganizationMember } from '@/lib/api/organization' @@ -461,7 +461,7 @@ export default function Sidebar({ const canEdit = user?.role === 'owner' || user?.role === 'admin' const pathname = usePathname() const router = useRouter() - const { openSettings } = useSettingsModal() + const { openUnifiedSettings } = useUnifiedSettings() const [sites, setSites] = useState([]) const [orgs, setOrgs] = useState([]) const [pendingHref, setPendingHref] = useState(null) @@ -532,7 +532,7 @@ export default function Sidebar({ auth={auth} orgs={orgs} onSwitchOrganization={handleSwitchOrganization} - openSettings={openSettings} + openSettings={() => openUnifiedSettings({ context: 'account', tab: 'profile' })} /> @@ -575,7 +575,7 @@ export default function Sidebar({ auth={auth} orgs={orgs} onSwitchOrganization={handleSwitchOrganization} - openSettings={openSettings} + openSettings={() => openUnifiedSettings({ context: 'account', tab: 'profile' })} />