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 { LanguageSwitcher } from "@/components/language-switcher"; import { Reveal } from "@/components/motion-reveal"; import { ThemeSwitcher } from "@/components/theme-switcher"; import { cached } from "@/lib/cache"; import { db, User } from "@/lib/db"; import { avatarImageUrl } from "@/lib/format"; import { resolveHotelName } from "@/lib/hotel-name"; import { captchaConfig } from "@/lib/services/captcha"; import { siteSettings } from "@/lib/services/site-settings"; // TODO: Cache Components adoption. Refactor this route so this opt-out can be removed. // See: https://nextjs.org/docs/app/guides/migrating-to-cache-components export const instant = false; export default async function RegisterPage() { const th = await getTranslations("header"); const tpr = await getTranslations("pages.register"); const [hotelName, imagerRaw, cfg, logo] = await Promise.all([ resolveHotelName(), siteSettings.get( "habbo_imaging_url", "https://www.habbo.com/habbo-imaging/avatarimage", ), captchaConfig(), siteSettings.get("radio_social_discord", ""), siteSettings.get("cms_logo", ""), ]); const imager = imagerRaw ?? "https://www.habbo.com/habbo-imaging/avatarimage"; 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), db .select({ username: User.username, look: User.look }) .from(User) .where(eq(User.online, "1")) .limit(8) .catch(() => []), db .select({ username: User.username, look: User.look }) .from(User) .orderBy(desc(User.accountCreated)) .limit(8) .catch(() => []), ]); return (
{th("tagline")}
{tpr("alreadyHaveAccountPre")}{" "} {tpr("alreadyHaveAccountLink")}
{tpr("subtitle")}