Skip to content

feat(playground): improve API Playground navigation and sidebar UX#1587

Merged
AnishSarkar22 merged 4 commits into
MODSetter:mainfrom
AnishSarkar22:fix/ci-ui-changes
Jul 8, 2026
Merged

feat(playground): improve API Playground navigation and sidebar UX#1587
AnishSarkar22 merged 4 commits into
MODSetter:mainfrom
AnishSarkar22:fix/ci-ui-changes

Conversation

@AnishSarkar22

@AnishSarkar22 AnishSarkar22 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Description

  • Added a dedicated PlaygroundSidebar for clearer API Playground navigation.
  • Introduced reusable navigation item/group utilities to simplify layout composition.
  • Updated PlaygroundLayoutShell and RoutedSectionShell to support optional desktop navigation and better responsive behavior.
  • Improved playground sidebar state management with isPlaygroundSidebarOpen.
  • Refined API reference, runner UI styling, output display, and sidebar icon consistency.

Motivation and Context

FIX #

Screenshots

API Changes

  • This PR includes API changes

Change Type

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation
  • Dependency/Build system
  • Breaking change
  • Other (specify):

Testing Performed

  • Tested locally
  • Manual/QA verification

Checklist

  • Follows project coding standards and conventions
  • Documentation updated as needed
  • Dependencies updated as needed
  • No lint/build errors or new warnings
  • All relevant tests are passing

High-level PR Summary

This PR introduces a new dedicated sidebar for the API Playground section with collapsible navigation groups, improves responsive design and text wrapping for mobile devices across various playground components, and includes minor UI refinements such as import formatting cleanup and icon changes. The main architectural change involves extracting playground navigation logic into a reusable PlaygroundSidebar component that integrates with the existing layout shell system.

⏱️ Estimated Review Time: 30-90 minutes

💡 Review Order Suggestion
Order File Path
1 surfsense_web/components/layout/ui/index.ts
2 surfsense_web/components/layout/index.ts
3 surfsense_web/components/layout/ui/playground/PlaygroundSidebar.tsx
4 surfsense_web/components/layout/ui/RoutedSectionShell.tsx
5 surfsense_web/app/dashboard/[workspace_id]/playground/layout-shell.tsx
6 surfsense_web/components/layout/providers/LayoutDataProvider.tsx
7 surfsense_web/components/layout/ui/shell/LayoutShell.tsx
8 surfsense_web/components/layout/ui/sidebar/Sidebar.tsx
9 surfsense_web/app/dashboard/[workspace_id]/playground/components/playground-runner.tsx
10 surfsense_web/app/dashboard/[workspace_id]/playground/components/api-reference.tsx
11 surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx
⚠️ Inconsistent Changes Detected
File Path Warning
surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx Changes the import icon from FolderInput to FilePlus in the Documents sidebar, which is unrelated to the API Playground UI improvements that are the focus of this PR

Need help? Join our Discord

Summary by CodeRabbit

  • New Features

    • Added a dedicated Playground sidebar with grouped navigation and clearer active-state behavior.
    • Introduced a collapsible desktop sidebar panel in the main layout for easier navigation in wider screens.
  • UI Improvements

    • Updated the API reference tabs to stay on one row with horizontal scrolling.
    • Refined spacing and layout in the Playground runner for a cleaner, more consistent display.
  • Bug Fixes

    • Improved desktop/mobile layout handling so the Playground section renders more predictably across screen sizes.
    • Updated an import-documents trigger icon for a more consistent interface.

…gation functions

- Introduced PlaygroundSidebar component for improved navigation within the API Playground.
- Added utility functions for generating navigation items and groups, enhancing modularity and reusability.
- Updated PlaygroundLayoutShell to utilize new navigation functions, streamlining the layout structure.
- Enhanced RoutedSectionShell to support optional desktop navigation, improving responsiveness and user experience.
…state management

- Introduced isPlaygroundSidebarOpen prop to Sidebar component for better control of sidebar visibility.
- Updated LayoutShell to manage playground sidebar state, enhancing user experience and navigation consistency.
- Adjusted text formatting in the API reference for better readability.
- Simplified import statements in PlaygroundRunner for cleaner code.
- Enhanced button styling and layout in PlaygroundRunner for improved user experience.
- Streamlined output display logic in PlaygroundRunner for better clarity.
- Updated the import of FolderInput to FilePlus for improved icon representation in the sidebar.
- Enhanced the button for document import to align with the new iconography, improving visual consistency.
@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

@AnishSarkar22 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel.

