diff --git a/src/app/(frontend)/layout.tsx b/src/app/(frontend)/layout.tsx index 3de9b9a..20f6ad8 100644 --- a/src/app/(frontend)/layout.tsx +++ b/src/app/(frontend)/layout.tsx @@ -19,6 +19,7 @@ import { CommandPalette } from "@/components/command-palette/CommandPalette"; import { CommandPaletteProvider } from "@/components/command-palette/CommandPaletteContext"; import { KeyboardShortcutsProvider } from "@/components/command-palette/KeyboardShortcutsProvider"; import { isSuperuser } from "@/utils/access-control/hasPermission"; +import { Rank } from "@/payload-types"; // Skip static prerendering of this layout (and all pages under (frontend)/). // The layout calls `getPayload()` at render time to resolve the current user, @@ -58,6 +59,7 @@ export default async function RootLayout(props: { children: React.ReactNode }) { let isIntelligence = false; let isLogistics = false; + let currentRank = ""; if (user) { [isIntelligence, isLogistics] = await Promise.all([ @@ -69,6 +71,7 @@ export default async function RootLayout(props: { children: React.ReactNode }) { collection: "profiles", where: { user: { equals: user.id } }, select: { + rank: true, progression: { awards: true, scoreboard: true, @@ -90,6 +93,8 @@ export default async function RootLayout(props: { children: React.ReactNode }) { const userXp = profileRes.docs[0]?.progression?.xp ?? 0; xpLevel = resolveLevel(userXp, experienceRes.docs); + + currentRank = (profileRes.docs[0]?.rank as Rank).abbreviation; } return ( @@ -107,6 +112,7 @@ export default async function RootLayout(props: { children: React.ReactNode }) { user={{ displayName: user.payloadDisplayName ?? "Guest", username: user.username ?? "Not logged in", + rank: currentRank, }} xpLevel={xpLevel} adminUrl={payloadConfig.routes.admin} diff --git a/src/app/(frontend)/page.tsx b/src/app/(frontend)/page.tsx index a8d7235..ef8faee 100644 --- a/src/app/(frontend)/page.tsx +++ b/src/app/(frontend)/page.tsx @@ -205,7 +205,7 @@ export default async function HomePage() {
Here's your operations dashboard.