fix(portal): full-screen overlay + redirect portal-only users

Portal layout: removed conflicting (portal)/layout.tsx that had
duplicate html/body tags. Portal page now uses fixed overlay
(z-[100]) that covers the entire screen including sidebar.

Middleware: portal-only users (dan.tiurbe) are automatically
redirected from any non-portal route to /portal. They can still
access /api/ and /auth/ routes normally.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-25 00:49:44 +02:00
parent e420cd4609
commit f1f4dc097e
3 changed files with 14 additions and 31 deletions
-29
View File
@@ -1,29 +0,0 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "../globals.css";
import { Providers } from "../providers";
const inter = Inter({ subsets: ["latin", "latin-ext"] });
export const metadata: Metadata = {
title: "Portal Tiurbe — ArchiTools",
description: "Portal extern — documente RGI si harta cadastrala",
};
export default function PortalLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="ro" suppressHydrationWarning>
<body className={inter.className}>
<Providers>
<div className="min-h-screen bg-background text-foreground">
{children}
</div>
</Providers>
</body>
</html>
);
}
+1 -1
View File
@@ -1477,7 +1477,7 @@ function HartaContent() {
export default function PortalPage() {
return (
<div className="min-h-screen flex flex-col">
<div className="fixed inset-0 z-[100] bg-background overflow-auto flex flex-col">
{/* Header */}
<Tabs defaultValue="rgi" className="flex-1 flex flex-col gap-0">
<header className="border-b bg-background/95 backdrop-blur-sm px-4 py-2 flex items-center gap-4 shrink-0">
+13 -1
View File
@@ -12,8 +12,20 @@ export async function middleware(request: NextRequest) {
secret: process.env.NEXTAUTH_SECRET,
});
// Authenticated — allow through
// Authenticated — check for portal-only users
if (token) {
const { pathname } = request.nextUrl;
// Portal-only users: redirect to /portal when accessing main app
const portalUsers = ["dan.tiurbe", "tiurbe"];
const tokenEmail = String(token.email ?? "").toLowerCase();
const tokenName = String(token.name ?? "").toLowerCase();
const isPortalUser = portalUsers.some(
(u) => tokenEmail.includes(u) || tokenName.includes(u),
);
if (isPortalUser && !pathname.startsWith("/portal") && !pathname.startsWith("/api/") && !pathname.startsWith("/auth/")) {
const baseUrl = process.env.NEXTAUTH_URL || "https://tools.beletage.ro";
return NextResponse.redirect(new URL("/portal", baseUrl));
}
return NextResponse.next();
}