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 { LoginForm } from "@/components/auth/login-form"; 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"; import { ICON_FRIENDS, ICON_NAV_GOODY, ICON_NAV_ME } from "@/lib/site-icons"; export default async function LoginPage() { const t = await getTranslations("pages.login"); 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), 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 (
{/* Left panel */}
); }