import React from 'react'; import { ScrollableOverlay } from '@/components/ui/ScrollableOverlay'; import { isVSCodeRuntime } from '@/lib/desktop'; import { cn } from '@/lib/utils'; interface SettingsSidebarLayoutProps { /** Header content (typically SettingsSidebarHeader) */ header?: React.ReactNode; /** Footer content (e.g., AboutSettings on mobile) */ footer?: React.ReactNode; /** Main scrollable content */ children: React.ReactNode; /** Additional className for the outer container */ className?: string; } /** * Standard layout wrapper for settings sidebars. * Provides consistent background, scrolling, and header/footer slots. * * @example * } * > * {items.map(item => ( * * ))} * */ export const SettingsSidebarLayout: React.FC = ({ header, footer, children, className, }) => { const [isDesktopRuntime, setIsDesktopRuntime] = React.useState(() => { if (typeof window === 'undefined') return false; return typeof window.opencodeDesktop !== 'undefined'; }); const isVSCode = React.useMemo(() => isVSCodeRuntime(), []); React.useEffect(() => { if (typeof window === 'undefined') return; setIsDesktopRuntime(typeof window.opencodeDesktop !== 'undefined'); }, []); // Desktop app: transparent for blur effect // VS Code: bg-background (same as page content) // Web/mobile: bg-sidebar const bgClass = isDesktopRuntime ? 'bg-transparent' : isVSCode ? 'bg-background' : 'bg-sidebar'; return (
{header} {children} {footer}
); };