feat: redesign home and register pages with professional Habbo-style layout
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 1m56s

This commit is contained in:
openhands committed 2026-07-22 13:52:23 +02:00
1 parent b0ad3a128e
commit fb0687ec71
2 files changed
+445 -41

No files matched your search

+315 -11
View File
@@ -1,12 +1,316 @@
export default function Home() {
return (
<div className="min-h-screen flex items-center justify-center bg-gray-100 p-4">
<div className="max-w-md w-full bg-white p-8 rounded-lg shadow-lg text-center">
<h1 className="text-2xl font-bold mb-2">Magic Hotel</h1>
<p className="mb-6">0ONLINE</p>
<a href="/login" className="inline-block bg-blue-600 text-white py-2 px-4 rounded hover:bg-blue-700 mr-2">Login</a>
<a href="/register" className="inline-block bg-green-600 text-white py-2 px-4 rounded hover:bg-green-700">Register</a>
</div>
</div>
);
import Image from "next/image";
import Link from "next/link";
import { getTranslations } from "next-intl/server";
import { cached } from "@/lib/cache";
import { formatDate } from "@/lib/format-date";
import { prisma } from "@/lib/prisma";
import { siteSettings } from "@/lib/services/site-settings";
export const revalidate = 120;
async function getHotelData() {
const hotelName = await siteSettings.get("hotel_name", "Hotel");
const [online, users, rooms, articles] = await Promise.all([
cached("online_count", 10_000, () =>
prisma.user.count({ where: { online: "1" } }),
).catch(() => 0),
cached("total_users", 30_000, () => prisma.user.count()).catch(() => 0),
cached("total_rooms", 30_000, () => prisma.rooms.count()).catch(() => 0),
prisma.websiteArticles
.findMany({ orderBy: { createdAt: "desc" }, take: 4 })
.catch(() => []),
]);
return { hotelName, online, users, rooms, articles };
}
export default async function Home() {
const t = await getTranslations("header");
const { hotelName, online, users, rooms, articles } = await getHotelData();
const features = [
{
icon: "🎨",
title: "Express Yourself",
desc: "Create a unique avatar with thousands of clothing and accessory combinations.",
},
{
icon: "🏠",
title: "Design Rooms",
desc: "Build and decorate your own rooms with hundreds of furniture items.",
},
{
icon: "🎮",
title: "Play Games",
desc: "Challenge friends to battles, races, and snowstorm fights.",
},
{
icon: "💬",
title: "Make Friends",
desc: "Chat with people from all over the world in a safe environment.",
},
];
return (
<div className="flex flex-col gap-10 pb-12">
{/* Hero */}
<div
className="relative overflow-hidden rounded-2xl border"
style={{
borderColor:
"color-mix(in srgb, var(--color-primary) 25%, transparent)",
background: `linear-gradient(135deg, color-mix(in srgb, var(--color-primary) 18%, var(--color-surface)), color-mix(in srgb, var(--color-primary) 6%, var(--color-background)))`,
}}
>
<div
className="absolute inset-0 opacity-[0.03]"
style={{
backgroundImage:
"radial-gradient(circle at 25% 50%, var(--color-primary) 0%, transparent 50%)",
}}
/>
<div className="relative flex flex-col md:flex-row items-center gap-8 px-6 py-10 md:px-12 md:py-14">
<div className="flex-1 text-center md:text-left">
<h1
className="text-4xl md:text-5xl lg:text-6xl font-extrabold leading-tight tracking-tight mb-4"
style={{
color: "var(--color-text-readable)",
textShadow: "0 2px 4px rgba(0,0,0,0.06)",
}}
>
Welcome to{" "}
<span
style={{
color: "var(--color-primary-readable, var(--color-primary))",
}}
>
{hotelName}
</span>
</h1>
<p
className="text-lg md:text-xl max-w-xl mb-8"
style={{
color:
"var(--color-text-muted-readable, var(--color-text-muted))",
lineHeight: 1.6,
}}
>
{t("tagline")}
</p>
<div className="flex flex-wrap gap-4 justify-center md:justify-start">
<Link
href="/client"
className="btn btn-primary text-base px-8 py-3 gap-2"
>
▶ Play Now
</Link>
<Link
href="/register"
className="btn btn-secondary text-base px-8 py-3 gap-2"
>
✨ Create Account
</Link>
</div>
</div>
<div className="shrink-0 relative w-48 h-56 md:w-56 md:h-64">
<Image
src="/assets/images/FrankwithBag.gif"
alt="Frank"
fill
className="object-contain object-bottom drop-shadow-2xl"
unoptimized
priority
/>
<div
className="absolute -top-3 right-0 md:-right-8 bg-white dark:bg-gray-800 rounded-2xl px-5 py-3 shadow-lg border max-w-[200px]"
style={{
borderColor:
"color-mix(in srgb, var(--color-primary) 30%, transparent)",
}}
>
<p
className="text-sm font-bold whitespace-nowrap"
style={{ color: "var(--color-text-readable)" }}
>
Welcome to {hotelName}! 🎉
</p>
<p
className="text-xs mt-0.5"
style={{
color:
"var(--color-text-muted-readable, var(--color-text-muted))",
}}
>
Create your account now!
</p>
</div>
</div>
</div>
</div>
{/* Stats */}
<div className="stat-grid">
<div className="stat-block">
<div className="stat-block-value">{online.toLocaleString()}</div>
<div className="stat-block-label">Online Now</div>
</div>
<div className="stat-block">
<div className="stat-block-value">{users.toLocaleString()}</div>
<div className="stat-block-label">Total Users</div>
</div>
<div className="stat-block">
<div className="stat-block-value">{rooms.toLocaleString()}</div>
<div className="stat-block-label">Rooms Created</div>
</div>
<div className="stat-block">
<div className="stat-block-value">🎮</div>
<div className="stat-block-label">Games & More</div>
</div>
</div>
{/* Features */}
<div className="card-grid sm-2 lg-4">
{features.map((f) => (
<div
key={f.title}
className="card text-center"
style={{ padding: "2rem 1.25rem" }}
>
<div className="text-4xl mb-4">{f.icon}</div>
<h3
className="text-lg font-extrabold mb-2"
style={{ color: "var(--color-text-readable)" }}
>
{f.title}
</h3>
<p
className="text-sm leading-relaxed"
style={{
color:
"var(--color-text-muted-readable, var(--color-text-muted))",
}}
>
{f.desc}
</p>
</div>
))}
</div>
{/* News */}
{articles.length > 0 && (
<div>
<div className="flex items-center justify-between mb-4">
<h2 className="text-2xl font-extrabold m-0">Latest News</h2>
<Link href="/news" className="text-sm font-bold hover:underline">
View all →
</Link>
</div>
<div className="card-grid sm-2 lg-4">
{articles.map((a) => (
<Link
key={a.slug}
href={`/news/${a.slug}`}
className="card hover"
style={{
display: "flex",
flexDirection: "column",
textDecoration: "none",
padding: 0,
overflow: "hidden",
}}
>
{a.image ? (
<div
style={{
position: "relative",
width: "100%",
aspectRatio: "16/9",
}}
>
<Image
src={a.image}
alt=""
fill
style={{ objectFit: "cover" }}
unoptimized
/>
</div>
) : (
<div
style={{
width: "100%",
aspectRatio: "16/9",
background:
"color-mix(in srgb, var(--color-primary) 10%, var(--color-navbar))",
}}
/>
)}
<div
style={{
padding: "1rem 1.1rem",
flex: 1,
display: "flex",
flexDirection: "column",
}}
>
<h3
style={{
margin: 0,
fontSize: "1rem",
fontWeight: 700,
lineHeight: 1.4,
color: "var(--color-text-readable)",
}}
>
{a.title}
</h3>
<p
className="muted"
style={{ margin: "0.35rem 0 0", fontSize: "0.78rem" }}
>
{formatDate(a.createdAt, "date", "")}
</p>
</div>
</Link>
))}
</div>
</div>
)}
{/* CTA */}
<div
className="rounded-2xl border text-center px-6 py-10"
style={{
borderColor:
"color-mix(in srgb, var(--color-primary) 25%, transparent)",
background: `linear-gradient(135deg, color-mix(in srgb, var(--color-primary) 12%, var(--color-surface)), color-mix(in srgb, var(--color-primary) 4%, var(--color-background)))`,
}}
>
<h2
className="text-3xl font-extrabold mb-3"
style={{ color: "var(--color-text-readable)" }}
>
Ready to join {hotelName}?
</h2>
<p
className="text-base mb-6 max-w-lg mx-auto"
style={{
color: "var(--color-text-muted-readable, var(--color-text-muted))",
}}
>
Create your free account and start your adventure today!
</p>
<div className="flex flex-wrap gap-4 justify-center">
<Link
href="/register"
className="btn btn-primary text-base px-10 py-3"
>
✨ Create Free Account
</Link>
<Link href="/client" className="btn btn-outline text-base px-10 py-3">
▶ Play as Guest
</Link>
</div>
</div>
</div>
);
}
+130 -30
View File
@@ -1,31 +1,131 @@
export default function Register() {
return (
<div className="min-h-screen flex items-center justify-center bg-gray-100 p-4">
<div className="max-w-md w-full bg-white p-8 rounded-lg shadow-lg text-center">
<h1 className="text-2xl font-bold mb-4">Konto erstellen</h1>
<form className="space-y-4 mb-8">
<div>
<label className="block text-sm font-medium">Benutzername</label>
<input type="text" name="username" className="mt-1 w-full px-3 py-2 border rounded focus:ring-blue-500" />
</div>
<div>
<label className="block text-sm font-medium">E&#8209;Mail</label>
<input type="email" name="email" className="mt-1 w-full px-3 py-2 border rounded focus:ring-blue-500" />
</div>
<div>
<label className="block text-sm font-medium">Passwoord</label>
<input type="password" name="password" className="mt-1 w-full px-3 py-2 border rounded focus:ring-blue-500" />
</div>
<div>
<label className="block text-sm font-medium">Passwoord opnieuw</label>
<input type="password" name="confirmPassword" className="mt-1 w-full px-3 py-2 border rounded focus:ring-blue-500" />
</div>
</form>
<button type="submit" className="w-full bg-green-600 text-white py-2 rounded hover:bg-green-700">Konto erstellen</button>
<p className="mt-4">
<a href="/" className="text-blue-600 hover:underline">Al een account? Inloggen</a>
</p>
</div>
</div>
);
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 { cached } from "@/lib/cache";
import { prisma } from "@/lib/prisma";
import { captchaConfig } from "@/lib/services/captcha";
import { siteSettings } from "@/lib/services/site-settings";
export default async function RegisterPage() {
const t = await getTranslations("header");
const [hotelName, cfg] = await Promise.all([
siteSettings.get("hotel_name", "Hotel"),
captchaConfig(),
]);
const nonce = (await headers()).get("x-nonce") ?? undefined;
const online = await cached("online_count", 10_000, () =>
prisma.user.count({ where: { online: "1" } }),
).catch(() => 0);
return (
<div className="flex flex-col md:flex-row gap-8 items-start">
{/* Left: Info / Welcome */}
<div className="flex-1 w-full md:sticky md:top-24 space-y-6">
<div
className="relative overflow-hidden rounded-2xl border p-6"
style={{
borderColor:
"color-mix(in srgb, var(--color-primary) 25%, transparent)",
background: `linear-gradient(135deg, color-mix(in srgb, var(--color-primary) 15%, var(--color-surface)), color-mix(in srgb, var(--color-primary) 5%, var(--color-background)))`,
}}
>
<div className="relative flex flex-col items-center text-center gap-4">
<div className="relative w-36 h-40">
<Image
src="/assets/images/FrankwithBag.gif"
alt="Frank"
fill
className="object-contain object-bottom drop-shadow-xl"
unoptimized
priority
/>
</div>
<div>
<h1 className="text-3xl font-extrabold m-0">
Join{" "}
<span
style={{
color:
"var(--color-primary-readable, var(--color-primary))",
}}
>
{hotelName}
</span>
</h1>
<p
className="mt-2 text-base max-w-md"
style={{
color:
"var(--color-text-muted-readable, var(--color-text-muted))",
}}
>
{t("tagline")}
</p>
</div>
<div
className="stat-grid w-full max-w-xs"
style={{ gridTemplateColumns: "1fr 1fr" }}
>
<div className="stat-block" style={{ padding: "0.6rem" }}>
<div className="stat-block-value">
{online.toLocaleString()}
</div>
<div className="stat-block-label">Online</div>
</div>
<div className="stat-block" style={{ padding: "0.6rem" }}>
<div className="stat-block-value">🎉</div>
<div className="stat-block-label">Free to Play</div>
</div>
</div>
</div>
</div>
<div className="card space-y-3" style={{ padding: "1.25rem" }}>
{[
{ icon: "🎨", text: "Customize your avatar with unique looks" },
{ icon: "🏠", text: "Build and design your own rooms" },
{ icon: "💬", text: "Chat and make new friends" },
{ icon: "🎮", text: "Play games and compete" },
].map((item) => (
<div
key={item.text}
className="flex items-center gap-3 text-sm font-semibold"
>
<span className="text-xl">{item.icon}</span>
<span style={{ color: "var(--color-text-readable)" }}>
{item.text}
</span>
</div>
))}
</div>
<p
className="text-sm text-center"
style={{
color: "var(--color-text-muted-readable, var(--color-text-muted))",
}}
>
Already have an account?{" "}
<Link href="/login" className="font-bold hover:underline">
Sign in here
</Link>
</p>
</div>
{/* Right: Register Form */}
<div className="w-full md:w-[500px] shrink-0">
<RegisterForm
hotelName={hotelName ?? "Hotel"}
captcha={{
provider: cfg.provider,
siteKey: cfg.siteKey || undefined,
}}
nonce={nonce}
/>
</div>
</div>
);
}