import Link from "next/link"; import { redirect } from "next/navigation"; import { getTranslations } from "next-intl/server"; import { updateMotto } from "@/actions/user-settings"; import { ContentCard } from "@/components/public/ui"; 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 the default imager base } const avatar = avatarImageUrl(imagerBase, user.look, { size: "l" }); return (
{/* eslint-disable-next-line @next/next/no-img-element */} {`${user.username}

{user.motto || {t("noMotto")}}

{user.mail || t("noEmail")}

{t("securityDescription")}

{t("twoFactorLink")}

{t("connectionsDescription")}

{t("manageConnections")}
); }