From b592358db05d4fe09dc733b4cb9d6b816e62c4e2 Mon Sep 17 00:00:00 2001 From: Hardik Date: Fri, 19 Jun 2026 11:56:34 +0530 Subject: [PATCH] feat(app): env-gated banner (EnvBanner) for non-prod environments Renders a thin fixed banner only when NEXT_PUBLIC_ENV_LABEL is set; production leaves it unset so nothing shows. Used to mark the staging instance. Co-Authored-By: Claude Opus 4.8 --- App/app/layout.tsx | 6 +++++- App/components/env-banner.tsx | 30 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 App/components/env-banner.tsx diff --git a/App/app/layout.tsx b/App/app/layout.tsx index 1a0213d..334d7d0 100644 --- a/App/app/layout.tsx +++ b/App/app/layout.tsx @@ -1,6 +1,7 @@ import type { Metadata } from "next"; import { Inter, JetBrains_Mono } from "next/font/google"; import "./globals.css"; +import { EnvBanner } from "@/components/env-banner"; const inter = Inter({ subsets: ["latin"], @@ -29,7 +30,10 @@ export default function RootLayout({ }) { return ( - {children} + + + {children} + ); } diff --git a/App/components/env-banner.tsx b/App/components/env-banner.tsx new file mode 100644 index 0000000..5957da9 --- /dev/null +++ b/App/components/env-banner.tsx @@ -0,0 +1,30 @@ +// Thin fixed banner shown only when NEXT_PUBLIC_ENV_LABEL is set (e.g. staging). +// Production never sets the var, so it renders nothing there. +export function EnvBanner() { + const label = process.env.NEXT_PUBLIC_ENV_LABEL; + if (!label) return null; + return ( +
+ {label} +
+ ); +}