refactor: centralize hotel name fallback via FALLBACK_HOTEL_NAME
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 2m6s

Route all user-facing Atom hotel defaults through resolveHotelName (settings then HOTEL_NAME env then brand constant). Exclude Playwright e2e from tsconfig until deps are installed.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-22 18:45:59 +02:00
1 parent 6b2819aa20
commit e00e9ca2dc
31 files changed
+113 -56

No files matched your search

+2 -2
View File
@@ -5,7 +5,7 @@ import { applyStaff } from "@/actions/applications";
import { ContentCard, EmptyState } from "@/components/public/ui";
import { auth } from "@/lib/auth";
import { prisma } from "@/lib/prisma";
import { siteSettings } from "@/lib/services/site-settings";
import { resolveHotelName } from "@/lib/hotel-name";
export const dynamic = "force-dynamic";
@@ -53,7 +53,7 @@ export default async function ApplyStaffPage({
: null;
const userId = Number(session.user.id);
const hotelName = (await siteSettings.get("hotel_name", "Atom")) ?? "Atom";
const hotelName = await resolveHotelName();
function formatDeadline(d: Date | null | undefined): string {
if (!d) return t("noDeadline");
+2 -2
View File
@@ -5,7 +5,7 @@ import { applyTeam } from "@/actions/applications";
import { ContentCard, EmptyState } from "@/components/public/ui";
import { auth } from "@/lib/auth";
import { prisma } from "@/lib/prisma";
import { siteSettings } from "@/lib/services/site-settings";
import { resolveHotelName } from "@/lib/hotel-name";
export const dynamic = "force-dynamic";
@@ -53,7 +53,7 @@ export default async function ApplyTeamPage({
: null;
const userId = Number(session.user.id);
const hotelName = (await siteSettings.get("hotel_name", "Atom")) ?? "Atom";
const hotelName = await resolveHotelName();
// ── Teams open for application ──────────────────────────────
// The Prisma slice exposes teams directly (no separate team-position table
+2 -2
View File
@@ -5,7 +5,7 @@ import { ContentCard } from "@/components/public/ui";
import { prisma } from "@/lib/prisma";
import { sanitize } from "@/lib/sanitize";
import { SanitizedHtml } from "@/components/shared/sanitized-html";
import { siteSettings } from "@/lib/services/site-settings";
import { resolveHotelName } from "@/lib/hotel-name";
export const revalidate = 300;
@@ -75,7 +75,7 @@ export default async function HelpCategoryPage({
if (!cat) notFound();
const hotelName = (await siteSettings.get("hotel_name", "Atom")) ?? "Atom";
const hotelName = await resolveHotelName();
// Sibling help topics, so the reader can jump between categories. Isolated
// query: a DB hiccup degrades this list to empty rather than 500-ing.
+3 -2
View File
@@ -7,13 +7,14 @@ import { cached } from "@/lib/cache";
import { avatarImageUrl } from "@/lib/format";
import { prisma } from "@/lib/prisma";
import { captchaConfig } from "@/lib/services/captcha";
import { resolveHotelName } from "@/lib/hotel-name";
import { siteSettings } from "@/lib/services/site-settings";
export default async function LoginPage() {
const t = await getTranslations("pages.login");
const th = await getTranslations("header");
const [hotelName, imagerRaw, cfg] = await Promise.all([
siteSettings.get("hotel_name", "Atom"),
resolveHotelName(),
siteSettings.get(
"habbo_imaging_url",
"https://www.habbo.com/habbo-imaging/avatarimage",
@@ -87,7 +88,7 @@ export default async function LoginPage() {
className="text-xs mt-1 mx-auto max-w-[200px] leading-relaxed"
style={{ color: "var(--color-text-muted)" }}
>
{t("welcomeBackSub", { hotelName: hotelName ?? "Atom" })}
{t("welcomeBackSub", { hotelName })}
</p>
</div>
</div>
+4 -2
View File
@@ -1,5 +1,6 @@
import LogoGenerator from "@/components/public/logo-generator";
import { ContentCard } from "@/components/public/ui";
import { resolveHotelName } from "@/lib/hotel-name";
export const metadata = { title: "Logo generator" };
@@ -9,7 +10,8 @@ export const metadata = { title: "Logo generator" };
* client-side <LogoGenerator>, which does all styling, live preview, and PNG
* export in the browser (no server data, no DB).
*/
export default function LogoPage() {
export default async function LogoPage() {
const initialText = await resolveHotelName();
return (
<main
style={{
@@ -25,7 +27,7 @@ export default function LogoPage() {
subtitle="Design a logo for your hotel — pick a font, colours and size, then download it as a PNG."
/>
<LogoGenerator />
<LogoGenerator initialText={initialText} />
</main>
);
}
+3 -2
View File
@@ -1,5 +1,6 @@
import { getTranslations } from "next-intl/server";
import { ContentCard } from "@/components/public/ui";
import { resolveHotelName } from "@/lib/hotel-name";
import { siteSettings } from "@/lib/services/site-settings";
export const revalidate = 300;
@@ -7,7 +8,7 @@ export const revalidate = 300;
export default async function MaintenancePage() {
const t = await getTranslations("pages.maintenance");
const [hotel, message] = await Promise.all([
siteSettings.get("hotel_name", "Atom"),
resolveHotelName(),
siteSettings.get(
"maintenance_message",
"We are currently performing maintenance. Please check back soon.",
@@ -18,7 +19,7 @@ export default async function MaintenancePage() {
<main style={{ maxWidth: 560, margin: "2rem auto" }}>
<ContentCard
icon="🛠️"
title={t("title", { hotel: hotel ?? "Atom" })}
title={t("title", { hotel })}
subtitle={t("subtitle")}
>
<p style={{ marginTop: 0 }}>{message}</p>
+3 -2
View File
@@ -6,6 +6,7 @@ import { claimReferral } from "@/actions/referral";
import { ContentCard, EmptyState, OnlineBadge } from "@/components/public/ui";
import { auth } from "@/lib/auth";
import { avatarImageUrl } from "@/lib/format";
import { resolveHotelName } from "@/lib/hotel-name";
import { prisma } from "@/lib/prisma";
import { siteSettings } from "@/lib/services/site-settings";
import CopyReferralButton from "./CopyReferralButton";
@@ -85,7 +86,7 @@ export default async function MePage({
"habbo_imaging_url",
"https://www.habbo.com/habbo-imaging/avatarimage",
),
siteSettings.get("hotel_name", "Atom"),
resolveHotelName(),
prisma.websiteSetting
.findUnique({
where: { key: "referrals_needed" },
@@ -251,7 +252,7 @@ export default async function MePage({
height={22}
unoptimized
/>
Enter {hotelName ?? "Hotel"}
Enter {hotelName}
</Link>
{/* ── Stat tiles ── */}
+5 -4
View File
@@ -6,6 +6,7 @@ import { cached } from "@/lib/cache";
import { avatarImageUrl } from "@/lib/format";
import { formatDate } from "@/lib/format-date";
import { prisma } from "@/lib/prisma";
import { resolveHotelName } from "@/lib/hotel-name";
import { siteSettings } from "@/lib/services/site-settings";
import { auth } from "@/lib/auth";
@@ -13,7 +14,7 @@ export const revalidate = 120;
async function getHotelData() {
const [hotelName, imagerRaw] = await Promise.all([
siteSettings.get("hotel_name", "Atom"),
resolveHotelName(),
siteSettings.get(
"habbo_imaging_url",
"https://www.habbo.com/habbo-imaging/avatarimage",
@@ -103,13 +104,13 @@ export default async function Home() {
<span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75" />
<span className="relative inline-flex rounded-full h-2 w-2 bg-green-500" />
</span>
{th("online", { count: online, hotel: hotelName ?? "Atom" })}
{th("online", { count: online, hotel: hotelName })}
</div>
<h1
className="text-4xl md:text-5xl lg:text-6xl font-black leading-[1.05] tracking-tight mb-4"
style={{ color: "var(--color-text-readable)" }}
>
{tp("welcome", { hotelName: hotelName ?? "Atom" })}
{tp("welcome", { hotelName })}
</h1>
<p
className="text-base md:text-lg leading-relaxed max-w-xl mb-8"
@@ -317,7 +318,7 @@ export default async function Home() {
}}
>
<h2 className="text-2xl md:text-3xl font-black tracking-tight mb-2" style={{ color: "var(--color-text-readable)" }}>
{tp("joinNow", { hotelName: hotelName ?? "Atom" })}
{tp("joinNow", { hotelName })}
</h2>
<p className="text-sm mb-6 max-w-sm mx-auto" style={{ color: "var(--color-text-muted)" }}>
{tp("welcomeBody")}
+3 -2
View File
@@ -7,13 +7,14 @@ import { cached } from "@/lib/cache";
import { avatarImageUrl } from "@/lib/format";
import { prisma } from "@/lib/prisma";
import { captchaConfig } from "@/lib/services/captcha";
import { resolveHotelName } from "@/lib/hotel-name";
import { siteSettings } from "@/lib/services/site-settings";
export default async function RegisterPage() {
const th = await getTranslations("header");
const tpr = await getTranslations("pages.register");
const [hotelName, imagerRaw, cfg] = await Promise.all([
siteSettings.get("hotel_name", "Hotel"),
resolveHotelName(),
siteSettings.get(
"habbo_imaging_url",
"https://www.habbo.com/habbo-imaging/avatarimage",
@@ -167,7 +168,7 @@ export default async function RegisterPage() {
</p>
</div>
<RegisterForm
hotelName={hotelName ?? "Hotel"}
hotelName={hotelName}
captcha={{
provider: cfg.provider,
siteKey: cfg.siteKey || undefined,
+2 -2
View File
@@ -12,7 +12,7 @@ import { auth } from "@/lib/auth";
import { LaravelEncrypter } from "@/lib/auth/laravel-encrypter";
import { totpKeyUri } from "@/lib/auth/totp";
import { prisma } from "@/lib/prisma";
import { siteSettings } from "@/lib/services/site-settings";
import { resolveHotelName } from "@/lib/hotel-name";
export const dynamic = "force-dynamic";
@@ -52,7 +52,7 @@ export default async function TwoFactorPage({
const hasAppKey = Boolean(env.APP_KEY);
const enabled = Boolean(user?.twoFactorConfirmedAt);
const pending = Boolean(user?.twoFactorSecret && !user?.twoFactorConfirmedAt);
const hotelName = (await siteSettings.get("hotel_name", "Atom")) ?? "Atom";
const hotelName = await resolveHotelName();
let secret = "";
let uri = "";