"use client";
/**
* /settings — the settings hub.
*
* A plain entry menu: one tappable row per setting type, each routing to its
* own dedicated page. This keeps the top level uncluttered — the actual
* controls live on the sub-pages (`/settings/reading`, `/settings/notifications`,
* `/settings/account`, `/settings/legal`) plus the existing
* `/settings/profile` editor. The "Offline" row is a direct shortcut to the
* device-local download library at `/downloads` (no intermediate page).
*
* Sign out is an action rather than a destination, so it sits on its own
* below the menu.
*/
import { useState } from "react";
import { useRouter } from "next/navigation";
import {
Bell,
BookOpenText,
DownloadCloud,
LogOut,
Scale,
ShieldCheck,
UserRound,
} from "lucide-react";
import { useAuth } from "@/components/auth/auth-provider";
import {
NavList,
NavRow,
SettingsShell,
} from "@/components/settings/settings-ui";
export default function SettingsPage() {
return (
}
label="Profile"
description="Name, handle, bio, and avatar."
/>
}
label="Reading preferences"
description="Theme, palette, font, and size — synced across devices."
/>
}
label="Notifications"
description="What reaches you, and on which channels."
/>
}
label="Offline downloads"
description="Manage pages and lectures saved to this device."
/>
}
label="Account & security"
description="Connected accounts, email, and password."
/>
}
label="Legal"
description="Terms, privacy, and data deletion."
/>
);
}
function SignOut() {
const { logOut } = useAuth();
const router = useRouter();
const [busy, setBusy] = useState(false);
async function onSignOut() {
setBusy(true);
try {
await logOut();
router.push("/");
router.refresh();
} catch {
// Logout errors are silent — the cookie is cleared on the server
// either way and the next protected request will redirect anyway.
setBusy(false);
}
}
return (
);
}