This is an automated email from the ASF dual-hosted git repository.

DImuthuUpe pushed a commit to branch configure-marketing
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit dbb8258de1d59ee2e72f89d9445c8bea626b8142
Author: DImuthuUpe <[email protected]>
AuthorDate: Thu Nov 12 10:36:11 2026 -0500

    Configure markerting content on build time
---
 INSTALL.md                         | 15 +++++++++
 dashboard/.env.example             |  7 ++++
 dashboard/public/branding.json     |  1 +
 dashboard/src/app/globals.css      |  7 ++++
 dashboard/src/app/layout.tsx       | 15 +++++----
 dashboard/src/app/login/page.tsx   |  4 ++-
 dashboard/src/components/Shell.tsx | 13 ++++++--
 dashboard/src/lib/branding.tsx     | 65 ++++++++++++++++++++++++++++++++++++++
 8 files changed, 117 insertions(+), 10 deletions(-)

diff --git a/INSTALL.md b/INSTALL.md
index 128f0ce80e..d01ac6e715 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -368,6 +368,21 @@ cd dashboard
 NEXT_PUBLIC_AIRAVATA_API_URL=http://localhost:9095 npm run dev   # 
http://localhost:3000/dashboard/
 ```
 
+### Branding
+
+The sidebar's logo and name are configurable. At build time, set
+`NEXT_PUBLIC_AIRAVATA_BRAND_NAME` and `NEXT_PUBLIC_AIRAVATA_BRAND_LOGO_URL` (a 
file in
+`dashboard/public/`, or an `https://` URL). After a build, edit 
`dashboard/out/branding.json`
+(or the `branding.json` in the directory `AIRAVATA_DASHBOARD_DIR` points at) 
and copy the logo
+file beside it; the browser reads it on load, so no rebuild is needed:
+
+```json
+{ "name": "My Portal", "logoUrl": "logo.svg" }
+```
+
+Either field may be left out, and the file overrides the build-time values. 
With no logo
+the Airavata mark is shown.
+
 ---
 
 ## Production notes
diff --git a/dashboard/.env.example b/dashboard/.env.example
index ec6c80ec34..dc64be3939 100644
--- a/dashboard/.env.example
+++ b/dashboard/.env.example
@@ -2,3 +2,10 @@
 # :9095. The built dashboard is served by the API server itself and calls it 
on the
 # same origin, so leave this unset for `npm run build`.
 NEXT_PUBLIC_AIRAVATA_API_URL=http://localhost:9095
+
+# Branding, applied when the dashboard is built. Both are optional; with 
neither set the
+# sidebar shows the Airavata mark and name. A relative logo URL is a file 
under public/
+# (e.g. logo.svg -> /dashboard/logo.svg). To rebrand an existing build without 
rebuilding,
+# edit out/branding.json instead: {"name": "My Portal", "logoUrl": "logo.svg"}.
+# NEXT_PUBLIC_AIRAVATA_BRAND_NAME=My Portal
+# NEXT_PUBLIC_AIRAVATA_BRAND_LOGO_URL=logo.svg
diff --git a/dashboard/public/branding.json b/dashboard/public/branding.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/dashboard/public/branding.json
@@ -0,0 +1 @@
+{}
diff --git a/dashboard/src/app/globals.css b/dashboard/src/app/globals.css
index 3b6d868b49..0cc61c4184 100644
--- a/dashboard/src/app/globals.css
+++ b/dashboard/src/app/globals.css
@@ -169,6 +169,13 @@ h3 {
   letter-spacing: 0.14em;
   text-transform: uppercase;
 }
+.rail-logo-img {
+  height: 30px;
+  max-width: 120px;
+  width: auto;
+  flex-shrink: 0;
+  object-fit: contain;
+}
 .rail-logo:hover {
   text-decoration: none;
 }
diff --git a/dashboard/src/app/layout.tsx b/dashboard/src/app/layout.tsx
index 7a3e8191ec..0af4a9d6e6 100644
--- a/dashboard/src/app/layout.tsx
+++ b/dashboard/src/app/layout.tsx
@@ -1,11 +1,12 @@
 import type { Metadata } from "next";
 import { Shell } from "@/components/Shell";
 import { InteractiveAuthProvider } from "@/lib/interactive-auth";
