Refine the public UI for a cleaner, more professional and scannable landing experience without leaving the classic Habbo style: - SurfaceCard: softer layered shadow, gradient accent hairline on the top edge and a bolder header title across all public cards. - Home: gradient hotel-name in the hero headline, shine effect on the primary CTA, hairline on the top bar. - Login/register: consistent avatar tiles with rounded corners, subtle borders and a gentle hover lift; uniform username sizing. - Add reusable theme-aware .card-hairline and .gradient-text utilities.
246 lines
7.5 KiB
TypeScript
246 lines
7.5 KiB
TypeScript
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 (
|
|
<div className="mx-auto w-full max-w-6xl flex flex-col gap-8 pb-16">
|
|
<AuthTopBar hotelName={hotelName} logo={logo} />
|
|
|
|
<Reveal>
|
|
<div className="flex flex-col gap-8 lg:flex-row lg:items-start">
|
|
{/* Left: intro panel */}
|
|
<div className="lg:w-96 shrink-0 space-y-4">
|
|
<SurfaceCard
|
|
className="card-glow relative overflow-hidden p-6"
|
|
style={{
|
|
borderColor:
|
|
"color-mix(in srgb, var(--color-primary) 20%, transparent)",
|
|
}}
|
|
>
|
|
<div
|
|
className="absolute inset-0"
|
|
style={{
|
|
background: `url(/assets/images/background.png) center/cover no-repeat`,
|
|
}}
|
|
/>
|
|
<div
|
|
className="absolute inset-0"
|
|
style={{
|
|
background:
|
|
"linear-gradient(135deg, color-mix(in srgb, var(--color-surface) 88%, transparent) 0%, color-mix(in srgb, var(--color-surface) 35%, transparent) 100%)",
|
|
}}
|
|
/>
|
|
<div className="relative">
|
|
<div className="flex items-center gap-4">
|
|
<div className="shrink-0 animate-float">
|
|
<div className="brand-halo left-1/2 top-1/2 h-52 w-52 -translate-x-1/2 -translate-y-1/2" />
|
|
<Image
|
|
src="/assets/images/FrankwithBag.gif"
|
|
alt="Frank"
|
|
width={110}
|
|
height={145}
|
|
className="relative object-contain drop-shadow-xl"
|
|
unoptimized
|
|
priority
|
|
/>
|
|
</div>
|
|
<div className="flex-1">
|
|
<div
|
|
className="inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold uppercase tracking-wider mb-2 border"
|
|
style={{
|
|
borderColor:
|
|
"color-mix(in srgb, var(--color-primary) 18%, transparent)",
|
|
background:
|
|
"color-mix(in srgb, var(--color-primary) 10%, transparent)",
|
|
color:
|
|
"var(--color-primary-readable, var(--color-primary))",
|
|
}}
|
|
>
|
|
<span className="w-2 h-2 rounded-full bg-primary" />
|
|
{tpr("usersOnline", { count: online })}
|
|
</div>
|
|
<h1
|
|
className="text-lg font-black leading-tight"
|
|
style={{
|
|
color: "var(--color-text-readable)",
|
|
fontFamily: "var(--font-nunito)",
|
|
}}
|
|
>
|
|
{tpr("title")} — {hotelName}
|
|
</h1>
|
|
<p
|
|
className="text-xs mt-1.5 leading-relaxed"
|
|
style={{ color: "var(--color-text-muted)" }}
|
|
>
|
|
{tpr("subtitle")}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</SurfaceCard>
|
|
|
|
{recentUsers.length > 0 && (
|
|
<SurfaceCard
|
|
title={tpr("whoIsOnline")}
|
|
icon="/assets/images/icons/navigation/goody.png"
|
|
bodyClassName="p-4"
|
|
className="card-glow"
|
|
>
|
|
<div className="grid grid-cols-4 gap-1.5">
|
|
{recentUsers.map((u) => (
|
|
<div
|
|
key={u.username}
|
|
className="flex flex-col items-center gap-1.5 rounded-xl border px-1 py-2 transition-all duration-200 hover:-translate-y-0.5"
|
|
style={{
|
|
background:
|
|
"color-mix(in srgb, var(--color-primary) 4%, transparent)",
|
|
borderColor:
|
|
"color-mix(in srgb, var(--color-primary) 10%, transparent)",
|
|
}}
|
|
>
|
|
<UserAvatarThumbnail
|
|
figure={u.look}
|
|
alt=""
|
|
options={{ direction: 2 }}
|
|
className="rounded-lg"
|
|
/>
|
|
<span
|
|
className="w-full truncate text-center text-[9px] font-bold leading-tight"
|
|
style={{ color: "var(--color-text-readable)" }}
|
|
>
|
|
{u.username}
|
|
</span>
|
|
</div>
|
|
))}
|
|
</div>
|
|
</SurfaceCard>
|
|
)}
|
|
|
|
{latestUsers.length > 0 && (
|
|
<SurfaceCard
|
|
title="Newest citizens"
|
|
icon="/assets/images/icons/friends.png"
|
|
bodyClassName="p-4"
|
|
className="card-glow"
|
|
>
|
|
<div className="grid grid-cols-4 gap-1.5">
|
|
{latestUsers.map((u) => (
|
|
<div
|
|
key={u.username}
|
|
className="flex flex-col items-center gap-1.5 rounded-xl border px-1 py-2 transition-all duration-200 hover:-translate-y-0.5"
|
|
style={{
|
|
background:
|
|
"color-mix(in srgb, var(--color-primary) 4%, transparent)",
|
|
borderColor:
|
|
"color-mix(in srgb, var(--color-primary) 10%, transparent)",
|
|
}}
|
|
>
|
|
<UserAvatarThumbnail
|
|
figure={u.look}
|
|
alt=""
|
|
options={{ direction: 2 }}
|
|
className="rounded-lg"
|
|
/>
|
|
<span
|
|
className="w-full truncate text-center text-[9px] font-bold leading-tight"
|
|
style={{ color: "var(--color-text-readable)" }}
|
|
>
|
|
{u.username}
|
|
</span>
|
|
</div>
|
|
))}
|
|
</div>
|
|
</SurfaceCard>
|
|
)}
|
|
|
|
<p
|
|
className="text-sm text-center"
|
|
style={{ color: "var(--color-text-muted)" }}
|
|
>
|
|
{tpr("alreadyHaveAccountPre")}{" "}
|
|
<Link
|
|
href="/login"
|
|
className="font-extrabold hover:underline"
|
|
style={{
|
|
color: "var(--color-primary-readable, var(--color-primary))",
|
|
}}
|
|
>
|
|
{tpr("alreadyHaveAccountLink")}
|
|
</Link>
|
|
</p>
|
|
</div>
|
|
|
|
{/* Right: form */}
|
|
<div className="flex-1 lg:sticky lg:top-6">
|
|
<SurfaceCard
|
|
title={tpr("title")}
|
|
icon="/assets/images/icons/navigation/me.png"
|
|
bodyClassName="p-6"
|
|
>
|
|
<p
|
|
className="text-sm mb-6"
|
|
style={{ color: "var(--color-text-muted)" }}
|
|
>
|
|
{tpr("subtitle")}
|
|
</p>
|
|
<RegisterForm
|
|
hotelName={hotelName}
|
|
captcha={{
|
|
provider: cfg.provider,
|
|
siteKey: cfg.siteKey || undefined,
|
|
}}
|
|
nonce={nonce}
|
|
/>
|
|
</SurfaceCard>
|
|
</div>
|
|
</div>
|
|
</Reveal>
|
|
</div>
|
|
);
|
|
}
|