From 48cf9a1f62bc0c474c2fa30f85303b4fe6ba4f27 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Thu, 5 Mar 2026 22:16:36 +0100 Subject: [PATCH] feat: replace settings page with SettingsModal - Add SettingsModalProvider context and SettingsModalWrapper - Wire Header onOpenSettings callback via LayoutInner pattern - Remove old /settings page and SettingsPageClient - Bump @ciphera-net/ui to ^0.0.88 --- app/layout-content.tsx | 25 +- app/settings/SettingsPageClient.tsx | 532 ------------------- app/settings/page.tsx | 14 - components/settings/SettingsModalWrapper.tsx | 186 +++++++ lib/settings-modal-context.tsx | 31 ++ package-lock.json | 8 +- package.json | 2 +- 7 files changed, 241 insertions(+), 557 deletions(-) delete mode 100644 app/settings/SettingsPageClient.tsx delete mode 100644 app/settings/page.tsx create mode 100644 components/settings/SettingsModalWrapper.tsx create mode 100644 lib/settings-modal-context.tsx diff --git a/app/layout-content.tsx b/app/layout-content.tsx index 8ef4acd..e5f2caa 100644 --- a/app/layout-content.tsx +++ b/app/layout-content.tsx @@ -13,6 +13,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 SettingsModalWrapper from '@/components/settings/SettingsModalWrapper' const ORG_SWITCH_KEY = 'pulse_switching_org' @@ -44,10 +46,11 @@ const CIPHERA_APPS: CipheraApp[] = [ }, ] -export default function LayoutContent({ children }: { children: React.ReactNode }) { +function LayoutInner({ children }: { children: React.ReactNode }) { const auth = useAuth() const router = useRouter() const isOnline = useOnlineStatus() + const { openSettings } = useSettingsModal() const [orgs, setOrgs] = useState([]) const [isSwitchingOrg, setIsSwitchingOrg] = useState(() => { if (typeof window === 'undefined') return false @@ -87,7 +90,7 @@ export default function LayoutContent({ children }: { children: React.ReactNode const handleCreateOrganization = () => { router.push('/onboarding') } - + const showOfflineBar = Boolean(auth.user && !isOnline); const barHeightRem = 2.5; const headerHeightRem = 6; @@ -100,9 +103,9 @@ export default function LayoutContent({ children }: { children: React.ReactNode return ( <> {auth.user && } -
: null} apps={CIPHERA_APPS} currentAppId="pulse" + onOpenSettings={openSettings} customNavItems={ <> {!auth.user && ( @@ -136,11 +140,20 @@ export default function LayoutContent({ children }: { children: React.ReactNode > {children} -