import { count, desc, eq } from "drizzle-orm"; import { headers } from "next/headers"; import Image from "next/image"; import Link from "next/link"; import { getTranslations } from "next-intl/server"; import { RegisterForm } from "@/components/auth/register-form"; import { Clock } from "@/components/clock"; import { SectionCard } from "@/components/home-section"; import { LanguageSwitcher } from "@/components/language-switcher"; import { Reveal } from "@/components/motion-reveal"; import { UserAvatarThumbnail } from "@/components/shared/user-avatar-thumbnail"; import { ThemeSwitcher } from "@/components/theme-switcher"; import { cached } from "@/lib/cache"; import { db, User } from "@/lib/db"; import { resolveHotelName } from "@/lib/hotel-name"; import { captchaConfig } from "@/lib/services/captcha"; import { siteSettings } from "@/lib/services/site-settings"; export default async function RegisterPage() { const th = await getTranslations("header"); const tpr = await getTranslations("pages.register"); const [hotelName, cfg, logo] = await Promise.all([ resolveHotelName(), captchaConfig(), siteSettings.get("cms_logo", ""), ]); const nonce = (await headers()).get("x-nonce") ?? undefined; const [online, recentUsers, latestUsers] = await Promise.all([ cached("online_count", 10_000, () => db .select({ total: count() }) .from(User) .where(eq(User.online, "1")) .then((rows) => rows[0]?.total ?? 0), ).catch(() => 0), cached("register_online_users", 10_000, () => db .select({ username: User.username, look: User.look }) .from(User) .where(eq(User.online, "1")) .limit(8), ).catch(() => []), cached("register_latest_users", 30_000, () => db .select({ username: User.username, look: User.look }) .from(User) .orderBy(desc(User.accountCreated)) .limit(8), ).catch(() => []), ]); return (
{/* ── Top Bar ── */}
{logo ? ( {hotelName} ) : ( {hotelName} )} {hotelName}
{/* Left panel */}
Frank
{tpr("usersOnline", { count: online })}

{tpr("title")} — {hotelName}

{th("tagline")}

{recentUsers.length > 0 && (
{recentUsers.map((u) => (
{u.username}
))}
)} {latestUsers.length > 0 && (
{latestUsers.map((u) => (
{u.username}
))}
)}

{tpr("alreadyHaveAccountPre")}{" "} {tpr("alreadyHaveAccountLink")}

{/* Right: form */}

{tpr("subtitle")}

); }