import { useLayoutEffect, useRef, type ReactNode } from "react"; import { HeaderAvatar } from "./AppHeader.js"; import { Icon, type IconName } from "./Icon.js"; import { Window } from "./Window.js"; export interface FeatureSettingsSection { id: T; label: ReactNode; group?: string; icon?: IconName; disabled?: boolean; } export interface FeatureSettingsWindowProps { open: boolean; title: ReactNode; subtitle?: ReactNode; identity: { title: ReactNode; subtitle?: ReactNode; avatarLabel: string; avatarUrl?: string; }; sections: readonly FeatureSettingsSection[]; activeSection: T; onSectionChange: (section: T) => void; onClose: () => void; children: ReactNode; footer?: ReactNode; headerActions?: ReactNode; } export function FeatureSettingsWindow({ open, title, subtitle, identity, sections, activeSection, onSectionChange, onClose, children, footer, headerActions, }: FeatureSettingsWindowProps) { const contentRef = useRef(null); useLayoutEffect(() => { if (contentRef.current) contentRef.current.scrollTop = 0; }, [activeSection]); return (
{children}
); }