diff --git a/src/app/(site)/layout.tsx b/src/app/(site)/layout.tsx index bb7d38bb22..5bbfe044a1 100644 --- a/src/app/(site)/layout.tsx +++ b/src/app/(site)/layout.tsx @@ -3,7 +3,6 @@ import MotionPageWrapper from "@/components/motion-page-wrapper"; import { Navigation } from "@/components/navigation"; import RadioPlayerGate from "@/components/public/radio-player-gate"; import { SiteFooter } from "@/components/site-footer"; -import { SiteHeader } from "@/components/site-header"; import { TopHeader } from "@/components/top-header"; import { auth } from "@/lib/auth"; @@ -19,7 +18,6 @@ export default async function SiteLayout({ children }: { children: ReactNode }) {session?.user?.id ? ( <> - ) : null} diff --git a/src/components/top-header.tsx b/src/components/top-header.tsx index 57efb981f9..5e71f1a7ad 100644 --- a/src/components/top-header.tsx +++ b/src/components/top-header.tsx @@ -1,10 +1,13 @@ import Image from "next/image"; import Link from "next/link"; import type { Session } from "next-auth"; +import { getTranslations } from "next-intl/server"; import { signOut } from "@/lib/auth"; import { avatarImageUrl } from "@/lib/format"; +import { cached } from "@/lib/cache"; import { canAccess, getApiAdminContext, PERMS } from "@/lib/permissions"; import { prisma } from "@/lib/prisma"; +import { resolveHotelName } from "@/lib/hotel-name"; import { siteSettings } from "@/lib/services/site-settings"; function Currency({ @@ -93,10 +96,59 @@ export async function TopHeader({ session }: { session: Session | null }) { const textColor = "var(--color-navbar-text-readable, var(--color-navbar-text, var(--color-text)))"; + const t = await getTranslations("header"); + const hotelName = await resolveHotelName(); + + let online: number; + try { + online = await cached("online_count", 10_000, () => + prisma.user.count({ where: { online: "1" } }), + ); + } catch { + online = 0; + } + return (
-
+
+
+ + + + + + {t("online", { count: online, hotel: hotelName })} + +
+ + + Enter +