LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
[MISC] Enhance sidebar UX to expand on hover (#1768)
Chandrasekharan M40dd72447a5a
diff --git a/frontend/sample.env b/frontend/sample.envindex 8e09fca6c..4326995d7 100644--- a/frontend/sample.env+++ b/frontend/sample.env@@ -1,8 +1,8 @@-REACT_APP_BACKEND_URL=http://localhost:8000+VITE_BACKEND_URL=http://localhost:8000# Analytics - PostHog (set to false to disable tracking)# Default: false for local development-REACT_APP_ENABLE_POSTHOG=false+VITE_ENABLE_POSTHOG=false# For developmentNODE_ENV=development@@ -10,7 +10,6 @@ NODE_ENV=development# These are critical for hot reloading to work properly in Docker containers# as the normal filesystem event notification doesn't work reliably with mounted volumesCHOKIDAR_USEPOLLING=true-WATCHPACK_POLLING=true-# Configure WebSocket port for hot module replacement (HMR)-WDS_SOCKET_PORT=3000-FAST_REFRESH=true+# HMR WebSocket port - must match the externally accessible port (Traefik = 80)+# NOT the internal Vite port (3000), since the browser connects through the proxy+WDS_SOCKET_PORT=80diff --git a/frontend/src/components/helpers/auth/PersistentLogin.js b/frontend/src/components/helpers/auth/PersistentLogin.jsindex 8a2ff5c03..ab0737ad4 100644--- a/frontend/src/components/helpers/auth/PersistentLogin.js+++ b/frontend/src/components/helpers/auth/PersistentLogin.js@@ -18,7 +18,7 @@ try {);const commonMod = await import("../../../plugins/helpers/common");SELECTED_PRODUCT = commonMod.SELECTED_PRODUCT;- PRODUCT_NAMES = commonMod.PRODUCT_NAMES;+ PRODUCT_NAMES = commonMod.PRODUCT_NAMES ?? {};} catch {// Ignore if hook not available}@@ -40,8 +40,8 @@ function PersistentLogin() {(state) => state?.setSelectedProduct,);}- } catch (error) {- // Do nothing+ } catch {+ // Plugin hook may throw during initialization}useEffect(() => {diff --git a/frontend/src/components/navigations/side-nav-bar/SideNavBar.css b/frontend/src/components/navigations/side-nav-bar/SideNavBar.cssindex efe5123c6..41f00a2e8 100644--- a/frontend/src/components/navigations/side-nav-bar/SideNavBar.css+++ b/frontend/src/components/navigations/side-nav-bar/SideNavBar.css@@ -1,6 +1,62 @@.side-bar {background-color: #0d3a63 !important;+ overflow: hidden;+ height: 100%;+}++/* Ant Design's internal wrapper - needs flex layout for scroll */+.side-bar .ant-layout-sider-children {+ display: flex;+ flex-direction: column;+ height: 100%;+ overflow: hidden;+}++/* Wrapper for scrollable content - scrollbar hidden but scrollable */+.sidebar-content-wrapper {+ flex: 1;+ min-height: 0;overflow-y: auto;+ overflow-x: hidden;+ scrollbar-width: none;+}++.sidebar-content-wrapper::-webkit-scrollbar {+ display: none;+}++/* Hide scrollbar when sidebar is collapsed */+.side-bar.ant-layout-sider-collapsed .sidebar-content-wrapper {+ overflow-y: hidden;+}++/* Toggle container - fixed at bottom */+.sidebar-toggle-container.ant-btn {+ display: flex;+ justify-content: center;+ align-items: center;+ padding: 8px;+ height: auto;+ border: none;+ border-top: 1px solid rgba(255, 255, 255, 0.1);+ border-radius: 0;+ flex-shrink: 0;+ background: transparent;+ width: 100%;+}++.sidebar-toggle-container.ant-btn:hover {+ background: rgba(255, 255, 255, 0.1);+}++.sidebar-toggle-icon {+ color: rgba(255, 255, 255, 0.6);+ font-size: 14px;+ transition: color 0.2s;+}++.sidebar-toggle-icon.pinned {+ color: #1890ff;}.secondary-list-wrapper {@@ -73,15 +129,6 @@color: white;}-.sidebar-item-tag {- margin-left: 6px;- font-size: 10px;- line-height: 16px;- padding: 0 4px;- border-radius: 4px;- vertical-align: middle;-}-.slider-wrap {padding: 12px;}@@ -113,26 +160,3 @@background-color: rgba(255, 255, 255, 0.3);margin: 10px 0;}--.sidebar-title-row {- display: flex;- align-items: center;-}--.sidebar-beta-tag {- margin-left: 8px;-}--.sidebar-antd-icon {- font-size: 22px;- color: #b4c2cf;- width: 25px;- display: flex;- align-items: center;- justify-content: center;-}--.space-styles-active .sidebar-antd-icon,-.space-styles:hover .sidebar-antd-icon {- color: white;-}diff --git a/frontend/src/components/navigations/side-nav-bar/SideNavBar.jsx b/frontend/src/components/navigations/side-nav-bar/SideNavBar.jsxindex 2b5ca1652..428c7d215 100644--- a/frontend/src/components/navigations/side-nav-bar/SideNavBar.jsx+++ b/frontend/src/components/navigations/side-nav-bar/SideNavBar.jsx@@ -1,21 +1,20 @@-import { BranchesOutlined, FileProtectOutlined } from "@ant-design/icons";+import { BranchesOutlined, DoubleRightOutlined } from "@ant-design/icons";import {+ Button,Divider,Image,Layout,Popover,Space,- Tag,Tooltip,Typography,} from "antd";import PropTypes from "prop-types";-import { useMemo } from "react";+import { useEffect, useMemo, useRef, useState } from "react";import { useNavigate } from "react-router-dom";import apiDeploy from "../../../assets/api-deployments.svg";import ConnectorsIcon from "../../../assets/connectors.svg";import CustomTools from "../../../assets/custom-tools-icon.svg";-import DashboardIcon from "../../../assets/dashboard.svg";import EmbeddingIcon from "../../../assets/embedding.svg";import etl from "../../../assets/etl.svg";import LlmIcon from "../../../assets/llm.svg";@@ -25,6 +24,10 @@ import TerminalIcon from "../../../assets/terminal.svg";import TextExtractorIcon from "../../../assets/text-extractor.svg";import VectorDbIcon from "../../../assets/vector-db.svg";import Workflows from "../../../assets/Workflows.svg";+import {+ getLocalStorageValue,+ setLocalStorageValue,+} from "../../../helpers/localStorage";import { useSessionStore } from "../../../store/session-store";import "./SideNavBar.css";@@ -165,83 +168,52 @@ SettingsPopoverContent.propTypes = {navigate: PropTypes.func.isRequired,};-const HITL_MENU_ITEMS = [- { key: "review", label: "Review", subPath: "/review" },- {- key: "approve",- label: "Approve",- subPath: "/review/approve",- supervisorOnly: true,- },- {- key: "download",- label: "Download & Sync",- subPath: "/review/download_and_sync",- supervisorOnly: true,- },-];+const SideNavBar = ({ collapsed, setCollapsed }) => {+ const navigate = useNavigate();+ const { sessionDetails } = useSessionStore();+ const { orgName, flags } = sessionDetails;-const getHITLMenuItems = (orgName, role) => {- const isSupervisorOrAdmin = [- "unstract_supervisor",- "unstract_admin",- ].includes(role);- return HITL_MENU_ITEMS.filter(- (item) => !item.supervisorOnly || isSupervisorOrAdmin,- ).map((item) => ({- key: item.key,- label: item.label,- path: `/${orgName}${item.subPath}`,- }));-};+ const [isPinned, setIsPinned] = useState(() =>+ getLocalStorageValue("sidebarPinned", false),+ );+ const collapseTimeoutRef = useRef(null);-const getActiveHITLKey = (orgName) => {- const currentPath = globalThis.location.pathname;- const base = `/${orgName}/review`;- if (currentPath.startsWith(`${base}/approve`)) {- return "approve";- }- if (currentPath.startsWith(`${base}/download_and_sync`)) {- return "download";- }- if (currentPath.startsWith(base)) {- return "review";- }- return "review";-};+ const clearCollapseTimeout = () => {+ if (collapseTimeoutRef.current) {+ clearTimeout(collapseTimeoutRef.current);+ collapseTimeoutRef.current = null;+ }+ };-const HITLPopoverContent = ({ orgName, role, navigate }) => {- const hitlMenuItems = getHITLMenuItems(orgName, role);- const currentActiveKey = getActiveHITLKey(orgName);+ useEffect(() => {+ setLocalStorageValue("sidebarPinned", isPinned);+ if (isPinned) {+ clearCollapseTimeout();+ setCollapsed(false);+ }+ return clearCollapseTimeout;+ }, [isPinned, setCollapsed]);- return (- <nav className="settings-sidebar-popover">- {hitlMenuItems.map((menuItem) => (- <button- key={menuItem.key}- type="button"- className={`settings-menu-item ${- currentActiveKey === menuItem.key ? "active" : ""- }`}- onClick={() => navigate(menuItem.path)}- >- {menuItem.label}- </button>- ))}- </nav>- );-};+ const handleMouseEnter = () => {+ clearCollapseTimeout();+ if (!isPinned) {+ setCollapsed(false);+ }+ };-HITLPopoverContent.propTypes = {- orgName: PropTypes.string.isRequired,- role: PropTypes.string.isRequired,- navigate: PropTypes.func.isRequired,-};+ const handleMouseLeave = () => {+ if (!isPinned) {+ collapseTimeoutRef.current = setTimeout(() => setCollapsed(true), 300);+ }+ };-const SideNavBar = ({ collapsed }) => {- const navigate = useNavigate();- const { sessionDetails } = useSessionStore();- const { orgName, flags, role } = sessionDetails;+ const togglePin = () => {+ const newPinned = !isPinned;+ setIsPinned(newPinned);+ if (newPinned) {+ setCollapsed(false);+ }+ };try {if (unstractSubscriptionPlanStore?.useUnstractSubscriptionPlanStore) {@@ -261,7 +233,7 @@ const SideNavBar = ({ collapsed }) => {}let menu;- if (sideMenu) {+ if (sideMenu?.useSideMenu) {menu = sideMenu.useSideMenu();}@@ -401,20 +373,9 @@ const SideNavBar = ({ collapsed }) => {},];- // Add dashboard/metrics menu itemsif (dashboardSideMenuItem) {unstractMenuItems[1].subMenu.unshift(dashboardSideMenuItem(orgName));}- // Add metrics dashboard menu item (available for both OSS and cloud)- unstractMenuItems[1].subMenu.unshift({- id: 2.0,- title: "Dashboard",- tag: "New",- description: "View platform usage metrics and analytics",- image: DashboardIcon,- path: `/${orgName}/metrics`,- active: globalThis.location.pathname.startsWith(`/${orgName}/metrics`),- });// If selectedProduct is verticals and menu is null, don't show any sidebar itemsconst data =@@ -434,7 +395,7 @@ const SideNavBar = ({ collapsed }) => {// Add Agentic Prompt Studio menu item if plugin is available and product is unstractif (agenticPromptStudioEnabled && isUnstract) {- const agenticMenuItem = {+ data[0]?.subMenu?.splice(1, 0, {id: 1.2,title: "Agentic Prompt Studio",description: "Build and manage AI-powered extraction workflows",@@ -443,50 +404,7 @@ const SideNavBar = ({ collapsed }) => {active: globalThis.location.pathname.startsWith(`/${orgName}/agentic-prompt-studio`,),- };-- // Add beta tag to title- agenticMenuItem.title = (- <>- {agenticMenuItem.title}- <Tag color="blue" className="sidebar-beta-tag">- BETA- </Tag>- </>- );-- data[0]?.subMenu?.splice(1, 0, agenticMenuItem);- }-- // Add HITL Review section if plugin is available and user has HITL role- const isHITLRole = [- "unstract_reviewer",- "unstract_supervisor",- "unstract_admin",- ].includes(role);- if (manualReviewSettingsEnabled && isHITLRole && isUnstract) {- const hasReviewSection = data.some((item) => item.mainTitle === "REVIEW");- const settingsIndex = data.findIndex(- (item) => item.mainTitle === "SETTINGS",- );- if (!hasReviewSection && settingsIndex !== -1) {- data.splice(settingsIndex, 0, {- id: 2.5,- mainTitle: "REVIEW",- subMenu: [- {- id: 2.51,- title: "HITL",- description: "Human-in-the-loop document review",- isHITL: true,- path: `/${orgName}/review`,- active: globalThis.location.pathname.startsWith(- `/${orgName}/review`,- ),- },- ],- });- }+ });}const shouldDisableAll = useMemo(() => {@@ -501,8 +419,8 @@ const SideNavBar = ({ collapsed }) => {return unstractSubscriptionPlan?.remainingDays < 0;}, [unstractSubscriptionPlan, isUnstract]);- data.forEach((mainMenuItem) => {- mainMenuItem.subMenu.forEach((subMenuItem) => {+ data?.forEach((mainMenuItem) => {+ mainMenuItem?.subMenu?.forEach((subMenuItem) => {subMenuItem.disable = shouldDisableAll;});});@@ -515,88 +433,98 @@ const SideNavBar = ({ collapsed }) => {className="side-bar"width={240}collapsedWidth={65}+ onMouseEnter={handleMouseEnter}+ onMouseLeave={handleMouseLeave}>- <div className="main-slider">- <div className="slider-wrap">- {data?.map((item, index) => (- <div key={item?.id}>- {!collapsed && (- <Typography className="sidebar-main-heading">- {item.mainTitle}- </Typography>- )}- <Space direction="vertical" className="menu-item-body">- {item.subMenu.map((el) => {- // HITL item has a hover menu- if (el.isHITL) {- const handleHITLClick = () => {- if (!el.disable) {- navigate(el.path);+ <div className="sidebar-content-wrapper">+ <div className="main-slider">+ <div className="slider-wrap">+ {data?.map((item, index) => (+ <div key={item?.id}>+ {!collapsed && (+ <Typography className="sidebar-main-heading">+ {item?.mainTitle}+ </Typography>+ )}+ <Space direction="vertical" className="menu-item-body">+ {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}+ data-testid={`sidebar-${el.title+ ?.toLowerCase()+ ?.replaceAll(/\s+/g, "-")}`}+ >+ <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>;}- };- const hitlContent = (- <Tooltip title={collapsed ? el.title : ""}>- <Space- className={`space-styles ${- el.active ? "space-styles-active" : ""- } ${el.disable ? "space-styles-disable" : ""}`}- onClick={handleHITLClick}+ return (+ <Popover+ key={el.id}+ content={+ <SettingsPopoverContent+ orgName={orgName}+ navigate={navigate}+ />+ }+ trigger="hover"+ placement="rightTop"+ arrow={false}+ overlayClassName="settings-popover-overlay">- <FileProtectOutlined className="sidebar-antd-icon" />- {!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>- );-- if (el.disable) {- return <div key={el.id}>{hitlContent}</div>;+ {platformContent}+ </Popover>+ );}return (- <Popover- key={el.id}- content={- <HITLPopoverContent- orgName={orgName}- role={role}- navigate={navigate}- />- }- trigger="hover"- placement="rightTop"- arrow={false}- overlayClassName="settings-popover-overlay"- >- {hitlContent}- </Popover>- );- }-- // 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 : ""}>+ <Tooltip key={el.id} title={collapsed ? el.title : ""}><SpaceclassName={`space-styles ${el.active ? "space-styles-active" : ""} ${el.disable ? "space-styles-disable" : ""}`}- onClick={handlePlatformClick}+ onClick={() => {+ if (!el.disable) {+ navigate(el.path);+ }+ }}+ data-testid={`sidebar-${el.title+ ?.toLowerCase()+ ?.replaceAll(/\s+/g, "-")}`}><Imagesrc={el.image}@@ -617,82 +545,37 @@ const SideNavBar = ({ collapsed }) => {</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}- />- }- 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 sidebar-title-row">- {el.title}- {el.tag && (- <Tag color="blue" className="sidebar-item-tag">- {el.tag}- </Tag>- )}- </Typography>- <Typography className="sidebar-item-text fs-11">- {el.description}- </Typography>- </div>- )}- </Space>- </Tooltip>- );- })}- </Space>- {index < data.length - 1 && (- <Divider className="sidebar-divider" />- )}- </div>- ))}+ })}+ </Space>+ {index < data.length - 1 && (+ <Divider className="sidebar-divider" />+ )}+ </div>+ ))}+ </div></div></div>+ {!collapsed && (+ <Button+ type="text"+ className="sidebar-toggle-container"+ onClick={togglePin}+ aria-pressed={isPinned}+ aria-label={isPinned ? "Unpin sidebar" : "Pin sidebar"}+ icon={+ <DoubleRightOutlined+ className={`sidebar-toggle-icon${isPinned ? " pinned" : ""}`}+ />+ }+ />+ )}</Sider>);};SideNavBar.propTypes = {collapsed: PropTypes.bool.isRequired,+ setCollapsed: PropTypes.func.isRequired,};export default SideNavBar;diff --git a/frontend/src/components/navigations/top-nav-bar/TopNavBar.jsx b/frontend/src/components/navigations/top-nav-bar/TopNavBar.jsxindex 5ee0738ac..e8f82e72c 100644--- a/frontend/src/components/navigations/top-nav-bar/TopNavBar.jsx+++ b/frontend/src/components/navigations/top-nav-bar/TopNavBar.jsx@@ -143,7 +143,7 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {const handleException = useExceptionHandler();const location = useLocation();- if (selectedProductStore) {+ if (selectedProductStore?.useSelectedProductStore) {selectedProduct = selectedProductStore.useSelectedProductStore((state) => state?.selectedProduct,);@@ -156,8 +156,8 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {(state) => state?.unstractSubscriptionPlan,);}- } catch (_error) {- // Do nothing+ } catch {+ // Plugin hook may throw during initialization}const shouldDisableRouting = useMemo(() => {@@ -259,28 +259,34 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {// Build dropdown menu itemsconst items = useMemo(() => {- const menuItems = [];+ const handleLogin = () => {+ const baseUrl = getBaseUrl();+ const newURL = baseUrl + "/api/v1/login";+ window.location.href = newURL;+ };- // Profile- if (isUnstract && !isSimpleLayout) {- menuItems.push({- key: "1",- label: (- <Button- onClick={() => navigate(`/${orgName}/profile`)}- className="logout-button"- disabled={shouldDisableRouting}- type="text"- >- <UserOutlined /> Profile- </Button>- ),- });- }+ const handleClick = isLoggedIn ? logout : handleLogin;+ const icon = isLoggedIn ? <LogoutOutlined /> : <LoginOutlined />;+ const label = isLoggedIn ? "Logout" : "Login";- // Switch Organization- if (allOrganization?.length > 1) {- menuItems.push({+ return [+ // Profile+ isUnstract &&+ !isSimpleLayout && {+ key: "1",+ label: (+ <Button+ onClick={() => navigate(`/${orgName}/profile`)}+ className="logout-button"+ disabled={shouldDisableRouting}+ type="text"+ >+ <UserOutlined /> Profile+ </Button>+ ),+ },+ // Switch Organization+ allOrganization?.length > 1 && {key: "3",label: (<Dropdown@@ -298,64 +304,45 @@ function TopNavBar({ isSimpleLayout, topNavBarOptions }) {</div></Dropdown>),- });- }-- if (+ },+ // PricingisUnstract &&- UnstractPricingMenuLink &&- sessionDetails?.isAdmin &&- !sessionDetails?.provider- ) {- menuItems.push({- key: "7",- label: <UnstractPricingMenuLink orgName={orgName} />,- });- }-- // Custom Plans- if (isUnstract && isStaff && !isOpenSource) {- menuItems.push({- key: "8",+ UnstractPricingMenuLink &&+ sessionDetails?.isAdmin &&+ !sessionDetails?.provider && {+ key: "7",+ label: <UnstractPricingMenuLink orgName={orgName} />,+ },+ // Custom Plans+ isUnstract &&+ isStaff &&+ !isOpenSource && {+ key: "8",+ label: (+ <Button+ onClick={() => navigate(`/${orgName}/admin/custom-plans`)}+ className="logout-button"+ type="text"+ >+ <SettingOutlined /> Custom Plans+ </Button>+ ),+ },+ // Login/Logout+ {+ key: "2",label: (<Button- onClick={() => navigate(`/${orgName}/admin/custom-plans`)}+ onClick={handleClick}+ icon={icon}className="logout-button"type="text">- <SettingOutlined /> Custom Plans+ {label}</Button>),- });- }-- const handleLogin = () => {- const baseUrl = getBaseUrl();- const newURL = baseUrl + "/api/v1/login";- window.location.href = newURL;- };-- // Logout-- const handleClick = isLoggedIn ? logout : handleLogin;- const icon = isLoggedIn ? <LogoutOutlined /> : <LoginOutlined />;- const label = isLoggedIn ? "Logout" : "Login";-- menuItems.push({- key: "2",- label: (- <Button- onClick={handleClick}- icon={icon}- className="logout-button"- type="text"- >- {label}- </Button>- ),- });-- return menuItems.filter(Boolean); // remove any undefined items+ },+ ].filter(Boolean);}, [isUnstract,isSimpleLayout,diff --git a/frontend/src/helpers/localStorage.js b/frontend/src/helpers/localStorage.jsnew file mode 100644index 000000000..33f08d9ff--- /dev/null+++ b/frontend/src/helpers/localStorage.js@@ -0,0 +1,39 @@+/**+ * Safe localStorage utilities with SSR/test environment support+ */++const isLocalStorageAvailable = () => {+ try {+ return typeof localStorage !== "undefined";+ } catch {+ return false;+ }+};++export const getLocalStorageValue = (key, defaultValue) => {+ if (!isLocalStorageAvailable()) {+ return defaultValue;+ }+ try {+ const item = localStorage.getItem(key);+ return item ? JSON.parse(item) : defaultValue;+ } catch {+ try {+ localStorage.removeItem(key);+ } catch {+ // Ignore storage errors+ }+ return defaultValue;+ }+};++export const setLocalStorageValue = (key, value) => {+ if (!isLocalStorageAvailable()) {+ return;+ }+ try {+ localStorage.setItem(key, JSON.stringify(value));+ } catch {+ // Ignore storage errors+ }+};diff --git a/frontend/src/hooks/useSessionValid.js b/frontend/src/hooks/useSessionValid.jsindex bcf208170..13e146c15 100644--- a/frontend/src/hooks/useSessionValid.js+++ b/frontend/src/hooks/useSessionValid.js@@ -25,7 +25,8 @@ try {"../plugins/store/select-product-store.js");const helperMod = await import("../plugins/llm-whisperer/helper");- PRODUCT_NAMES = helperMod.PRODUCT_NAMES;+ // Guard against empty/missing module export+ PRODUCT_NAMES = helperMod.PRODUCT_NAMES ?? {};} catch {// Ignore if hook not available}@@ -42,8 +43,8 @@ function useSessionValid() {(state) => state?.selectedProduct,);}- } catch (error) {- // Do nothing+ } catch {+ // Plugin hook may throw during initialization}const navToSelectProduct = (userSessionData,diff --git a/frontend/src/layouts/page-layout/PageLayout.css b/frontend/src/layouts/page-layout/PageLayout.cssindex d0a18334c..e31d920b1 100644--- a/frontend/src/layouts/page-layout/PageLayout.css+++ b/frontend/src/layouts/page-layout/PageLayout.css@@ -14,12 +14,3 @@.logoNoMargin {margin-inline-end: 12px;}--.collapse_btn {- width: 32px;- height: 32px;- margin-left: -10px;- margin-top: -10px;- position: fixed;- z-index: 1000;-}diff --git a/frontend/src/layouts/page-layout/PageLayout.jsx b/frontend/src/layouts/page-layout/PageLayout.jsxindex 7ff6ff644..b9e4ccf6f 100644--- a/frontend/src/layouts/page-layout/PageLayout.jsx+++ b/frontend/src/layouts/page-layout/PageLayout.jsx@@ -1,5 +1,4 @@-import { LeftOutlined, RightOutlined } from "@ant-design/icons";-import { Button, Layout } from "antd";+import { Layout } from "antd";import PropTypes from "prop-types";import { useEffect, useState } from "react";import { Outlet } from "react-router-dom";@@ -8,6 +7,10 @@ import "./PageLayout.css";import { DisplayLogsAndNotifications } from "../../components/logs-and-notifications/DisplayLogsAndNotifications.jsx";import SideNavBar from "../../components/navigations/side-nav-bar/SideNavBar.jsx";import { TopNavBar } from "../../components/navigations/top-nav-bar/TopNavBar.jsx";+import {+ getLocalStorageValue,+ setLocalStorageValue,+} from "../../helpers/localStorage";function PageLayout({sideBarOptions,@@ -15,29 +18,24 @@ function PageLayout({showLogsAndNotifications = true,hideSidebar = false,}) {- const initialCollapsedValue =- JSON.parse(localStorage.getItem("collapsed")) || false;- const [collapsed, setCollapsed] = useState(initialCollapsedValue);+ const [collapsed, setCollapsed] = useState(() =>+ getLocalStorageValue("collapsed", false),+ );useEffect(() => {- localStorage.setItem("collapsed", JSON.stringify(collapsed));+ setLocalStorageValue("collapsed", collapsed);}, [collapsed]);return (<div className="landingPage"><TopNavBar topNavBarOptions={topNavBarOptions} /><Layout>{!hideSidebar && (- <SideNavBar collapsed={collapsed} {...sideBarOptions} />+ <SideNavBar+ collapsed={collapsed}+ setCollapsed={setCollapsed}+ {...sideBarOptions}+ />)}<Layout>- {!hideSidebar && (- <Button- shape="circle"- size="small"- icon={collapsed ? <RightOutlined /> : <LeftOutlined />}- onClick={() => setCollapsed(!collapsed)}- className="collapse_btn"- />- )}<Outlet />{!hideSidebar && <div className="height-40" />}{showLogsAndNotifications && <DisplayLogsAndNotifications />}diff --git a/frontend/src/routes/useMainAppRoutes.js b/frontend/src/routes/useMainAppRoutes.jsindex 3f54c9f90..360d6359e 100644--- a/frontend/src/routes/useMainAppRoutes.js+++ b/frontend/src/routes/useMainAppRoutes.js@@ -87,7 +87,7 @@ try {const mod1 = await import("../plugins/onboard-product/OnboardProduct.jsx");OnboardProduct = mod1.OnboardProduct;const mod2 = await import("../plugins/llm-whisperer/helper.js");- PRODUCT_NAMES = mod2.PRODUCT_NAMES;+ PRODUCT_NAMES = mod2.PRODUCT_NAMES ?? {};} catch {// Do nothing.}