Add organism switch button to navigation submenu#6229
Add organism switch button to navigation submenu#6229theosanderson wants to merge 22 commits intomainfrom
Conversation
Add an exchange icon button next to the organism display name in the submenu bar. Clicking it opens the existing organism dropdown menu in the main navigation, providing a convenient way to switch organisms without scrolling up to the nav bar. https://claude.ai/code/session_01QsptMMA4uYLEkcEa8uLvjb
…ch button Replace inline SVG with the proper unplugin-icons import for FaExchangeAlt. https://claude.ai/code/session_01QsptMMA4uYLEkcEa8uLvjb
This reverts commit aa86b3f.
The button in OrganismSubmenu.astro is server-rendered and wired via a vanilla <script> tag, so the React hydration wrapper is not applicable. https://claude.ai/code/session_01QsptMMA4uYLEkcEa8uLvjb
- Use #organism-menu id to find the MenuButton instead of a data attribute that wasn't forwarded through NavigationTab - Make the exchange icon smaller and bottom-aligned for a subscript look https://claude.ai/code/session_01QsptMMA4uYLEkcEa8uLvjb
On mobile, the desktop organism dropdown is hidden, so the switch button now dispatches an 'open-sandwich-menu' custom event. The SandwichMenu component listens for this event and opens accordingly. On desktop, it continues to click the organism dropdown as before. https://claude.ai/code/session_01QsptMMA4uYLEkcEa8uLvjb
When clicking the switch button on desktop, a small primary-colored dot animates from the button to the organism dropdown menu, then the dropdown opens. This provides a visual cue connecting the two UI elements. https://claude.ai/code/session_01QsptMMA4uYLEkcEa8uLvjb
Clone the SVG icon from the switch button and animate it to the organism dropdown. Uses z-index 2147483647 (max) to ensure it renders on top of everything. https://claude.ai/code/session_01QsptMMA4uYLEkcEa8uLvjb
Read the primary color from Tailwind at runtime via getComputedStyle on a temporary text-primary element, instead of hardcoding the hex value. Also add a box-shadow flash on the Organisms button when the flying icon arrives. https://claude.ai/code/session_01QsptMMA4uYLEkcEa8uLvjb
The flying icon inherits its original gray color from the button. The arrival flash on the Organisms button uses the Tailwind primary color read dynamically via getComputedStyle. https://claude.ai/code/session_01QsptMMA4uYLEkcEa8uLvjb
The flying icon now has a primary-colored drop-shadow glow that intensifies as it travels, making it much more visible against the page background. Also colors the icon itself in the primary color during flight. https://claude.ai/code/session_01QsptMMA4uYLEkcEa8uLvjb
Replace the static drop-shadow glow with actual trailing ghost copies of the icon that spawn every 25ms along the flight path and fade out over 200ms, creating a visible trail behind the moving icon. https://claude.ai/code/session_01QsptMMA4uYLEkcEa8uLvjb
|
@theosanderson-agent fix types and format |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Types are clean ( |
|
@theosanderson-agent get format passing |
|
@theosanderson-agent can we get the color from colors.json instead? |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Fixed the Prettier formatting issue in |
…olor Import mainTailwindColor from colors.json in the Astro frontmatter and pass the primary color (shade 400) to the client-side script via a data-primary-color attribute. This replaces the DOM probe approach that created a temporary element with text-primary class to read the computed color at runtime. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Done — now importing |
|
@theosanderson-agent fix format and types and format |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Fixed: ESLint flagged an import order issue in |
|
Claude finished @theosanderson's task in 1m 45s —— View job Code Review
The implementation is clean and the approach makes sense — using a vanilla JS script in the Astro component to bridge to either the React desktop menu or the mobile sandwich menu is pragmatic given the mixed rendering context. Specific comments are left inline; summary of the two points:
The rest looks good:
|
Add an isAnimating flag so a second click during the in-flight icon animation no longer queues an extra menuButton.click(), which could otherwise toggle the menu open then immediately closed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds a button to help people confused about how to switch organism to find the organism menu.
The rationale for this somewhat odd design is that it's confusing to have two totally different UI elements to do the same thing as part of the main UI, but it's also confusing that people expect there to be a way to change organism from the left hand UI and that they can't atm.
Because the elements are in Astro not React the code is a bit different to our normal style, and generally it probably looks quite hacky. In my view it's basically fine though.
Discussion in https://loculus.slack.com/archives/C061ZQQM3N1/p1775646115881829
🚀 Preview: https://claude-organism-menu-butt.loculus.org