Skip to content

#vfb-229 - POC: add Neuroglass viewer component and associated state management; integrate into toolbar and layout.#214

Open
jrmartin wants to merge 5 commits intodevelopmentfrom
feature/VFB-229
Open

#vfb-229 - POC: add Neuroglass viewer component and associated state management; integrate into toolbar and layout.#214
jrmartin wants to merge 5 commits intodevelopmentfrom
feature/VFB-229

Conversation

@jrmartin
Copy link
Collaborator

@jrmartin jrmartin commented Feb 13, 2026

Introduce a new Neuroglass viewer widget to the Virtual Fly Brain (VFB) frontend. Embeds Neuroglass in an iframe, and then render inside a Flex Widget. Limited to visualize instances whose ID match the ones we have in gs: VFB_0010101b, VFB_001012vj, VFB_00101567

Tested on VFB Dev with Neuroglass Dev Iframe:

Screencast.2026-02-15.13.27.03.mp4

Key changes:

1. Neuroglass Viewer Component and Widget Integration

  • Added a new NeuroglassViewer React component that loads the Neuroglass viewer in an iframe, dynamically generating its state based on the focused instance or a default template. (NeuroglassViewer.jsx)
  • Registered the Neuroglass viewer in the widget and component maps, assigning it an ID, default panel, and layout properties. (widgets.js, componentMap.js) [1] [2] [3] [4]

2. Toolbar and UI Enhancements

  • Added a "Neuroglass Viewer" entry to the toolbar menu, allowing users to show the widget from the UI. (vfbtoolbarMenuConfiguration.jsx)

3. State Management and Utility Functions

  • Implemented utility functions for showing, hiding, toggling, and auto-displaying the Neuroglass widget, as well as checking for compatible instances and retrieving their viewer state. (neuroglassActions.js)

4. Neuroglass State Configuration

  • Defined supported instance IDs, shared viewport and layer configurations, and provided helper functions to validate instance IDs and retrieve or check for available Neuroglass states. (neuroglassStateConfig.js)

…management; integrate into toolbar and layout.
@jrmartin jrmartin requested a review from Copilot February 13, 2026 02:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new dockable Neuroglass viewer panel to the VFB frontend, backed by hardcoded Neuroglancer states for a small set of supported instances.

Changes:

  • Introduces NeuroglassViewer React component embedding Neuroglass via an iframe and switching state based on focused instance.
  • Adds hardcoded Neuroglancer state config + Redux/layout helper actions for showing/hiding/auto-showing the widget.
  • Registers the new widget in the layout system (widget config, component map) and exposes it in the toolbar menu.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
applications/virtual-fly-brain/frontend/src/utils/neuroglassStateConfig.js Adds hardcoded state objects and helpers to retrieve/check states by instance ID
applications/virtual-fly-brain/frontend/src/utils/neuroglassActions.js Adds widget visibility toggles and auto-show logic based on loaded instances
applications/virtual-fly-brain/frontend/src/utils/neuroglancerStateMapper.js Adds utilities to map between VFB Redux state and Neuroglancer state
applications/virtual-fly-brain/frontend/src/components/layout/widgets.js Registers the Neuroglass viewer widget in layout configuration
applications/virtual-fly-brain/frontend/src/components/layout/componentMap.js Maps the new widget component key to NeuroglassViewer
applications/virtual-fly-brain/frontend/src/components/configuration/VFBToolbar/vfbtoolbarMenuConfiguration.jsx Adds a toolbar entry to show the Neuroglass viewer widget
applications/virtual-fly-brain/frontend/src/components/NeuroglassViewer.jsx Implements the iframe-based viewer and state selection logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…ement and viewer components; enhance state handling and encoding
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

walrus51 added 3 commits February 13, 2026 15:04
…onfig; improve state existence check in neuroglass state config; enhance regex for dataset matching in state mapper
…deprecated state mapper and streamline state creation
@jrmartin jrmartin requested a review from ddelpiano February 15, 2026 22:07
@jrmartin jrmartin marked this pull request as ready for review February 15, 2026 22:08
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fca42a4648

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

icon: "fa fa-brain",
action: {
handlerAction: ACTIONS.SHOW_WIDGET,
parameters: [widgets?.neuroglassViewerWidget?.id]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle missing Neuroglass widget in imported layouts

This menu item assumes state.widgets['neuroglassViewerWidget'] exists, but menuHandler builds the widget from Redux (shared/header/index.jsx, widgets[action.parameters[0]]) and imported custom layouts overwrite widgets from saved data (reducers/middleware/vfbMiddleware.js, widgets: { ...action.data.redux.widgets }). If a user loads a layout saved before this commit, that key is absent, so clicking “Neuroglass Viewer” dispatches an incomplete widget update and the viewer does not open.

Useful? React with 👍 / 👎.

const focusedInstance = useSelector(state => state.instances?.focusedInstance);

const iframeSrcUrl = useMemo(() => {
if (!focusedInstance?.metadata?.Id) return '';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use template fallback when focused instance is absent

The early return on missing focus ID (return '') prevents the component from ever reaching the default-template fallback branch, so opening this widget before an instance is focused leaves iframeSrc empty and the panel stuck on the loading placeholder. That breaks the intended “focused instance or default template” behavior in startup/empty-focus states.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments