Skip to content

refactor: simplify layout and styling in QueryUrl and HttpMethodSelector#6545

Merged
bijin-bruno merged 2 commits intousebruno:mainfrom
chirag-bruno:ui/request-method-dropdown-rework
Dec 29, 2025
Merged

refactor: simplify layout and styling in QueryUrl and HttpMethodSelector#6545
bijin-bruno merged 2 commits intousebruno:mainfrom
chirag-bruno:ui/request-method-dropdown-rework

Conversation

@chirag-bruno
Copy link
Collaborator

@chirag-bruno chirag-bruno commented Dec 29, 2025

Description

Updated the Method Seelctor in HTTP Request to have a fixed max width and fixed the fallback method when a custom method is empty

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

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

  • Style

    • Improved method selector visuals with theme-aware coloring and simplified styling for a cleaner, more consistent appearance.
    • Adjusted sizing to use content-fitting widths for the method label and request URL area for better layout stability.
  • Bug Fixes

    • Improved custom HTTP method input behavior and state handling, including better blur/uppercase handling to preserve user edits.

✏️ Tip: You can customize this high-level summary in your review settings.

…tor components; remove unused method selector width state
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 29, 2025

Walkthrough

Refactors the RequestPane QueryUrl and HttpMethodSelector: removes measured dynamic widths and caret/container styles, switches to fit-content sizing, adds theme-aware method coloring and editable custom-method handling with uppercase-on-blur.

Changes

Cohort / File(s) Summary
HTTP Method Selector Styling
packages/bruno-app/src/components/RequestPane/QueryUrl/HttpMethodSelector/StyledWrapper.js
Replaced fixed width/min-width with content-fitting sizing (width: fit-content; max-width: 10ch), removed .caret styling and explicit caret color/fill.
HTTP Method Selector Logic & Theme Integration
packages/bruno-app/src/components/RequestPane/QueryUrl/HttpMethodSelector/index.js
Added theme-aware methodColor (from theme.request.methods), applied to TriggerButton label; introduced selectedMethodRef to track custom edits; uppercase-on-blur fallback behavior; adjusted input classes (px-3 w-fit max-w-[10ch]).
Query URL Layout & Wrapper Styling
packages/bruno-app/src/components/RequestPane/QueryUrl/StyledWrapper.js, packages/bruno-app/src/components/RequestPane/QueryUrl/index.js
Removed styling blocks for .method-selector-container, .input-container, and .caret; removed DOM-measured methodSelectorWidth state and related inline width logic; simplified layout classes to static full-width/min-fit sizing (w-full, min-w-fit, h-full w-full flex flex-row).
Tests
packages/bruno-app/src/components/RequestPane/QueryUrl/HttpMethodSelector/index.spec.js
Wrapped test render with an additional ThemeContext.Provider to supply theme in tests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • lohit-bruno
  • naman-bruno

Poem

🎨 A tiny selector learned new hues,
Sheds fixed widths for content-fitted views,
Theme-colored methods stand tall and bold,
Custom input uppercased, no styles to hold,
A cleaner request, in tidy code, unfolds. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: refactoring layout and styling in QueryUrl and HttpMethodSelector components as evidenced by CSS simplifications and layout adjustments across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 943545c and 24eb395.

📒 Files selected for processing (2)
  • packages/bruno-app/src/components/RequestPane/QueryUrl/HttpMethodSelector/index.spec.js
  • packages/bruno-app/src/components/RequestPane/QueryUrl/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() not func ()
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/RequestPane/QueryUrl/HttpMethodSelector/index.spec.js
  • packages/bruno-app/src/components/RequestPane/QueryUrl/index.js
🧠 Learnings (2)
📚 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/RequestPane/QueryUrl/HttpMethodSelector/index.spec.js
📚 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/RequestPane/QueryUrl/HttpMethodSelector/index.spec.js
  • packages/bruno-app/src/components/RequestPane/QueryUrl/index.js
🧬 Code graph analysis (2)
packages/bruno-app/src/components/RequestPane/QueryUrl/HttpMethodSelector/index.spec.js (1)
packages/bruno-app/src/components/CodeEditor/index.spec.js (1)
  • render (36-40)
packages/bruno-app/src/components/RequestPane/QueryUrl/index.js (3)
packages/bruno-app/src/components/RequestPane/GrpcRequestPane/StyledWrapper.js (1)
  • StyledWrapper (3-33)
packages/bruno-app/src/components/RequestPane/WSRequestPane/StyledWrapper.js (1)
  • StyledWrapper (3-32)
packages/bruno-app/src/components/ResponsePane/GrpcResponsePane/StyledWrapper.js (1)
  • StyledWrapper (3-57)
⏰ 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 - Windows
  • GitHub Check: SSL Tests - Linux
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: Unit Tests
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: CLI Tests
🔇 Additional comments (4)
packages/bruno-app/src/components/RequestPane/QueryUrl/HttpMethodSelector/index.spec.js (1)

8-16: LGTM! Test setup correctly supports theme-aware component.

The addition of ThemeContext.Provider wrapper is necessary for the useTheme() hook now used in HttpMethodSelector. The pattern correctly provides theme context for test rendering.

packages/bruno-app/src/components/RequestPane/QueryUrl/index.js (3)

373-373: Approve: Full-width wrapper.

Adding w-full makes the outer wrapper take full available width, which aligns with the layout simplification objectives.


374-374: Significant layout behavior change: flex-1min-w-fit.

The change from flex-1 (grow to fill space) to min-w-fit (shrink to content) fundamentally alters how the method selector sizes itself. This aligns with the PR's shift to fixed/content-based sizing instead of dynamic measurement.