A member of the Team first needs to authorize it.

@AnishSarkar22 AnishSarkar22 changed the title fix: ui changes feat(playground): improve API Playground navigation and sidebar UX Jul 8, 2026
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b3a480f4-e6d0-4c24-9bc9-2dfffa3be530

📥 Commits

Reviewing files that changed from the base of the PR and between ba08d63 and 9a18c77.

📒 Files selected for processing (11)
  • surfsense_web/app/dashboard/[workspace_id]/playground/components/api-reference.tsx
  • surfsense_web/app/dashboard/[workspace_id]/playground/components/playground-runner.tsx
  • surfsense_web/app/dashboard/[workspace_id]/playground/layout-shell.tsx
  • surfsense_web/components/layout/index.ts
  • surfsense_web/components/layout/providers/LayoutDataProvider.tsx
  • surfsense_web/components/layout/ui/RoutedSectionShell.tsx
  • surfsense_web/components/layout/ui/index.ts
  • surfsense_web/components/layout/ui/playground/PlaygroundSidebar.tsx
  • surfsense_web/components/layout/ui/shell/LayoutShell.tsx
  • surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx
  • surfsense_web/components/layout/ui/sidebar/Sidebar.tsx

📝 Walkthrough

Walkthrough

Introduces a new PlaygroundSidebar component with helper functions for navigation items, groups, active value, and label computation; adds a desktopNav toggle to RoutedSectionShell; wires the sidebar through LayoutShell, Sidebar, and LayoutDataProvider; refactors playground layout-shell to use shared helpers; includes minor formatting and icon changes.

Changes

Playground sidebar and layout wiring

Layer / File(s) Summary
PlaygroundSidebar component and nav helpers
surfsense_web/components/layout/ui/playground/PlaygroundSidebar.tsx
New client component with getPlaygroundNavItems, getPlaygroundNavGroups, getPlaygroundActiveValue, getPlaygroundSelectedLabel, and internal nav link/group renderers with expand/collapse animation.
Barrel exports
surfsense_web/components/layout/ui/index.ts, surfsense_web/components/layout/index.ts
Re-exports the new playground helper functions and PlaygroundSidebar component.
RoutedSectionShell desktopNav prop
surfsense_web/components/layout/ui/RoutedSectionShell.tsx
Adds optional desktopNav prop (default true) controlling conditional rendering of desktop nav, selected-label header, and content padding.
Sidebar/LayoutShell playground wiring
surfsense_web/components/layout/ui/sidebar/Sidebar.tsx, surfsense_web/components/layout/ui/shell/LayoutShell.tsx, surfsense_web/components/layout/providers/LayoutDataProvider.tsx
Sidebar accepts onPlaygroundItemClick/isPlaygroundSidebarOpen; LayoutShell adds playgroundSidebar prop, collapse state, toggle handler, and conditional panel; LayoutDataProvider renders PlaygroundSidebar into LayoutShell.
Playground layout-shell refactor
surfsense_web/app/dashboard/[workspace_id]/playground/layout-shell.tsx
Replaces local nav construction with imported helper functions and sets desktopNav={false} on RoutedSectionShell.
Formatting and icon tweaks
surfsense_web/app/dashboard/[workspace_id]/playground/components/api-reference.tsx, .../playground-runner.tsx, surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx
Reflows text/JSX whitespace, updates TabsList scroll layout, and swaps FolderInput for FilePlus icon.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Sidebar
  participant LayoutShell
  participant PlaygroundSidebar
  participant getPlaygroundActiveValue
  participant getPlaygroundSelectedLabel

  Sidebar->>LayoutShell: onPlaygroundItemClick()
  LayoutShell->>LayoutShell: handlePlaygroundSidebarToggle()
  LayoutShell->>Sidebar: isPlaygroundSidebarOpen
  LayoutShell->>PlaygroundSidebar: render when expanded
  PlaygroundSidebar->>getPlaygroundActiveValue: pathname, base, items
  getPlaygroundActiveValue-->>PlaygroundSidebar: activeValue
  PlaygroundSidebar->>getPlaygroundSelectedLabel: activeValue, items, groups
  getPlaygroundSelectedLabel-->>PlaygroundSidebar: selected label
Loading

Possibly related PRs

  • MODSetter/SurfSense#1585: Both PRs modify RoutedSectionShell.tsx, with this PR extending the shell established in the related PR by adding the desktopNav prop.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@AnishSarkar22 AnishSarkar22 merged commit 7faa58a into MODSetter:main Jul 8, 2026
3 of 9 checks passed
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