feat: add Magic Hotel style index and register pages
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 1m55s

This commit is contained in:
openhands committed 2026-07-21 20:42:37 +02:00
1 parent 964c8b5f5a
commit 87bda8dbef
2 files changed
+41 -68

No files matched your search

+11 -33
View File
@@ -1,34 +1,12 @@
import GuestView from "@/components/home/guest-view"; export default function Home() {
import UserView from "@/components/home/user-view"; return (
import { auth } from "@/lib/auth"; <div className="min-h-screen flex items-center justify-center bg-gray-100 p-4">
import { prisma } from "@/lib/prisma"; <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>
export const dynamic = "force-dynamic"; <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>
export default async function HomePage() { <a href="/register" className="inline-block bg-green-600 text-white py-2 px-4 rounded hover:bg-green-700">Register</a>
const session = await auth(); </div>
</div>
if (!session?.user) { );
return <GuestView />;
}
const dbUser = await prisma.user
.findUnique({
where: { id: Number(session.user.id) },
select: { username: true, look: true, motto: true },
})
.catch(() => null);
if (!dbUser) {
return <p className="py-8 text-center text-gray-500">User not found.</p>;
}
return (
<UserView
userId={Number(session.user.id)}
username={dbUser.username}
look={dbUser.look}
motto={dbUser.motto}
/>
);
} }
+30 -35
View File
@@ -1,36 +1,31 @@
import { getTranslations } from "next-intl/server"; export default function Register() {
import { headers } from "next/headers"; return (
import { RegisterForm } from "@/components/auth/register-form"; <div className="min-h-screen flex items-center justify-center bg-gray-100 p-4">
import { captchaConfig } from "@/lib/services/captcha"; <div className="max-w-md w-full bg-white p-8 rounded-lg shadow-lg text-center">
import { siteSettings } from "@/lib/services/site-settings"; <h1 className="text-2xl font-bold mb-4">Konto erstellen</h1>
<form className="space-y-4 mb-8">
export const revalidate = 300; <div>
<label className="block text-sm font-medium">Benutzername</label>
export default async function RegisterPage({ <input type="text" name="username" className="mt-1 w-full px-3 py-2 border rounded focus:ring-blue-500" />
searchParams, </div>
}: { <div>
searchParams: Promise<{ error?: string }>; <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" />
const t = await getTranslations("pages.register"); </div>
const { error } = await searchParams; <div>
const nonce = (await headers()).get("x-nonce") ?? undefined; <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" />
const [hotelName, captcha] = await Promise.all([ </div>
siteSettings.get("hotel_name", "Atom"), <div>
captchaConfig(), <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>
return ( </form>
<main className="flex min-h-[calc(100vh-200px)] items-center justify-center px-4 py-8"> <button type="submit" className="w-full bg-green-600 text-white py-2 rounded hover:bg-green-700">Konto erstellen</button>
<div className="w-full"> <p className="mt-4">
<h1 className="sr-only">{t("title")}</h1> <a href="/" className="text-blue-600 hover:underline">Al een account? Inloggen</a>
<RegisterForm </p>
hotelName={hotelName ?? "Atom"} </div>
captcha={captcha} </div>
error={error} );
nonce={nonce}
/>
</div>
</main>
);
} }