diff --git a/src/app/(site)/page.tsx b/src/app/(site)/page.tsx index 38055447..1a44d7b0 100644 --- a/src/app/(site)/page.tsx +++ b/src/app/(site)/page.tsx @@ -1,12 +1,316 @@ -export default function Home() { - return ( -
- ); +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 ( ++ {t("tagline")} +
++ Welcome to {hotelName}! 🎉 +
++ Create your account now! +
++ {f.desc} +
++ {formatDate(a.createdAt, "date", "")} +
++ Create your free account and start your adventure today! +
++ {t("tagline")} +
++ Already have an account?{" "} + + Sign in here + +
+