"use client"; import { useEffect, useState } from "react"; import Link from "next/link"; import { useRouter, usePathname, useSearchParams } from "next/navigation"; import { NavIcon } from "@/components/nav-icon"; import { cn } from "@/lib/utils"; const SECTIONS = [ { id: "household", label: "Household", icon: "people" }, { id: "sharing", label: "Sharing & links", icon: "link" }, { id: "notifications", label: "Notifications", icon: "bell" }, { id: "calendars", label: "Calendars & lists", icon: "calendar" }, { id: "appearance", label: "Appearance", icon: "sun" }, { id: "data", label: "Data & backups", icon: "history" }, ] as const; export type SectionId = (typeof SECTIONS)[number]["id"]; export function SettingsSidebar({ active }: { active: SectionId }) { const router = useRouter(); const pathname = usePathname(); return ( ); } // When the URL changes with a hash like #sharing (used by sidebar Share-links link), // ensure the matching section opens. function SectionHashSync({ pathname }: { pathname: string | null }) { const router = useRouter(); const searchParams = useSearchParams(); useEffect(() => { if (typeof window === "undefined") return; const hash = window.location.hash.slice(1); if (!hash) return; if (!SECTIONS.some((s) => s.id === hash)) return; if (searchParams?.get("s") === hash) return; const url = new URL(window.location.href); url.searchParams.set("s", hash); router.replace(url.pathname + "?" + url.searchParams.toString(), { scroll: false }); }, [pathname, router, searchParams]); return null; } export function SettingsTabsMobile({ active }: { active: SectionId }) { const router = useRouter(); return (