mirror of
https://github.com/browseros-ai/BrowserOS.git
synced 2026-05-21 21:05:09 +00:00
* Revert "feat: convert settings to popup dialog (#477)"
This reverts commit 42aa0ff1ef.
* fix: address review feedback for PR #498
- Remove erroneous SETTINGS_PAGE_VIEWED_EVENT tracking from SidebarLayout
(was firing on every non-settings page navigation)
- Fix mobile settings sidebar not closing on route change by merging
setMobileOpen(false) into the pathname-dependent analytics useEffect
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
66 lines
2.1 KiB
TypeScript
66 lines
2.1 KiB
TypeScript
import { Menu } from 'lucide-react'
|
|
import type { FC } from 'react'
|
|
import { useEffect, useState } from 'react'
|
|
import { Outlet, useLocation } from 'react-router'
|
|
import { SettingsSidebar } from '@/components/sidebar/SettingsSidebar'
|
|
import { Button } from '@/components/ui/button'
|
|
import { Sheet, SheetContent } from '@/components/ui/sheet'
|
|
import { useIsMobile } from '@/hooks/use-mobile'
|
|
import { SETTINGS_PAGE_VIEWED_EVENT } from '@/lib/constants/analyticsEvents'
|
|
import { track } from '@/lib/metrics/track'
|
|
import { RpcClientProvider } from '@/lib/rpc/RpcClientProvider'
|
|
|
|
export const SettingsSidebarLayout: FC = () => {
|
|
const location = useLocation()
|
|
const isMobile = useIsMobile()
|
|
const [mobileOpen, setMobileOpen] = useState(false)
|
|
|
|
useEffect(() => {
|
|
track(SETTINGS_PAGE_VIEWED_EVENT, { page: location.pathname })
|
|
setMobileOpen(false)
|
|
}, [location.pathname])
|
|
|
|
if (isMobile) {
|
|
return (
|
|
<RpcClientProvider>
|
|
<div className="flex min-h-screen flex-col bg-background">
|
|
<header className="flex h-14 shrink-0 items-center gap-2 border-b px-4">
|
|
<Button
|
|
variant="ghost"
|
|
size="icon"
|
|
className="-ml-1 size-7"
|
|
onClick={() => setMobileOpen(true)}
|
|
>
|
|
<Menu className="size-4" />
|
|
</Button>
|
|
<span className="font-semibold">Settings</span>
|
|
</header>
|
|
<main className="flex-1 overflow-y-auto">
|
|
<div className="mx-auto max-w-4xl px-4 py-8 sm:px-6 lg:px-8">
|
|
<Outlet />
|
|
</div>
|
|
</main>
|
|
<Sheet open={mobileOpen} onOpenChange={setMobileOpen}>
|
|
<SheetContent side="left" className="w-72 p-0">
|
|
<SettingsSidebar />
|
|
</SheetContent>
|
|
</Sheet>
|
|
</div>
|
|
</RpcClientProvider>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<RpcClientProvider>
|
|
<div className="flex h-screen bg-background">
|
|
<SettingsSidebar />
|
|
<main className="flex-1 overflow-y-auto">
|
|
<div className="mx-auto max-w-4xl px-4 py-8 sm:px-6 lg:px-8">
|
|
<Outlet />
|
|
</div>
|
|
</main>
|
|
</div>
|
|
</RpcClientProvider>
|
|
)
|
|
}
|