+import { BrandProvider } from "@/lib/branding";
 import { SessionProvider } from "@/lib/session";
 import "./globals.css";
 
 export const metadata: Metadata = {
-  title: "Airavata Dashboard",
+  title: `${process.env.NEXT_PUBLIC_AIRAVATA_BRAND_NAME || "Airavata"} 
Dashboard`,
   description: "Manage compute, storage, applications and processes on Apache 
Airavata",
 };
 
@@ -13,11 +14,13 @@ export default function RootLayout({ children }: { 
children: React.ReactNode })
   return (
     <html lang="en">
       <body>
-        <SessionProvider>
-          <InteractiveAuthProvider>
-            <Shell>{children}</Shell>
-          </InteractiveAuthProvider>
-        </SessionProvider>
+        <BrandProvider>
+          <SessionProvider>
+            <InteractiveAuthProvider>
+              <Shell>{children}</Shell>
+            </InteractiveAuthProvider>
+          </SessionProvider>
+        </BrandProvider>
       </body>
     </html>
   );
diff --git a/dashboard/src/app/login/page.tsx b/dashboard/src/app/login/page.tsx
index 298790e776..75e104a92f 100644
--- a/dashboard/src/app/login/page.tsx
+++ b/dashboard/src/app/login/page.tsx
@@ -4,6 +4,7 @@ import { useRouter } from "next/navigation";
 import { useEffect, useState } from "react";
 import { Alert, Field } from "@/components/ui";
 import { errorText } from "@/lib/api";
+import { useBrand } from "@/lib/branding";
 import { beginCILogon, getCILogonConfig } from "@/lib/cilogon";
 import type { CILogonConfig } from "@/lib/cilogon";
 import { useSession } from "@/lib/session";
