67246c69e5
- Settings sidebar was a fixed-width vertical list with no responsive
breakpoint, squeezing the form into a sliver on mobile. Turn it into
a horizontal scrollable tab bar under md, vertical sidebar above.
- setLocale() fired the PATCH and swallowed the result with
.catch(() => {}) — never checked res.ok, no success/failure feedback.
A failed save (expired session, network blip) looked identical to a
successful one. Now returns a boolean, reverts local state on
failure, and the settings form toasts success/failure.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
23 lines
906 B
TypeScript
23 lines
906 B
TypeScript
import { headers } from "next/headers";
|
|
import { auth } from "@/lib/auth/server";
|
|
import { SettingsSidebar } from "@/components/settings/settings-sidebar";
|
|
import { getMessages } from "@/lib/i18n/server";
|
|
|
|
export default async function SettingsLayout({ children }: { children: React.ReactNode }) {
|
|
const session = await auth.api.getSession({ headers: await headers() });
|
|
const m = getMessages((session?.user as { locale?: string })?.locale);
|
|
|
|
return (
|
|
<div className="max-w-5xl mx-auto">
|
|
<div className="mb-8">
|
|
<h1 className="text-3xl font-bold tracking-tight">{m.settings.title}</h1>
|
|
<p className="text-muted-foreground mt-1">{m.settings.subtitle}</p>
|
|
</div>
|
|
<div className="flex flex-col md:flex-row gap-4 md:gap-8 md:items-start">
|
|
<SettingsSidebar />
|
|
<main className="flex-1 min-w-0 space-y-6">{children}</main>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|