import Image from "next/image"; import Link from "next/link"; import { redirect } from "next/navigation"; import { getTranslations } from "next-intl/server"; import { updateMotto } from "@/actions/user-settings"; import { Reveal } from "@/components/motion-reveal"; import { auth } from "@/lib/auth"; import { avatarImageUrl } from "@/lib/format"; import { prisma } from "@/lib/prisma"; import { siteSettings } from "@/lib/services/site-settings"; export const dynamic = "force-dynamic"; export default async function SettingsPage() { const t = await getTranslations("pages.settings"); const session = await auth(); if (!session?.user?.id) redirect("/login"); const id = Number(session.user.id); let user: { username: string; motto: string; look: string; mail: string | null; } | null = null; try { user = await prisma.user.findUnique({ where: { id }, select: { username: true, motto: true, look: true, mail: true }, }); } catch { user = null; } if (!user) redirect("/login"); let imagerBase = "https://www.habbo.com/habbo-imaging/avatarimage"; try { imagerBase = (await siteSettings.get("habbo_imaging_url", imagerBase)) ?? imagerBase; } catch { /* fall back to default */ } const avatar = avatarImageUrl(imagerBase, user.look, { size: "l" }); return (
{t("accountSettingsSubtitle")}
{user.motto || ( {t("noMotto")} )}
{user.mail || t("noEmail")}
{t("changeMottoSubtitle")}
{t("securityDescription")}
{t("twoFactorLink")}View active sessions and sign out everywhere