Skip to content

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

UN-3054 [FIX] Change platform settings menu from click to hover (#1695)

jagadeeswaran-zipstacked27ec875fa4
diff --git a/frontend/src/components/navigations/side-nav-bar/SideNavBar.jsx b/frontend/src/components/navigations/side-nav-bar/SideNavBar.jsx
index 32d1f1bac..ab3e892de 100644
--- a/frontend/src/components/navigations/side-nav-bar/SideNavBar.jsx
+++ b/frontend/src/components/navigations/side-nav-bar/SideNavBar.jsx
@@ -1,6 +1,14 @@
import { useMemo } from "react";
import { BranchesOutlined } from "@ant-design/icons";
-import { Divider, Image, Layout, Space, Tooltip, Typography } from "antd";
+import {
+ Divider,
+ Image,
+ Layout,
+ Popover,
+ Space,
+ Tooltip,
+ Typography,
+} from "antd";
import PropTypes from "prop-types";
import { useNavigate } from "react-router-dom";
@@ -19,6 +27,7 @@ import TerminalIcon from "../../../assets/terminal.svg";
import ConnectorsIcon from "../../../assets/connectors.svg";
import "./SideNavBar.css";
+import "../../settings/settings/Settings.css";
const { Sider } = Layout;
@@ -58,6 +67,81 @@ try {
// Ignore if hook not available
}
+let manualReviewSettingsEnabled = false;
+try {
+ require("../../../plugins/manual-review/settings/Settings.jsx");
+ manualReviewSettingsEnabled = true;
+} catch {
+ // Plugin unavailable
+}
+
+const getSettingsMenuItems = (orgName) => [
+ {
+ key: "platform",
+ label: "Platform Settings",
+ path: `/${orgName}/settings/platform`,
+ },
+ {
+ key: "users",
+ label: "User Management",
+ path: `/${orgName}/users`,
+ },
+ {
+ key: "triad",
+ label: "Default Triad",
+ path: `/${orgName}/settings/triad`,
+ },
+ ...(manualReviewSettingsEnabled
+ ? [
+ {
+ key: "review",
+ label: "Human In the Loop Settings",
+ path: `/${orgName}/settings/review`,
+ },
+ ]
+ : []),
+];
+
+const getActiveSettingsKey = () => {
+ const currentPath = globalThis.location.pathname;
+ if (currentPath.includes("/settings/platform")) return "platform";
+ if (currentPath.includes("/users")) return "users";
+ if (currentPath.includes("/settings/triad")) return "triad";
+ if (currentPath.includes("/settings/review")) return "review";
+ return "platform";
+};
+
+const SettingsPopoverContent = ({ orgName, navigate }) => {
+ const settingsMenuItems = getSettingsMenuItems(orgName);
+ const currentActiveKey = getActiveSettingsKey();
+
+ const handleMenuClick = (path) => {
+ navigate(path);
+ };
+
+ return (
+ <nav className="settings-sidebar-popover">
+ {settingsMenuItems.map((menuItem) => (
+ <button
+ key={menuItem.key}
+ type="button"
+ className={`settings-menu-item ${
+ currentActiveKey === menuItem.key ? "active" : ""
+ }`}
+ onClick={() => handleMenuClick(menuItem.path)}
+ >
+ {menuItem.label}
+ </button>
+ ))}
+ </nav>
+ );
+};
+
+SettingsPopoverContent.propTypes = {
+ orgName: PropTypes.string.isRequired,
+ navigate: PropTypes.func.isRequired,
+};
+
const SideNavBar = ({ collapsed }) => {
const navigate = useNavigate();
const { sessionDetails } = useSessionStore();
@@ -271,37 +355,99 @@ const SideNavBar = ({ collapsed }) => {
</Typography>
)}
<Space direction="vertical" className="menu-item-body">
- {item.subMenu.map((el) => (
- <Tooltip key={el.id} title={collapsed ? el.title : ""}>
- <Space
- className={`space-styles ${
- el.active ? "space-styles-active" : ""
- } ${el.disable ? "space-styles-disable" : ""}`}
- onClick={() => {
- if (!el.disable) {
- navigate(el.path);
+ {item.subMenu.map((el) => {
+ // Platform item has a hover menu and click navigates to platform settings
+ if (el.id === 3.6) {
+ const handlePlatformClick = () => {
+ if (!el.disable) {
+ navigate(el.path);
+ }
+ };
+
+ const platformContent = (
+ <Tooltip title={collapsed ? el.title : ""}>
+ <Space
+ className={`space-styles ${
+ el.active ? "space-styles-active" : ""
+ } ${el.disable ? "space-styles-disable" : ""}`}
+ onClick={handlePlatformClick}
+ >
+ <Image
+ src={el.image}
+ alt="side_icon"
+ className="menu-item-icon"
+ preview={false}
+ />
+ {!collapsed && (
+ <div>
+ <Typography className="sidebar-item-text fs-14">
+ {el.title}
+ </Typography>
+ <Typography className="sidebar-item-text fs-11">
+ {el.description}
+ </Typography>
+ </div>
+ )}
+ </Space>
+ </Tooltip>
+ );
+
+ // Don't show popover when disabled
+ if (el.disable) {
+ return <div key={el.id}>{platformContent}</div>;
+ }
+
+ return (
+ <Popover
+ key={el.id}
+ content={
+ <SettingsPopoverContent
+ orgName={orgName}
+ navigate={navigate}
+ />
}
- }}
- >
- <Image
- src={el.image}
- alt="side_icon"
- className="menu-item-icon"
- preview={false}
- />
- {!collapsed && (
- <div>
- <Typography className="sidebar-item-text fs-14">
- {el.title}
- </Typography>
- <Typography className="sidebar-item-text fs-11">
- {el.description}
- </Typography>
- </div>
- )}
- </Space>
- </Tooltip>
- ))}
+ trigger="hover"
+ placement="rightTop"
+ arrow={false}
+ overlayClassName="settings-popover-overlay"
+ >
+ {platformContent}
+ </Popover>
+ );
+ }
+
+ return (
+ <Tooltip key={el.id} title={collapsed ? el.title : ""}>
+ <Space
+ className={`space-styles ${
+ el.active ? "space-styles-active" : ""
+ } ${el.disable ? "space-styles-disable" : ""}`}
+ onClick={() => {
+ if (!el.disable) {
+ navigate(el.path);
+ }
+ }}
+ >
+ <Image
+ src={el.image}
+ alt="side_icon"
+ className="menu-item-icon"
+ preview={false}
+ />
+ {!collapsed && (
+ <div>
+ <Typography className="sidebar-item-text fs-14">
+ {el.title}
+ </Typography>
+ <Typography className="sidebar-item-text fs-11">
+ {el.description}
+ </Typography>
+ </div>
+ )}
+ </Space>
+ </Tooltip>
+ );
+ })}
</Space>
{index < data.length - 1 && (
<Divider className="sidebar-divider" />
diff --git a/frontend/src/components/settings/default-triad/DefaultTriad.jsx b/frontend/src/components/settings/default-triad/DefaultTriad.jsx
index 73300e829..d4ef88766 100644
--- a/frontend/src/components/settings/default-triad/DefaultTriad.jsx
+++ b/frontend/src/components/settings/default-triad/DefaultTriad.jsx
@@ -175,7 +175,7 @@ function DefaultTriad() {
};
return (
- <SettingsLayout activeKey="triad">
+ <SettingsLayout>
<div className="plt-set-head">
<Button
size="small"
diff --git a/frontend/src/components/settings/platform/PlatformSettings.jsx b/frontend/src/components/settings/platform/PlatformSettings.jsx
index a9e40ea6e..c7010fa9d 100644
--- a/frontend/src/components/settings/platform/PlatformSettings.jsx
+++ b/frontend/src/components/settings/platform/PlatformSettings.jsx
@@ -235,7 +235,7 @@ function PlatformSettings() {
};
return (
- <SettingsLayout activeKey="platform">
+ <SettingsLayout>
<div>
<div className="plt-set-head">
<Button
diff --git a/frontend/src/components/settings/settings-layout/SettingsLayout.jsx b/frontend/src/components/settings/settings-layout/SettingsLayout.jsx
index fb5dfd5a7..0b290154c 100644
--- a/frontend/src/components/settings/settings-layout/SettingsLayout.jsx
+++ b/frontend/src/components/settings/settings-layout/SettingsLayout.jsx
@@ -1,113 +1,9 @@
-import { useEffect, useRef, useState } from "react";
-import { useNavigate, useLocation } from "react-router-dom";
import PropTypes from "prop-types";
import "../settings/Settings.css";
-import { useSessionStore } from "../../../store/session-store";
-
-function SettingsLayout({ children, activeKey }) {
- const navigate = useNavigate();
- const location = useLocation();
- const [isSidebarVisible, setIsSidebarVisible] = useState(true);
- const sidebarRef = useRef(null);
- const { sessionDetails } = useSessionStore();
-
- // Get sidebar collapsed state from localStorage (same as PageLayout)
- const isMainSidebarCollapsed =
- JSON.parse(localStorage.getItem("collapsed")) || false;
- const sidebarLeft = isMainSidebarCollapsed ? 73 : 248; // collapsed: 65px + 8px gap, expanded: 240px + 8px gap
-
- // Show sidebar when route changes (navigating to a new settings page)
- // location.key changes even when navigating to the same path
- useEffect(() => {
- setIsSidebarVisible(true);
- }, [location.pathname, location.key]);
-
- // Handle click outside to close sidebar
- useEffect(() => {
- const handleClickOutside = (event) => {
- if (sidebarRef.current && !sidebarRef.current.contains(event.target)) {
- setIsSidebarVisible(false);
- }
- };
-
- document.addEventListener("mousedown", handleClickOutside);
- return () => {
- document.removeEventListener("mousedown", handleClickOutside);
- };
- }, []);
-
- const settingsMenuItems = [
- {
- key: "platform",
- label: "Platform Settings",
- path: `/${sessionDetails?.orgName}/settings/platform`,
- },
- {
- key: "users",
- label: "User Management",
- path: `/${sessionDetails?.orgName}/users`,
- },
- {
- key: "triad",
- label: "Default Triad",
- path: `/${sessionDetails?.orgName}/settings/triad`,
- },
- {
- key: "review",
- label: "Human In the Loop Settings",
- path: `/${sessionDetails?.orgName}/settings/review`,
- },
- ];
-
- // Determine active key from route if not provided
- const getActiveKey = () => {
- if (activeKey) return activeKey;
- const path = location.pathname;
- if (path.includes("/settings/platform")) return "platform";
- if (path.includes("/users")) return "users";
- if (path.includes("/settings/triad")) return "triad";
- if (path.includes("/settings/review")) return "review";
- return "platform";
- };
-
- const currentActiveKey = getActiveKey();
-
- // Guard against missing orgName - check AFTER all hooks and state setup
- if (!sessionDetails?.orgName) {
- return (
- <div className="settings-container">
- <main className="settings-content" role="main">
- {children}
- </main>
- </div>
- );
- }
+function SettingsLayout({ children }) {
return (
<div className="settings-container">
- {isSidebarVisible && (
- <nav
- className="settings-sidebar"
- ref={sidebarRef}
- style={{ left: `${sidebarLeft}px` }}
- aria-label="Settings navigation"
- >
- {settingsMenuItems.map((item) => (
- <button
- key={item.key}
- type="button"
- className={`settings-menu-item ${
- currentActiveKey === item.key ? "active" : ""
- }`}
- onClick={() => navigate(item.path)}
- aria-label={item.label}
- aria-current={currentActiveKey === item.key ? "page" : undefined}
- >
- {item.label}
- </button>
- ))}
- </nav>
- )}
<main className="settings-content" role="main">
{children}
</main>
@@ -117,7 +13,6 @@ function SettingsLayout({ children, activeKey }) {
SettingsLayout.propTypes = {
children: PropTypes.node.isRequired,
- activeKey: PropTypes.string,
};
export { SettingsLayout };
diff --git a/frontend/src/components/settings/settings/Settings.css b/frontend/src/components/settings/settings/Settings.css
index 1b162c636..4d8226526 100644
--- a/frontend/src/components/settings/settings/Settings.css
+++ b/frontend/src/components/settings/settings/Settings.css
@@ -56,3 +56,15 @@
height: 100%;
overflow: auto;
}
+
+/* Popover menu for sidebar hover */
+.settings-sidebar-popover {
+ display: flex;
+ flex-direction: column;
+}
+
+.settings-popover-overlay .ant-popover-inner {
+ padding: 8px;
+ border-radius: 8px;
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
+}