import Link from "next/link"; import { prisma } from "@/lib/prisma"; export const dynamic = "force-dynamic"; type HelpCategory = { id: bigint; name: string; content: string; imageUrl: string | null; buttonText: string | null; buttonUrl: string | null; buttonColor: string; buttonBorderColor: string; smallBox: boolean; }; type RuleCategory = { id: bigint; name: string; description: string; badge: string; }; type Rule = { id: bigint; categoryId: bigint | null; paragraph: string; rule: string; }; function isExternal(url: string): boolean { return /^https?:\/\//i.test(url); } export default async function HelpCenterPage() { let categories: HelpCategory[] = []; try { categories = await prisma.websiteHelpCenterCategories.findMany({ orderBy: [{ position: "asc" }, { id: "asc" }], select: { id: true, name: true, content: true, imageUrl: true, buttonText: true, buttonUrl: true, buttonColor: true, buttonBorderColor: true, smallBox: true, }, }); } catch { // DB unavailable — render the shell without help categories. } let ruleCategories: RuleCategory[] = []; try { ruleCategories = await prisma.websiteRuleCategories.findMany({ orderBy: { id: "asc" }, select: { id: true, name: true, description: true, badge: true }, }); } catch { // DB unavailable — render the shell without rule categories. } let rules: Rule[] = []; try { rules = await prisma.websiteRules.findMany({ orderBy: [{ categoryId: "asc" }, { paragraph: "asc" }, { id: "asc" }], select: { id: true, categoryId: true, paragraph: true, rule: true }, }); } catch { // DB unavailable — render the shell without rules. } // Group the rules under their categories. const rulesByCategory = new Map(); for (const r of rules) { const key = r.categoryId === null ? "" : String(r.categoryId); const list = rulesByCategory.get(key); if (list) { list.push(r); } else { rulesByCategory.set(key, [r]); } } return (

Help Center

Find guides, support topics, and the hotel rules — everything you need to get help.

Support topics

{categories.length === 0 ? (

No help topics yet.

) : (
{categories.map((c) => (
{c.imageUrl ? ( // eslint-disable-next-line @next/next/no-img-element ) : null}

{c.name}

{c.content}

{c.buttonUrl && c.buttonText ? (
{isExternal(c.buttonUrl) ? ( {c.buttonText} ) : ( {c.buttonText} )}
) : null}
))}
)}

Hotel rules

{ruleCategories.length === 0 ? (

No rules published yet.

) : (
{ruleCategories.map((cat) => { const catRules = rulesByCategory.get(String(cat.id)) ?? []; return (

{cat.name}

{cat.badge ? {cat.badge} : null}
{cat.description ? (

{cat.description}

) : null} {catRules.length === 0 ? (

No rules in this category.

) : (
    {catRules.map((r) => (
  • {r.paragraph ? ( {r.paragraph} ) : null} {r.rule}
  • ))}
)}
); })}
)}
); }