@@ -11,6 +12,7 @@ import { useSession } from "@/lib/session";
 export default function LoginPage() {
   const { token, signIn } = useSession();
   const router = useRouter();
+  const brand = useBrand();
   // undefined while the server is asked whether CILogon sign-in is configured.
   const [cilogon, setCILogon] = useState<CILogonConfig | null | 
undefined>(undefined);
   const [redirecting, setRedirecting] = useState(false);
@@ -69,7 +71,7 @@ export default function LoginPage() {
     <div className="center">
       <div className="card" style={{ width: "min(460px, 100%)" }}>
         <div className="card-head">
-          <h2>Sign in to Airavata</h2>
+          <h2>Sign in to {brand.name}</h2>
         </div>
         <div className="card-body form">
           {cilogon === undefined ? (
diff --git a/dashboard/src/components/Shell.tsx 
b/dashboard/src/components/Shell.tsx
index 1aaab4de64..c09496b2d5 100644
--- a/dashboard/src/components/Shell.tsx
+++ b/dashboard/src/components/Shell.tsx
@@ -3,6 +3,7 @@
 import Link from "next/link";
 import { usePathname, useRouter } from "next/navigation";
 import { Fragment, useEffect, useState } from "react";
+import { useBrand } from "@/lib/branding";
 import { useInteractiveAuth } from "@/lib/interactive-auth";
 import { useSession } from "@/lib/session";
 import { AiravataMark, Icon, type IconName } from "./Icons";
@@ -70,6 +71,7 @@ const CONNECTION_LABEL = {
 export function Shell({ children }: { children: React.ReactNode }) {
   const { token, me, isAdmin, active, signOut } = useSession();
   const { current, connection } = useInteractiveAuth();
+  const brand = useBrand();
   const pathname = usePathname();
   const router = useRouter();
   const onLogin = pathname.startsWith("/login");
@@ -128,9 +130,14 @@ export function Shell({ children }: { children: 
React.ReactNode }) {
   return (
     <div className={`shell${collapsed ? " collapsed" : ""}`}>
       <aside className="rail">
-        <Link href="/" className="rail-logo" aria-label="Apache Airavata home">
-          <AiravataMark size={30} />
-          <span>Airavata</span>
+        <Link href="/" className="rail-logo" aria-label={`${brand.name} home`}>
+          {brand.logoUrl ? (
+            // eslint-disable-next-line @next/next/no-img-element
+            <img className="rail-logo-img" src={brand.logoUrl} alt="" />
+          ) : (
+            <AiravataMark size={30} />
+          )}
+          <span>{brand.name}</span>
         </Link>
         <nav className="rail-nav" aria-label="Main">
           {NAV_GROUPS.map((g) => (
diff --git a/dashboard/src/lib/branding.tsx b/dashboard/src/lib/branding.tsx
new file mode 100644
index 0000000000..26a035696e
--- /dev/null
+++ b/dashboard/src/lib/branding.tsx
@@ -0,0 +1,65 @@
+"use client";
+
+import { createContext, useContext, useEffect, useState } from "react";
+
+// Branding: the name shown beside the logo and the logo image itself.
+//
+// Two layers, the second overriding the first:
+//   - Build time: NEXT_PUBLIC_AIRAVATA_BRAND_NAME and 
NEXT_PUBLIC_AIRAVATA_BRAND_LOGO_URL.
+//   - Deployment time: a branding.json beside the exported pages 
(dashboard/out/branding.json
+//     for a stock build), read by the browser on load, so a deployment can be 
rebranded
+//     without rebuilding. Fields: {"name": "...", "logoUrl": "..."}; either 
may be omitted.
+//
+// A logo URL that is absolute (http:, https:, data:) or starts with "/" is 
used as is; any
+// other value is a file inside the dashboard, e.g. "logo.svg" is served at 
/dashboard/logo.svg.
+// With no logo configured the Airavata mark is shown.
+
+export interface Brand {
+  name: string;
+  logoUrl: string;
+}
+
+const BASE_PATH = "/dashboard";
+
+export const DEFAULT_BRAND: Brand = {
+  name: process.env.NEXT_PUBLIC_AIRAVATA_BRAND_NAME || "Airavata",
+  logoUrl: resolveLogo(process.env.NEXT_PUBLIC_AIRAVATA_BRAND_LOGO_URL ?? ""),
+};
+
+function resolveLogo(url: string): string {
+  const u = url.trim();
+  if (!u || /^(https?:|data:|\/)/i.test(u)) return u;
+  return `${BASE_PATH}/${u}`;
+}
+
+const BrandContext = createContext<Brand>(DEFAULT_BRAND);
+
+export function BrandProvider({ children }: { children: React.ReactNode }) {
+  const [brand, setBrand] = useState<Brand>(DEFAULT_BRAND);
+
+  useEffect(() => {
+    let cancelled = false;
+    // A missing file answers with the dashboard's HTML 404 page, so anything 
that is not
+    // JSON is ignored, as is a file that fails to parse.
+    fetch(`${BASE_PATH}/branding.json`, { cache: "no-cache" })
+      .then((r) => (r.ok && r.headers.get("content-type")?.includes("json") ? 
r.json() : null))
+      .then((cfg: Partial<Brand> | null) => {
+        if (cancelled || !cfg || typeof cfg !== "object") return;
+        const name = typeof cfg.name === "string" && cfg.name.trim() ? 
cfg.name.trim() : undefined;
+        const logoUrl = typeof cfg.logoUrl === "string" ? 
resolveLogo(cfg.logoUrl) : undefined;
+        setBrand((b) => ({ name: name ?? b.name, logoUrl: logoUrl ?? b.logoUrl 
}));
+      })
+      .catch(() => {});
+    return () => {
+      cancelled = true;
+    };
+  }, []);
+
+  useEffect(() => {
+    document.title = `${brand.name} Dashboard`;
+  }, [brand.name]);
+
+  return <BrandContext.Provider 
value={brand}>{children}</BrandContext.Provider>;
+}
+
+export const useBrand = () => useContext(BrandContext);

Reply via email to