import { count, desc, eq } from "drizzle-orm"; import { headers } from "next/headers"; import Image from "next/image"; import { getTranslations } from "next-intl/server"; import { AuthTopBar } from "@/components/auth/auth-top-bar"; import { RegisterForm } from "@/components/auth/register-form"; import Link from "@/components/link"; import { Reveal } from "@/components/motion-reveal"; import { UserAvatarThumbnail } from "@/components/shared/user-avatar-thumbnail"; import { SurfaceCard } from "@/components/surface-card"; 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 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 (
{/* Left: intro panel */}
Frank
{tpr("usersOnline", { count: online })}

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

{tpr("subtitle")}

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

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

{/* Right: form */}

{tpr("subtitle")}

); }