Repository navigation
refactor: update ResponsePane and QueryResultTypeSelector - #6490
Conversation
…d tab handling and styling - Adjusted the expanded width for right-side action buttons in ResponsePane. - Refactored view tab toggle logic to enhance clarity and functionality. - Introduced new styling for result view tabs and dropdown buttons. - Added icon support for format options in QueryResultTypeSelector, improving visual feedback. - Implemented dropdown state management to ensure proper interaction with active tabs.
WalkthroughThis PR adjusts layout constants, refactors response-view tab wiring to an explicit change handler, adds active-state control and icon handling to the QueryResultTypeSelector, updates ResponsePane styling, and enhances ResponsiveTabs expand/collapse logic with an expandable element index and hysteresis-based decisioning. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant QRT as QueryResultTypeSelector
participant RP as ResponsePane
participant RT as ResponsiveTabs
rect rgb(235, 245, 255)
Note over User,QRT: Tab click & activation flow
User->>QRT: Click format / preview control
QRT->>QRT: Check isActiveTab
alt Not active
QRT->>RP: onTabSelect() -- requests activation
RP->>RP: handleViewTabChange(newViewTab)
RP->>RP: dispatch(updateResponseViewTab)
RP->>QRT: re-render with isActiveTab=true
else Active
QRT->>QRT: Toggle dropdownOpen / render icons
end
end
rect rgb(250, 245, 230)
Note over User,RT: Resize & expand/collapse with hysteresis
User->>RT: Resize container
RT->>RT: Measure availableSpace
RT->>RT: Compute totalExpandedWidth (sum right children, replace expandable index with expanded width)
alt Currently expanded
RT->>RT: Collapse if availableSpace < (totalExpandedWidth - EXPANDABLE_HYSTERESIS)
else Currently collapsed
RT->>RT: Expand if availableSpace >= totalExpandedWidth
end
RT->>RP: Update layout state / trigger re-render
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
packages/bruno-app/src/components/RequestTabPanel/index.jspackages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/index.jsxpackages/bruno-app/src/components/ResponsePane/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/index.jspackages/bruno-app/src/ui/ResponsiveTabs/index.js
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (CODING_STANDARDS.md)
**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions.() => {}is good
No space between function name and parentheses.func()notfunc ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly
Files:
packages/bruno-app/src/components/RequestTabPanel/index.jspackages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/StyledWrapper.jspackages/bruno-app/src/ui/ResponsiveTabs/index.jspackages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/index.jsxpackages/bruno-app/src/components/ResponsePane/index.js
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (CODING_STANDARDS.md)
**/*.{jsx,tsx}: Use styled component's theme prop to manage CSS colors and not CSS variables when in the context of a styled component or any React component using the styled component
Styled Components are used as wrappers to define both self and children components style; Tailwind classes are used specifically for layout based styles
Styled Component CSS might also change layout but Tailwind classes shouldn't define colors
Files:
packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/index.jsx
🧠 Learnings (4)
📚 Learning: 2025-12-17T21:41:24.730Z
Learnt from: naman-bruno
Repo: usebruno/bruno PR: 6407
File: packages/bruno-app/src/components/Environments/ConfirmCloseEnvironment/index.js:5-41
Timestamp: 2025-12-17T21:41:24.730Z
Learning: Do not suggest PropTypes validation for React components in the Bruno codebase. The project does not use PropTypes, so reviews should avoid proposing PropTypes and rely on the existing typing/validation approach (e.g., TypeScript or alternative runtime checks) if applicable. This guideline applies broadly to all JavaScript/JSX components in the repo.
Applied to files:
packages/bruno-app/src/components/RequestTabPanel/index.jspackages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/StyledWrapper.jspackages/bruno-app/src/ui/ResponsiveTabs/index.jspackages/bruno-app/src/components/ResponsePane/index.js
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Applies to **/*.{jsx,tsx} : Styled Component CSS might also change layout but Tailwind classes shouldn't define colors
Applied to files:
packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/StyledWrapper.js
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Applies to **/*.{jsx,tsx} : Use styled component's theme prop to manage CSS colors and not CSS variables when in the context of a styled component or any React component using the styled component
Applied to files:
packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/StyledWrapper.js
📚 Learning: 2025-12-05T20:31:33.005Z
Learnt from: CR
Repo: usebruno/bruno PR: 0
File: CODING_STANDARDS.md:0-0
Timestamp: 2025-12-05T20:31:33.005Z
Learning: Applies to **/*.{jsx,tsx} : Styled Components are used as wrappers to define both self and children components style; Tailwind classes are used specifically for layout based styles
Applied to files:
packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/StyledWrapper.jspackages/bruno-app/src/components/ResponsePane/StyledWrapper.js
🧬 Code graph analysis (2)
packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/index.jsx (2)
packages/bruno-app/src/components/Icons/IconCaretDown/index.js (1)
IconCaretDown(3-16)packages/bruno-app/src/ui/MenuDropdown/index.js (2)
enhancedItems(171-194)MenuDropdown(53-467)
packages/bruno-app/src/components/ResponsePane/index.js (1)
packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/index.jsx (1)
QueryResultTypeSelector(43-142)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: Playwright E2E Tests
- GitHub Check: SSL Tests - macOS
- GitHub Check: SSL Tests - Windows
- GitHub Check: Unit Tests
- GitHub Check: CLI Tests
- GitHub Check: SSL Tests - Linux
🔇 Additional comments (13)
packages/bruno-app/src/components/RequestTabPanel/index.js (1)
41-41: LGTM!Minor layout adjustment to increase the minimum right pane width by 10px. This aligns with the broader right-side content expansion changes in this PR.
packages/bruno-app/src/ui/ResponsiveTabs/index.js (2)
11-11: LGTM!Good use of hysteresis to prevent UI flickering at boundary conditions during resize operations.
87-127: Solid implementation of expandability logic with hysteresis.The approach correctly:
- Sums children widths while substituting the expandable element's expanded width
- Applies hysteresis to prevent rapid state toggling at boundaries
- Uses functional state update to access previous state for comparison
One minor observation: the
rightContentRef?.currentcheck on line 87 is good defensive coding.packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/StyledWrapper.js (2)
5-6: LGTM!Correctly uses theme props for caret styling, following the coding guidelines for styled components.
25-27: LGTM!New
.icon-mutedclass properly references theme values for text color. Consistent with the project's theming approach.packages/bruno-app/src/components/ResponsePane/StyledWrapper.js (1)
84-109: LGTM!New
.result-view-tabsstyling block correctly uses theme props for border colors. The nested selectors for button states and active tab visuals are well-structured.Minor note: The
!importantdeclarations (lines 92, 98, 103, 106) suggest specificity conflicts. This appears intentional to override base button styles, which is acceptable here.packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/index.jsx (4)
8-17: LGTM!Clean icon mapping for format options. This improves visual feedback as mentioned in the PR objectives.
52-62: Good UX pattern for dropdown state management.The
handleDropdownChangelogic correctly prevents the dropdown from opening when clicking on an inactive tab, instead triggering tab selection first. This aligns with the PR objective to "ensure proper interaction with active tabs."
74-86: LGTM!Clear logic for determining the prefix icon based on the current view mode.
120-138: MenuDropdown correctly supports controlled dropdown behavior.The component properly implements the controlled pattern with both
openedandonChangeprops. State management correctly distinguishes between controlled mode (whenopenedis provided) and uncontrolled mode, with theupdateOpenStatefunction routing updates to theonChangecallback when controlled or internal state when uncontrolled.packages/bruno-app/src/components/ResponsePane/index.js (3)
29-29: Significant reduction in expanded width threshold.The threshold dropped from 375 to 135 pixels. This means the right content will show in expanded form at much narrower widths. Verify this is the intended behavior across different viewport sizes.
73-75: LGTM!Renamed to
handleViewTabChangewith a cleaner signature that explicitly sets the target tab. Dependency array correctly includes onlydispatchanditem.uid.
230-247: Simplify isActiveTab logic or document why it's needed.Line 242:
isActiveTab={selectedViewTab === 'editor' || selectedViewTab === 'preview'}is always true. The fallback chain on line 53 (persistedViewTab ?? initialTab ?? 'editor') ensuresselectedViewTabcan only be'editor'or'preview'. Either passisActiveTab={true}directly or remove this prop if the component doesn't require it.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/bruno-app/src/components/ResponsePane/index.js (1)
228-247: Consider simplifying theisActiveTabprop expression.The
isActiveTablogic evaluatesselectedViewTab === 'editor' || selectedViewTab === 'preview'. Given that:
selectedViewTabdefaults to'editor'(line 53)- The only values toggled are
'editor'and'preview'(via the QueryResultTypeSelector toggle)This expression will always be
truein this context. Unless you're planning to add additional view tab states, consider simplifying toisActiveTab={true}or verify if this explicit check serves a specific purpose.🔎 Potential simplification
<QueryResultTypeSelector formatOptions={previewFormatOptions} formatValue={selectedFormat} onFormatChange={handleFormatChange} onPreviewTabSelect={handleViewTabChange} selectedTab={selectedViewTab} - isActiveTab={selectedViewTab === 'editor' || selectedViewTab === 'preview'} + isActiveTab={true} onTabSelect={() => { handleViewTabChange('editor'); }} />
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/bruno-app/src/components/ResponsePane/index.js
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (CODING_STANDARDS.md)
**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions.() => {}is good
No space between function name and parentheses.func()notfunc ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly
Files:
packages/bruno-app/src/components/ResponsePane/index.js
🧠 Learnings (1)
📚 Learning: 2025-12-17T21:41:24.730Z
Learnt from: naman-bruno
Repo: usebruno/bruno PR: 6407
File: packages/bruno-app/src/components/Environments/ConfirmCloseEnvironment/index.js:5-41
Timestamp: 2025-12-17T21:41:24.730Z
Learning: Do not suggest PropTypes validation for React components in the Bruno codebase. The project does not use PropTypes, so reviews should avoid proposing PropTypes and rely on the existing typing/validation approach (e.g., TypeScript or alternative runtime checks) if applicable. This guideline applies broadly to all JavaScript/JSX components in the repo.
Applied to files:
packages/bruno-app/src/components/ResponsePane/index.js
🧬 Code graph analysis (1)
packages/bruno-app/src/components/ResponsePane/index.js (1)
packages/bruno-app/src/components/ResponsePane/QueryResult/QueryResultTypeSelector/index.jsx (1)
QueryResultTypeSelector(43-142)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: SSL Tests - macOS
- GitHub Check: SSL Tests - Linux
- GitHub Check: SSL Tests - Windows
- GitHub Check: Unit Tests
- GitHub Check: CLI Tests
- GitHub Check: Playwright E2E Tests
🔇 Additional comments (2)
packages/bruno-app/src/components/ResponsePane/index.js (2)
29-29: Verify the expanded width reduction works as intended across viewport sizes.The expanded width has been reduced from 375px to 135px (~64% reduction). While this aligns with the PR objectives, please verify that the right-side action buttons render correctly at this width across different screen sizes and don't cause layout issues or content overflow.
71-73: LGTM! Clean refactoring of the view tab handler.The rename from
handleViewTabToggletohandleViewTabChangebetter reflects the function's purpose, and the explicitnewViewTabparameter makes the API clearer.
) * refactor: update ResponsePane and QueryResultTypeSelector for improved tab handling and styling - Adjusted the expanded width for right-side action buttons in ResponsePane. - Refactored view tab toggle logic to enhance clarity and functionality. - Introduced new styling for result view tabs and dropdown buttons. - Added icon support for format options in QueryResultTypeSelector, improving visual feedback. - Implemented dropdown state management to ensure proper interaction with active tabs. * refactor: remove console log from ResponsePane for cleaner code
Description
JIRA
Update ResponsePane and QueryResultTypeSelector for improved tab handling and styling
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit
Improvements
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.