diff --git a/src/components/clinical-dashboard/settings-dialog.tsx b/src/components/clinical-dashboard/settings-dialog.tsx index 8c3508517..b3fb57ef3 100644 --- a/src/components/clinical-dashboard/settings-dialog.tsx +++ b/src/components/clinical-dashboard/settings-dialog.tsx @@ -1,6 +1,6 @@ "use client"; -import { type FormEvent, type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from "react"; +import { type FormEvent, type ReactNode, type UIEvent, useCallback, useEffect, useMemo, useRef, useState } from "react"; import { Bell, BookOpen, @@ -42,6 +42,7 @@ import { POPULATION_OPTIONS, useAppPreferences, } from "@/components/clinical-dashboard/use-app-preferences"; +import { useScrollHideReporter } from "@/components/clinical-dashboard/use-hide-on-scroll"; import { clearRecentQueries, countRecentQueries } from "@/lib/recent-query-storage"; import { cn, @@ -118,6 +119,10 @@ export function SettingsDialog({ const { theme, preference: themePreference, setPreference: setThemePreference } = useTheme(); const { preferences, setPreference, resetPreferences } = useAppPreferences(); + // Hide-on-scroll for the mobile glass header (phone-gated inside the hook), so + // the top goes fully edge-to-edge while scrolling — the same behaviour as the + // app's search bar. Desktop keeps a static in-panel header. + const { hidden: headerHidden, reportScroll } = useScrollHideReporter(); const auth = useAuthSession(); const accountData = useAccountData(); @@ -203,6 +208,14 @@ export function SettingsDialog({ [preferences.motion], ); + const handleScroll = useCallback( + (event: UIEvent) => { + const el = event.currentTarget; + reportScroll({ offset: el.scrollTop, maxOffset: el.scrollHeight - el.clientHeight, source: el }); + }, + [reportScroll], + ); + async function submitSettingsEmail(event: FormEvent) { event.preventDefault(); if (!settingsEmail.trim()) return; @@ -256,7 +269,7 @@ export function SettingsDialog({ type="button" onClick={onClose} aria-label="Close settings" - className="absolute right-2.5 top-[max(0.45rem,env(safe-area-inset-top))] z-10 grid h-9 w-9 place-items-center rounded-full text-[color:var(--text-muted)] transition hover:bg-[color:var(--surface)] hover:text-[color:var(--text-heading)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--focus)] lg:left-4 lg:right-auto lg:top-4 lg:h-10 lg:w-10" + className="grid h-9 w-9 shrink-0 place-items-center rounded-full border border-[color:var(--border)] bg-[color:var(--surface)]/70 text-[color:var(--text-muted)] shadow-[var(--shadow-inset)] transition hover:bg-[color:var(--surface)] hover:text-[color:var(--text-heading)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[color:var(--focus)] lg:h-10 lg:w-10 lg:border-transparent lg:bg-transparent lg:shadow-none" >