feat(web): desktop layout (wider container + 2-col dashboard) + redirect-loop fix + mn string

- Shell content widens to max-w-6xl on desktop (was phone-strip max-w-2xl)
- Dashboard reflows into a 2-col grid on desktop instead of stretching
- On 401, clear session cookie via logout before redirect (prevents /login<->/home loop when cookie outlives server session)
- Profile 'Subscriptions' -> 'Захиалга'
This commit is contained in:
Munkherdene 2026-08-22 21:33:14 +08:00
parent d94e961d97
commit 6913c1e5ee
4 changed files with 11 additions and 3 deletions

View file

@ -17,7 +17,13 @@ async function req(method: string, path: string, body?: unknown): Promise<unknow
body: body === undefined ? undefined : JSON.stringify(body),
});
if (res.status === 401) {
if (typeof window !== "undefined") window.location.href = "/login";
// Clear the (now-stale) session cookie before redirecting. Otherwise the
// middleware bounces /login → /home on mere cookie presence, and a
// server-invalidated-but-not-expired session produces an infinite loop.
if (typeof window !== "undefined") {
await fetch("/api/auth/logout", { method: "POST", credentials: "same-origin" }).catch(() => {});
window.location.href = "/login";
}
throw new ApiError(401, "unauthorized");
}
if (!res.ok) throw new ApiError(res.status, await res.text());

View file

@ -11,7 +11,7 @@ export default function AppLayout({ children }: { children: ReactNode }) {
<AppQueryProvider>
<div className="md:flex md:min-h-screen">
<AppNav />
<main className="mx-auto w-full max-w-2xl flex-1 px-4 pb-24 pt-6 md:pb-6 md:pt-8">
<main className="mx-auto w-full max-w-2xl flex-1 px-4 pb-24 pt-6 md:max-w-4xl md:px-8 md:pb-10 md:pt-10 lg:max-w-6xl lg:px-12">
{children}
</main>
</div>

View file

@ -73,6 +73,7 @@ export function DashboardView() {
<HideAmountsToggle label={s.hideAmounts} />
</header>
<div className="grid grid-cols-1 gap-[18px] md:grid-cols-2 md:items-start md:gap-5">
{/* Safe-to-spend hero (green): how much is left to spend this month
after committed obligations and what's already been spent. */}
<Link
@ -218,6 +219,7 @@ export function DashboardView() {
))}
</Card>
</div>
</div>
</div>
);
}

View file

@ -14,7 +14,7 @@ export const profileStrings = {
menu: {
settings: "Тохиргоо",
categories: "Ангилал",
subscriptions: "Subscriptions",
subscriptions: "Захиалга",
},
display: {
title: "Дэлгэц ба нууцлал",