Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

UN-4172 [FEAT] Show the cloud product switcher in place of the top-bar logo and match the 2026 top-bar design (#2296)

Jaseem Jas2b3fd316417c
diff --git a/frontend/src/components/navigations/top-nav-bar/TopNavBar.css b/frontend/src/components/navigations/top-nav-bar/TopNavBar.css
index dd0ab75d8..20ccb41e7 100644
--- a/frontend/src/components/navigations/top-nav-bar/TopNavBar.css
+++ b/frontend/src/components/navigations/top-nav-bar/TopNavBar.css
@@ -1,8 +1,8 @@
/* Styles for TopNavBar */
.top-navbar-dp {
- height: 25px;
- width: 25px;
+ height: 32px;
+ width: 32px;
display: flex;
align-items: center;
justify-content: center;
@@ -10,18 +10,40 @@
* an orphan colour once that bar went violet. On the light bar it needs to
* be the one that carries white initials, so it tracks the brand token. */
background-color: var(--primary);
- border-radius: 5px;
+ border-radius: 8px;
cursor: pointer;
}
.top-navbar-dp .navbar-img {
- border-radius: 5px;
+ border-radius: 8px;
}
.top-navbar-dp .initials {
- font-size: 12px;
- font-weight: bold;
- color: white;
+ font-size: 13px;
+ font-weight: 600;
+ line-height: 20px;
+ color: var(--primary-foreground);
+}
+
+/* Avatar + chevron as one 40px target, per the Figma top bar (1638-44737). */
+.top-navbar-avatar-menu {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ height: 40px;
+ padding-inline: 4px 6px;
+ border-radius: var(--radius-lg);
+ cursor: pointer;
+}
+
+.top-navbar-avatar-menu:hover {
+ background-color: var(--accent);
+}
+
+.top-navbar-avatar-chevron {
+ width: 13px;
+ height: 13px;
+ color: var(--muted-foreground);
}
.topbar-logo {
@@ -84,6 +106,30 @@
background-color: rgba(0, 0, 0, 0.04);
}
+/*
+ * The rule above keys on `.ant-dropdown-menu-item`, which the Dropdown shim no
+ * longer emits, so this row fell back to block layout with a full-size icon
+ * stacked over its label. Mirrors `.logout-button`, which the sibling rows use.
+ */
+.switch-org-trigger {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ min-height: 32px;
+ padding: 5px 12px;
+ cursor: pointer;
+}
+
+.switch-org-trigger > svg {
+ width: 16px;
+ height: 16px;
+ flex-shrink: 0;
+}
+
+.switch-org-trigger:hover {
+ background-color: rgba(0, 0, 0, 0.04);
+}
+
/* White read against the old violet bar; the bar is now `--card`. */
.page-identifier {
vertical-align: super;
diff --git a/frontend/src/components/navigations/top-nav-bar/TopNavBar.jsx b/frontend/src/components/navigations/top-nav-bar/TopNavBar.jsx
index f01cfa4a5..98fdbdd63 100644
--- a/frontend/src/components/navigations/top-nav-bar/TopNavBar.jsx
+++ b/frontend/src/components/navigations/top-nav-bar/TopNavBar.jsx
@@ -1,5 +1,12 @@
import axios from "axios";
-import { LogIn, LogOut, Settings, User, UserRoundCog } from "lucide-react";
+import {
+ ChevronDown,
+ LogIn,
+ LogOut,
+ Settings,
+ User,
+ UserRoundCog,
+} from "lucide-react";
import PropTypes from "prop-types";
import { useCallback, useEffect, useMemo, useState } from "react";
import { useLocation, useNavigate } from "react-router-dom";
@@ -311,7 +318,16 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {
}}
placement="left"
>
- <div className="ant-dropdown-trigger">
+ {/*
+ * The org list opens on pointerdown; the click that follows would
+ * otherwise select this row of the parent menu, which closes that
+ * menu and unmounts the org list with it.
+ */}
+ <div
+ className="ant-dropdown-trigger switch-org-trigger"
+ onClick={(event) => event.stopPropagation()}
+ onKeyDown={(event) => event.stopPropagation()}
+ >
<UserRoundCog /> Switch Org
</div>
</Dropdown>
@@ -377,7 +393,10 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {
return (
<Row align="middle" className="topNav">
<Col span={6} className="platform-switch-container">
- {isUnstract ? (
+ {/* The cloud product switcher carries its own product mark. */}
+ {PlatformDropdown ? (
+ <PlatformDropdown />
+ ) : isUnstract ? (
<CustomLogo
className="topbar-logo cursor-pointer"
Logo={ProductLogo}
@@ -396,7 +415,6 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {
<span className="page-heading">{reviewPageHeader}</span>
</span>
)}
- {PlatformDropdown && <PlatformDropdown />}
</Col>
{isSimpleLayout ? (
@@ -424,7 +442,7 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {
<Col span={4}>
<Row justify="end" align="middle">
- <Space>
+ <Space size={6}>
{topNavBarOptions}
{isUnstract && TrialDaysInfo && <TrialDaysInfo />}
<Dropdown
@@ -433,20 +451,26 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {
arrow
className="top-navbar-dp"
>
- <div className="top-navbar-dp">
- {sessionDetails?.picture ? (
- <Image
- className="navbar-img"
- height="100%"
- width="100%"
- preview={false}
- src={sessionDetails?.picture}
- />
- ) : (
- <Typography.Text className="initials">
- {getInitials(sessionDetails?.name)}
- </Typography.Text>
- )}
+ <div
+ className="top-navbar-avatar-menu"
+ data-testid="top-navbar-avatar-menu"
+ >
+ <div className="top-navbar-dp">
+ {sessionDetails?.picture ? (
+ <Image
+ className="navbar-img"
+ height="100%"
+ width="100%"
+ preview={false}
+ src={sessionDetails?.picture}
+ />
+ ) : (
+ <Typography.Text className="initials">
+ {getInitials(sessionDetails?.name)}
+ </Typography.Text>
+ )}
+ </div>
+ <ChevronDown className="top-navbar-avatar-chevron" />
</div>
</Dropdown>
</Space>
diff --git a/frontend/src/components/navigations/top-nav-bar/TopNavBar.test.jsx b/frontend/src/components/navigations/top-nav-bar/TopNavBar.test.jsx
new file mode 100644
index 000000000..e5ccd9d91
--- /dev/null
+++ b/frontend/src/components/navigations/top-nav-bar/TopNavBar.test.jsx
@@ -0,0 +1,115 @@
+import { render, screen } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import axios from "axios";
+import { MemoryRouter } from "react-router-dom";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+import { useSessionStore } from "../../../store/session-store.js";
+import { ConfirmHost } from "../../widgets/confirm-modal/ConfirmHost.jsx";
+import { resetConfirm } from "../../widgets/confirm-modal/confirmStore.js";
+
+vi.mock("axios");
+
+/*
+ * The logos are `*.svg?react` imports, which only become components once
+ * vite-plugin-svgr runs; it is not in the test pipeline.
+ */
+vi.mock("../../../assets/index.js", () => ({
+ UnstractLogo: () => <span />,
+ UnstractBlackLogo: () => <span />,
+}));
+
+/*
+ * Absent plugins resolve to `export default {}` under vitest (the build throws
+ * instead). TopNavBar reads TrialDaysInfo from `default`, so `{}` would reach
+ * React as an element type; leave it undefined, as in an OSS build.
+ */
+vi.mock(
+ "../../../plugins/unstract-subscription/components/TrialDaysInfo.jsx",
+ () => ({ default: undefined }),
+);
+
+const { TopNavBar } = await import("./TopNavBar.jsx");
+
+const ORGS = [
+ { id: "org-a", display_name: "Org A" },
+ { id: "org-b", display_name: "Org B" },
+];
+
+function renderTopNavBar() {
+ render(
+ <MemoryRouter initialEntries={["/org-a/dashboard"]}>
+ <TopNavBar />
+ <ConfirmHost />
+ </MemoryRouter>,
+ );
+}
+
+async function openSwitchOrg(user) {
+ await user.click(screen.getByTestId("top-navbar-avatar-menu"));
+ // The label's element is the nested Dropdown's trigger, which fills the row;
+ // the menuitem around it is the parent menu's.
+ await screen.findByRole("menuitem", { name: "Switch Org" });
+ await user.click(screen.getByText("Switch Org"));
+}
+
+beforeEach(() => {
+ useSessionStore.setState({
+ sessionDetails: {
+ isLoggedIn: true,
+ name: "Test User",
+ orgName: "org-a",
+ orgId: "org-a",
+ csrfToken: "csrf",
+ allOrganization: ORGS,
+ },
+ });
+});
+
+afterEach(() => {
+ resetConfirm();
+ vi.clearAllMocks();
+});
+
+/*
+ * Switch Org is a Dropdown nested inside a row of the profile Dropdown. The
+ * org list opens on pointerdown, and the click that follows would select the
+ * parent row -- closing the profile menu and unmounting the org list before
+ * anything could be picked. These go through user-event's full pointer
+ * sequence, which is what a real mouse sends.
+ */
+describe("TopNavBar Switch Org", () => {
+ it("keeps the org list open after a real click", async () => {
+ const user = userEvent.setup();
+ renderTopNavBar();
+
+ await openSwitchOrg(user);
+
+ expect(await screen.findByText("Org B")).toBeVisible();
+ // The profile menu must still be mounted -- the bug unmounted it, taking
+ // the org list with it. (Radix aria-hides it while the org list is open.)
+ expect(
+ screen.getByRole("menuitem", { name: "Switch Org", hidden: true }),
+ ).toBeInTheDocument();
+ });
+
+ it("switches to the organization picked from the list", async () => {
+ axios.mockResolvedValue({});
+ const user = userEvent.setup();
+ renderTopNavBar();
+
+ await openSwitchOrg(user);
+ await user.click(await screen.findByText("Org B"));
+ expect(
+ await screen.findByText("Want to switch to Org B?"),
+ ).toBeInTheDocument();
+ await user.click(screen.getByRole("button", { name: "Confirm" }));
+
+ expect(axios).toHaveBeenCalledWith(
+ expect.objectContaining({
+ method: "POST",
+ url: "/api/v1/organization/org-b/set",
+ }),
+ );
+ });
+});
diff --git a/frontend/src/layouts/page-layout/PageLayout.css b/frontend/src/layouts/page-layout/PageLayout.css
index fca5f2f64..f63de8d81 100644
--- a/frontend/src/layouts/page-layout/PageLayout.css
+++ b/frontend/src/layouts/page-layout/PageLayout.css
@@ -17,12 +17,16 @@
* separates the two planes -- without it the bar dissolves into any content
* that is also white, so it is not decorative.
*/
+/*
+ * 56px tall with 12px gutters, per the Figma top bar (node 1638-44720). The
+ * hairline counts toward the 56, hence 7px below: 8 + 40 + 7 + 1.
+ */
.topNav {
background-color: var(--card);
border-bottom: 1px solid var(--border);
- padding-block: 14px;
- padding-inline-start: 20px;
- padding-inline-end: 12px;
+ min-height: 56px;
+ padding-block: 8px 7px;
+ padding-inline: 12px;
}
.logoNoMargin {
margin-inline-end: 12px;