Ensure this change works correctly with:

  • Long custom HTTP method names
  • Different theme configurations
  • Various container widths

Based on the related changes in HttpMethodSelector/StyledWrapper.js, the method selector now uses max-width: 10ch, which should prevent overflow issues.


385-385: Approve: Static className replaces dynamic inline style.

Replacing the inline style with static utility classes (h-full w-full flex flex-row input-container) completes the removal of dynamic width calculations mentioned in the PR objectives. This is cleaner and more maintainable.


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: 0

Caution

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

⚠️ Outside diff range comments (1)
packages/bruno-app/src/components/RequestPane/QueryUrl/HttpMethodSelector/index.js (1)

5-21: Fix method name typo: toLocaleLowerCasetoLowerCase.

Line 20 uses toLocaleLowerCase() which is not a standard JavaScript method. It should be toLowerCase().

🔎 Proposed fix
-    return colorMap[method.toLocaleLowerCase()];
+    return colorMap[method.toLowerCase()];

Theme integration looks good otherwise.

Using theme.request.methods for color mapping is the correct approach per the project's learnings about theme prop usage.

Based on learnings, styled components should use theme props for colors rather than CSS variables.

🧹 Nitpick comments (1)
packages/bruno-app/src/components/RequestPane/QueryUrl/HttpMethodSelector/index.js (1)

44-44: Consider syncing selectedMethodRef with external method prop changes.

The selectedMethodRef is initialized with the method prop but never updates if the method prop changes externally (e.g., from Redux state or parent component). This could lead to stale fallback values when the input is blurred empty.

🔎 Proposed fix using useEffect
 const HttpMethodSelector = ({ method = DEFAULT_METHOD, onMethodSelect }) => {
   const [isCustomMode, setIsCustomMode] = useState(false);
   const inputRef = useRef();
   const selectedMethodRef = useRef(method);
+
+  // Sync selectedMethodRef when method prop changes externally
+  useEffect(() => {
+    selectedMethodRef.current = method;
+  }, [method]);

Blur handler logic is sound.

The fallback behavior correctly uppercases non-empty input and falls back to selectedMethodRef when empty, addressing the PR objective.

Also applies to: 55-55, 62-70

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9a78432 and 943545c.

📒 Files selected for processing (4)
  • packages/bruno-app/src/components/RequestPane/QueryUrl/HttpMethodSelector/StyledWrapper.js
  • packages/bruno-app/src/components/RequestPane/QueryUrl/HttpMethodSelector/index.js
  • packages/bruno-app/src/components/RequestPane/QueryUrl/StyledWrapper.js
  • packages/bruno-app/src/components/RequestPane/QueryUrl/index.js
💤 Files with no reviewable changes (1)
  • packages/bruno-app/src/components/RequestPane/QueryUrl/StyledWrapper.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() not func ()
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/RequestPane/QueryUrl/HttpMethodSelector/StyledWrapper.js
  • packages/bruno-app/src/components/RequestPane/QueryUrl/index.js
  • packages/bruno-app/src/components/RequestPane/QueryUrl/HttpMethodSelector/index.js
🧠 Learnings (3)
📚 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/RequestPane/QueryUrl/HttpMethodSelector/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/RequestPane/QueryUrl/HttpMethodSelector/StyledWrapper.js
📚 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/RequestPane/QueryUrl/HttpMethodSelector/StyledWrapper.js
  • packages/bruno-app/src/components/RequestPane/QueryUrl/index.js
  • packages/bruno-app/src/components/RequestPane/QueryUrl/HttpMethodSelector/index.js
🧬 Code graph analysis (1)
packages/bruno-app/src/components/RequestPane/QueryUrl/HttpMethodSelector/index.js (1)
packages/bruno-app/src/components/RequestPane/QueryUrl/index.js (3)
  • useTheme (28-28)
  • method (30-30)
  • onMethodSelect (70-78)
⏰ 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: CLI Tests
  • GitHub Check: Unit Tests
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: SSL Tests - Linux
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: Playwright E2E Tests
🔇 Additional comments (6)
packages/bruno-app/src/components/RequestPane/QueryUrl/HttpMethodSelector/StyledWrapper.js (1)

40-41: LGTM! Clean responsive sizing approach.

The change from fixed width to fit-content with max-width: 10ch is a cleaner approach that adapts to content while maintaining reasonable constraints. This aligns well with the input field styling (w-fit max-w-[10ch]) in the HttpMethodSelector component.

packages/bruno-app/src/components/RequestPane/QueryUrl/index.js (3)

373-373: LGTM! Layout simplification achieved.

Adding w-full ensures the QueryUrl component takes the full available width, which is consistent with the removal of dynamic width calculations.


374-374: LGTM! Appropriate constraint for method selector.

Replacing flex-1 with min-w-fit ensures the method selector container sizes to its content rather than expanding, which is the correct behavior for a method selector that should remain compact.


385-385: LGTM! Static layout is cleaner.

The simplified static layout with h-full w-full flex flex-row is more maintainable than the previous dynamic styling approach.

packages/bruno-app/src/components/RequestPane/QueryUrl/HttpMethodSelector/index.js (2)

26-26: LGTM! Padding removal aligns with layout simplification.

Removing pr-4 is consistent with the caret styling removal and the new fit-content approach.


140-140: LGTM! Input styling aligns with display styling.

The change to px-3 w-fit max-w-[10ch] ensures the custom method input matches the normal method display's sizing and padding, providing consistent UX.

@bijin-bruno bijin-bruno merged commit 0d536fb into usebruno:main Dec 29, 2025
8 checks passed
This was referenced Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants