From 84c0db72a3fc5eff6038f96e6d178fb963616bfe Mon Sep 17 00:00:00 2001 From: jrmartin Date: Tue, 28 Apr 2026 11:41:06 -0700 Subject: [PATCH 1/5] #VFB-242 - Create navigation bottoms constants, and update reference and checks to use these constants too. Fixes bug introduced by shifting navigation buttons once. --- .../frontend/src/components/Layout.jsx | 31 ++++++++++--------- .../vfbtoolbarMenuConfiguration.jsx | 9 +++--- .../frontend/src/shared/bottomNav/index.jsx | 9 +++--- .../frontend/src/shared/header/index.jsx | 9 +++--- .../src/shared/subHeader/SearchBuilder.jsx | 3 +- .../frontend/src/shared/subHeader/index.jsx | 5 +-- .../frontend/src/utils/constants.js | 8 +++++ 7 files changed, 44 insertions(+), 30 deletions(-) diff --git a/applications/virtual-fly-brain/frontend/src/components/Layout.jsx b/applications/virtual-fly-brain/frontend/src/components/Layout.jsx index 5785d70d..bbce5db1 100644 --- a/applications/virtual-fly-brain/frontend/src/components/Layout.jsx +++ b/applications/virtual-fly-brain/frontend/src/components/Layout.jsx @@ -18,6 +18,7 @@ import { removeAllInstances } from './../reducers/actions/instances'; import { Box, Button,Modal, useMediaQuery, useTheme, Typography, CircularProgress, Link } from "@mui/material"; import { activateCircuits, activateImages } from "../reducers/actions/layout"; import { widgetsIDs } from "./layout/widgets"; +import { bottomNavClearAll, bottomNavDownload, bottomNavLayers, bottomNavQuery, bottomNavSearch, bottomNavSnapshot, bottomNavUpload } from "../utils/constants"; const { secondaryBg, @@ -80,14 +81,14 @@ const MainLayout = ({ bottomNav, setBottomNav }) => { const queryComponentOpened = useSelector( state => state.globalInfo?.queryComponentOpened ); useEffect( () => { - if ( queryComponentOpened && bottomNav !== 2 ){ - setBottomNav(2) + if ( queryComponentOpened && bottomNav !== bottomNavQuery ){ + setBottomNav(bottomNavQuery) } }, [bottomNav, queryComponentOpened, setBottomNav]); // Handle Clear All functionality useEffect(() => { - if (bottomNav === 4) { + if (bottomNav === bottomNavClearAll) { if (allLoadedInstances?.length > 1) { removeAllInstances(); } @@ -97,7 +98,7 @@ const MainLayout = ({ bottomNav, setBottomNav }) => { }, [bottomNav, allLoadedInstances?.length, setBottomNav]); useEffect( () => { - if ( bottomNav === 3 ){ + if ( bottomNav === bottomNavLayers ){ const layoutManager = getLayoutManagerInstance(); if (!layoutManager.model.getNodeById("listViewerWidget").isVisible()) { const newWidget = { ...widgets[widgetsIDs.listViewerWidgetID] } @@ -252,22 +253,22 @@ const MainLayout = ({ bottomNav, setBottomNav }) => { {desktopScreen ? ( <> {tabContent} - {bottomNav === 0 && < VFBSnapshot open={true} setBottomNav={setBottomNav} />} - {bottomNav === 1 && < VFBUploader open={true} setBottomNav={setBottomNav} />} - {bottomNav === 2 && } - {bottomNav === 3 && } - {bottomNav === 6 && } + {bottomNav === bottomNavSnapshot && < VFBSnapshot open={true} setBottomNav={setBottomNav} />} + {bottomNav === bottomNavUpload && < VFBUploader open={true} setBottomNav={setBottomNav} />} + {bottomNav === bottomNavDownload && } + {bottomNav === bottomNavQuery && } + {bottomNav === bottomNavSearch && } ) : ( <> { - bottomNav != 3 && tabContent + bottomNav != bottomNavQuery && tabContent } - {bottomNav === 0 && } - {bottomNav === 1 && } - {bottomNav === 2 && } - {bottomNav === 3 && } - {bottomNav === 6 && } + {bottomNav === bottomNavSnapshot && } + {bottomNav === bottomNavUpload && } + {bottomNav === bottomNavDownload && } + {bottomNav === bottomNavQuery && } + {bottomNav === bottomNavSearch && } )} diff --git a/applications/virtual-fly-brain/frontend/src/components/configuration/VFBToolbar/vfbtoolbarMenuConfiguration.jsx b/applications/virtual-fly-brain/frontend/src/components/configuration/VFBToolbar/vfbtoolbarMenuConfiguration.jsx index df02622b..fcca0bf8 100644 --- a/applications/virtual-fly-brain/frontend/src/components/configuration/VFBToolbar/vfbtoolbarMenuConfiguration.jsx +++ b/applications/virtual-fly-brain/frontend/src/components/configuration/VFBToolbar/vfbtoolbarMenuConfiguration.jsx @@ -1,6 +1,7 @@ import React from 'react'; import vars from "../../../theme/variables"; import { widgets } from "../../layout/widgets"; +import { bottomNavDownload, bottomNavQuery, bottomNavSearch, bottomNavUpload } from '../../../utils/constants'; const { primaryFont, whiteColor, tabActiveColor, primaryBg } = vars; const ACTIONS = { @@ -199,7 +200,7 @@ export const toolbarMenu = (autoSaveLayout) => { return { icon: "fa fa-search", action: { handlerAction: ACTIONS.SHOW_COMPONENT, - parameters: [5] + parameters: [bottomNavSearch] } }, { @@ -207,7 +208,7 @@ export const toolbarMenu = (autoSaveLayout) => { return { icon: "fa fa-clipboard-question", action: { handlerAction: ACTIONS.SHOW_COMPONENT, - parameters: [2] + parameters: [bottomNavQuery] } }, { @@ -279,7 +280,7 @@ export const toolbarMenu = (autoSaveLayout) => { return { icon: "fa fa-download", action: { handlerAction: ACTIONS.SHOW_COMPONENT, - parameters: [1] + parameters: [bottomNavDownload] } }, { @@ -287,7 +288,7 @@ export const toolbarMenu = (autoSaveLayout) => { return { icon: "fa fa-upload", action: { handlerAction: ACTIONS.SHOW_COMPONENT, - parameters: [0] + parameters: [bottomNavUpload] } }, { diff --git a/applications/virtual-fly-brain/frontend/src/shared/bottomNav/index.jsx b/applications/virtual-fly-brain/frontend/src/shared/bottomNav/index.jsx index 1af07e26..f6f97aa0 100644 --- a/applications/virtual-fly-brain/frontend/src/shared/bottomNav/index.jsx +++ b/applications/virtual-fly-brain/frontend/src/shared/bottomNav/index.jsx @@ -3,6 +3,7 @@ import { Box, Button } from "@mui/material"; import React from "react"; import { ClearAll, Download, Query, Upload, Layers } from "../../icons"; import vars from "../../theme/variables"; +import { bottomNavClearAll, bottomNavDownload, bottomNavQuery, bottomNavSnapshot } from "../../utils/constants"; const { whiteColor, @@ -12,22 +13,22 @@ const { const navArr = [ { - id: 0, + id: bottomNavSnapshot, icon: Upload, name: 'Upload' }, { - id: 1, + id: bottomNavDownload, icon: Download, name: 'Download' }, { - id: 2, + id: bottomNavQuery, icon: Query, name: 'Query' }, { - id: 3, + id: bottomNavClearAll, icon: ClearAll, name: 'Clear all' }, diff --git a/applications/virtual-fly-brain/frontend/src/shared/header/index.jsx b/applications/virtual-fly-brain/frontend/src/shared/header/index.jsx index 3fb8271a..8eb9f1ca 100644 --- a/applications/virtual-fly-brain/frontend/src/shared/header/index.jsx +++ b/applications/virtual-fly-brain/frontend/src/shared/header/index.jsx @@ -17,6 +17,7 @@ import layout2 from "../../components/layout/layout2"; import layout3 from "../../components/layout/layout3"; import { WidgetStatus } from "@metacell/geppetto-meta-client/common/layout/model"; import { getLayoutManagerInstance } from "@metacell/geppetto-meta-client/common/layout/LayoutManager"; +import { bottomNavQuery } from "../../utils/constants"; const { primaryBg, headerBoxShadow } = vars; @@ -68,7 +69,7 @@ const Header = ({ setBottomNav }) => { } // Open the query component panel - setBottomNav(2); + setBottomNav(bottomNavQuery); } } @@ -143,10 +144,10 @@ const Header = ({ setBottomNav }) => { if (matchQuery?.queries?.[action?.parameters[1]]) { matchQuery.queries[action.parameters[1]].active = true; updateQueries(updatedQueries); - setBottomNav(2) + setBottomNav(bottomNavQuery) } else { getQueries(action.parameters[0], action.parameters[1]) - setBottomNav(2) + setBottomNav(bottomNavQuery) } break; } @@ -310,7 +311,7 @@ const Header = ({ setBottomNav }) => { {focusedInstance?.metadata?.Id && (focusedInstance?.metadata?.Queries?.length > 0 || queries?.find(q => q.short_form === focusedInstance.metadata.Id)) && (