Skip to content

Display modes duplicate#1684

Open
ignaciojimenezr wants to merge 3 commits intoMCPJam:mainfrom
ignaciojimenezr:display-modes+thread-coolors
Open

Display modes duplicate#1684
ignaciojimenezr wants to merge 3 commits intoMCPJam:mainfrom
ignaciojimenezr:display-modes+thread-coolors

Conversation

@ignaciojimenezr
Copy link
Collaborator

@ignaciojimenezr ignaciojimenezr commented Mar 27, 2026

The header bar had an "inline 3/3" popover for switching display modes,
duplicating the per-widget Inline/PiP/Fullscreen tabs already available
on each tool result. Removed the popover and cleaned up unused state,
callbacks, and imports.

Also fixed nav-main test: added missing useSidebar mock that was causing
test failures after useSidebar() was added to NavMain.

@chelojimenez
Copy link
Contributor

chelojimenez commented Mar 27, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@ignaciojimenezr ignaciojimenezr changed the title Display modes+thread coolors Display modes duplicate Mar 27, 2026
@ignaciojimenezr ignaciojimenezr marked this pull request as ready for review March 27, 2026 14:58
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. enhancement New feature or request labels Mar 27, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 27, 2026

Walkthrough

This pull request introduces a new "learn more" feature consisting of three React components—LearnMoreExpandedPanel, LearnMoreHoverCard, and LearnMoreModal—along with a supporting hook and content definitions. The components render educational panels with video content and documentation links, triggered via sidebar navigation. The integration adds a useLearnMore hook to manage expanded panel state and localStorage-backed visited-tab tracking. Sidebar components are updated to pass learn-more context and conditionally wrap menu items with hover cards. The DisplayContextHeader component has display-mode controls removed. A test mock for useSidebar is added to support the expanded test environment.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
mcpjam-inspector/client/src/components/sidebar/__tests__/nav-main.test.tsx (1)

5-16: ⚠️ Potential issue | 🟡 Minor

Please migrate this test setup to repository mock presets.

This remains an ad-hoc inline mock setup; client tests are expected to use shared presets from client/src/test/mocks/ for consistency.

As per coding guidelines: mcpjam-inspector/client/**/__tests__/*.test.{ts,tsx}: Use mock presets from client/src/test/mocks/ including mcpApiPresets and storePresets in client tests.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@mcpjam-inspector/client/src/components/sidebar/__tests__/nav-main.test.tsx`
around lines 5 - 16, Replace the ad-hoc vi.mock block in nav-main.test.tsx that
stubs SidebarGroup, SidebarGroupContent, SidebarMenu, SidebarMenuItem,
SidebarMenuButton and useSidebar with the shared mock presets from
client/src/test/mocks/; remove the inline vi.mock and instead import and apply
the sidebar mock preset plus mcpApiPresets and storePresets (e.g., import {
sidebarPresets, mcpApiPresets, storePresets } from 'client/src/test/mocks') and
register or call them in the test setup/beforeEach so the test uses the
centralized Sidebar mock and the mcpApiPresets and storePresets rather than the
local mocks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@mcpjam-inspector/client/src/components/learn-more/LearnMoreExpandedPanel.tsx`:
- Around line 78-170: The panel is visually modal but missing accessibility: add
programmatic modal semantics and focus management to LearnMoreExpandedPanel by
(1) adding role="dialog" and aria-modal="true" to the motion.div (key
"learn-more-panel") and ensuring the header/title is referenced via
aria-labelledby, (2) capture document.activeElement on mount and restore it in
the cleanup that runs when onClose is invoked, (3) set initial focus to the
close button (the button that renders the XIcon) on open (either via autoFocus
or by focusing it using panelRef.current.querySelector), (4) implement a simple
focus trap on the panelRef that intercepts Tab/Shift+Tab to cycle focus within
focusable elements inside the panel, and (5) add an Escape key listener to call
onClose; ensure background content is not reachable (e.g., toggle aria-hidden on
the app root or rely on aria-modal=true) and clean up all listeners on unmount.

---

Outside diff comments:
In `@mcpjam-inspector/client/src/components/sidebar/__tests__/nav-main.test.tsx`:
- Around line 5-16: Replace the ad-hoc vi.mock block in nav-main.test.tsx that
stubs SidebarGroup, SidebarGroupContent, SidebarMenu, SidebarMenuItem,
SidebarMenuButton and useSidebar with the shared mock presets from
client/src/test/mocks/; remove the inline vi.mock and instead import and apply
the sidebar mock preset plus mcpApiPresets and storePresets (e.g., import {
sidebarPresets, mcpApiPresets, storePresets } from 'client/src/test/mocks') and
register or call them in the test setup/beforeEach so the test uses the
centralized Sidebar mock and the mcpApiPresets and storePresets rather than the
local mocks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: eb6fd5c3-aba5-4bd1-8c0f-46a5c2da6193

📥 Commits

Reviewing files that changed from the base of the PR and between 5c02099 and 44ed6dd.

⛔ Files ignored due to path filters (1)
  • mcpjam-inspector/client/public/tool-vid-march.mp4 is excluded by !**/*.mp4
