diff --git a/platform/src/app/me/ai-usage/page.tsx b/platform/src/app/me/ai-usage/page.tsx index 0cccd06..6b4d606 100644 --- a/platform/src/app/me/ai-usage/page.tsx +++ b/platform/src/app/me/ai-usage/page.tsx @@ -54,7 +54,7 @@ export default async function PersonalAIUsagePage({ }); return ( -
diff --git a/platform/src/app/me/layout.tsx b/platform/src/app/me/layout.tsx
new file mode 100644
index 0000000..ac0f263
--- /dev/null
+++ b/platform/src/app/me/layout.tsx
@@ -0,0 +1,46 @@
+import type { ReactNode } from "react";
+
+import { redirect } from "next/navigation";
+
+import { getServerSession } from "next-auth/next";
+
+import { TenantNavbar } from "@/components/tenant/TenantNavbar";
+import { TenantProvider } from "@/components/tenant/TenantProvider";
+import { authOptions } from "@/lib/auth";
+
+type SessionOrganization = {
+ slug: string;
+ role?: string | null;
+};
+
+type SessionUser = {
+ organizations?: SessionOrganization[];
+};
+
+// Routes under /me are authenticated but cross-organization (self-only), so
+// they live outside /[tenant] and never get the tenant layout. Without this
+// layout the root ConditionalNavbar fell back to the public/visitor navbar,
+// making an authenticated page look logged out (issue #71). Render the
+// authenticated TenantNavbar here, scoped to the user's primary org for its
+// links and org switcher.
+export default async function MeLayout({ children }: { children: ReactNode }) {
+ const session = await getServerSession(authOptions);
+ if (!session) {
+ redirect("/auth/signin?callbackUrl=/me/ai-usage");
+ }
+
+ const sessionUser = session.user as SessionUser | undefined;
+ const primaryOrg = sessionUser?.organizations?.[0];
+
+ return (
+