📒 Files selected for processing (9)
  • mcpjam-inspector/client/src/components/learn-more/LearnMoreExpandedPanel.tsx
  • mcpjam-inspector/client/src/components/learn-more/LearnMoreHoverCard.tsx
  • mcpjam-inspector/client/src/components/learn-more/LearnMoreModal.tsx
  • mcpjam-inspector/client/src/components/mcp-sidebar.tsx
  • mcpjam-inspector/client/src/components/shared/DisplayContextHeader.tsx
  • mcpjam-inspector/client/src/components/sidebar/__tests__/nav-main.test.tsx
  • mcpjam-inspector/client/src/components/sidebar/nav-main.tsx
  • mcpjam-inspector/client/src/hooks/use-learn-more.ts
  • mcpjam-inspector/client/src/lib/learn-more-content.ts
💤 Files with no reviewable changes (1)
  • mcpjam-inspector/client/src/components/shared/DisplayContextHeader.tsx

Comment on lines +78 to +170
<motion.div
ref={panelRef}
key="learn-more-panel"
className="fixed z-50 bg-background rounded-lg border shadow-lg p-6 overflow-y-auto"
style={{
top: "10vh",
left: "50%",
marginLeft: -(PANEL_WIDTH / 2),
width: PANEL_WIDTH,
maxWidth: "calc(100vw - 2rem)",
maxHeight: "80vh",
}}
initial={getInitialStyle()}
animate={{
opacity: 1,
x: 0,
y: 0,
scale: 1,
transformOrigin: "top left",
}}
exit={{
opacity: 0,
scale: 0.97,
transition: { duration: 0.15, ease: EASING } as any,
}}
transition={{ duration: 0.35, ease: EASING }}
>
{/* Close button */}
<button
onClick={onClose}
className="absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:outline-none"
>
<XIcon className="h-4 w-4" />
<span className="sr-only">Close</span>
</button>

{/* Header */}
<div className="mb-4">
<h2 className="text-lg font-semibold leading-none pb-1">
{entry.title}
</h2>
<p className="text-muted-foreground text-sm">
{entry.description}
</p>
</div>

{/* Video */}
{entry.videoUrl ? (
<div className="aspect-video w-full overflow-hidden rounded-md bg-muted mb-4">
{entry.videoUrl.endsWith(".mp4") ? (
<video
src={entry.videoUrl}
className="h-full w-full"
autoPlay
loop
muted
playsInline
preload="auto"
title={`${entry.title} video`}
/>
) : (
<iframe
src={entry.videoUrl}
className="h-full w-full"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
title={`${entry.title} video`}
/>
)}
</div>
) : (
<div className="aspect-video w-full overflow-hidden rounded-md bg-muted flex items-center justify-center mb-4">
<p className="text-muted-foreground text-sm">
Video coming soon
</p>
</div>
)}

{/* Docs link */}
<div className="flex justify-end">
<Button variant="outline" size="sm" asChild>
<a
href={entry.docsUrl}
target="_blank"
rel="noopener noreferrer"
>
Read the docs
<ExternalLink className="ml-1.5 h-3.5 w-3.5" />
</a>
</Button>
</div>
</motion.div>
</>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Expanded panel is visually modal but not programmatically modal.

The panel lacks modal semantics and focus containment/restoration, so keyboard users can still reach background UI while it is open.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@mcpjam-inspector/client/src/components/learn-more/LearnMoreExpandedPanel.tsx`
around lines 78 - 170, The panel is visually modal but missing accessibility:
add programmatic modal semantics and focus management to LearnMoreExpandedPanel
by (1) adding role="dialog" and aria-modal="true" to the motion.div (key
"learn-more-panel") and ensuring the header/title is referenced via
aria-labelledby, (2) capture document.activeElement on mount and restore it in
the cleanup that runs when onClose is invoked, (3) set initial focus to the
close button (the button that renders the XIcon) on open (either via autoFocus
or by focusing it using panelRef.current.querySelector), (4) implement a simple
focus trap on the panelRef that intercepts Tab/Shift+Tab to cycle focus within
focusable elements inside the panel, and (5) add an Escape key listener to call
onClose; ensure background content is not reachable (e.g., toggle aria-hidden on
the app root or rely on aria-modal=true) and clean up all listeners on unmount.

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

Labels

enhancement New feature or request size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants