Skip to content

Conversation

@uzair-dev-695
Copy link

@uzair-dev-695 uzair-dev-695 commented Dec 27, 2025

Description

Fixes #6522 - Workspace names with user-defined casing (e.g., "PRODUCTION", "API-DEV") were being displayed with only the first letter uppercase (e.g., "Production", "Api-dev").

Problem

The toTitleCase() function was being applied to workspace names in AppTitleBar/index.js, which converted user's intended casing to title case.

Before (broken):

User Input Displayed As
ABCDE Abcde
PRODUCTION Production
api-dev Api Dev

Solution

Replaced toTitleCase() with a new getWorkspaceDisplayName() helper function that:

  1. Preserves user's original casing for workspace names
  2. Only special-cases the literal 'default' workspace to display as 'Default Workspace'

After (fixed):

User Input Displayed As
ABCDE ABCDE
PRODUCTION PRODUCTION
api-dev api-dev

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.
image

Summary by CodeRabbit

  • Bug Fixes

    • Workspace names now display consistently; empty/null/"default" workspaces are shown as "Default Workspace" across the UI and notifications.
  • Chores

    • Internal UI code cleaned up and reformatted for consistency, including simplified icon rendering and minor layout adjustments for action buttons.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 27, 2025

Walkthrough

Adds an internal helper getWorkspaceDisplayName(name) to AppTitleBar that maps falsy/null/'default' to "Default Workspace" and replaces prior toTitleCase(...) usages for active/workspace labels and toast messages; also normalizes JSX/formatting and consolidates icon conditional rendering.

Changes

Cohort / File(s) Summary
Workspace display & UI formatting
packages/bruno-app/src/components/AppTitleBar/index.js
Added getWorkspaceDisplayName() to normalize workspace labels; replaced toTitleCase(...) usages with the helper for active/workspace items and toast content; removed unused toTitleCase import; consolidated pinned/unpinned icon rendering and normalized JSX/formatting.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

size/M

Suggested reviewers

  • lohit-bruno
  • helloanoop
  • naman-bruno
  • bijin-bruno

Poem

A helper small, yet clear and bright,
Naming workspaces just right tonight,
Defaults now stand where blank once lay,
Icons tidy, JSX in play,
A neater bar to guide the light ✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main fix: preserving workspace name casing in the title bar, which directly aligns with the changeset's core objective.
Linked Issues check ✅ Passed The PR addresses all coding requirements from #6522: preserves user-defined workspace casing, introduces getWorkspaceDisplayName() helper, and special-cases 'default' to display as 'Default Workspace'.
Out of Scope Changes check ✅ Passed All changes are scoped to AppTitleBar/index.js and directly address the workspace name casing issue. Minor formatting normalizations (JSX, ternary consolidation) are incidental to the core fix.
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 ed9c76c and 83a3978.

📒 Files selected for processing (1)
  • packages/bruno-app/src/components/AppTitleBar/index.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/bruno-app/src/components/AppTitleBar/index.js

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/AppTitleBar/index.js (1)

80-80: Use helper for consistent workspace name display.

The toast message uses the raw workspace name directly, which is inconsistent with the title bar and menu that use getWorkspaceDisplayName(). If the workspace name is null, undefined, or "default", the toast will display differently than what appears in the UI.

🔎 Proposed fix for consistency
-    toast.success(`Switched to ${workspaces.find((w) => w.uid === workspaceUid)?.name}`);
+    toast.success(`Switched to ${getWorkspaceDisplayName(workspaces.find((w) => w.uid === workspaceUid)?.name)}`);
🧹 Nitpick comments (1)
packages/bruno-app/src/components/AppTitleBar/index.js (1)

22-26: Consider case-insensitive comparison for 'default' check.

The string comparison name === 'default' is case-sensitive. If users create workspaces named "Default" or "DEFAULT", they won't be mapped to "Default Workspace". Consider using name?.toLowerCase() === 'default' if this is unintended.

Otherwise, the implementation correctly preserves the original workspace name casing as intended.

🔎 Proposed case-insensitive check
 const getWorkspaceDisplayName = (name) => {
-  if (!name || name === 'default') return 'Default Workspace';
+  if (!name || name.toLowerCase() === 'default') return 'Default Workspace';
   return name;
 };
📜 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 f40e4d2 and 39275a4.

📒 Files selected for processing (1)
  • packages/bruno-app/src/components/AppTitleBar/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/AppTitleBar/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/AppTitleBar/index.js
🧬 Code graph analysis (1)
packages/bruno-app/src/components/AppTitleBar/index.js (5)
packages/bruno-app/src/components/Sidebar/SidebarHeader/index.js (1)
  • activeWorkspace (38-38)
packages/bruno-app/src/components/Sidebar/Collections/index.js (1)
  • activeWorkspace (17-17)
packages/bruno-app/src/components/WorkspaceHome/index.js (1)
  • activeWorkspace (27-27)
packages/bruno-app/src/components/Sidebar/SidebarHeader/WorkspaceSelector/index.js (1)
  • activeWorkspace (19-19)
packages/bruno-app/src/components/Sidebar/SidebarHeader/CloseWorkspace/index.js (1)
  • workspace (11-11)
🔇 Additional comments (2)
packages/bruno-app/src/components/AppTitleBar/index.js (2)

68-68: LGTM!

Correct usage of the helper with optional chaining to handle undefined activeWorkspace.


123-123: LGTM!

Correct usage of the helper for consistent workspace name display in the menu.

@uzair-dev-695 uzair-dev-695 force-pushed the bugfix/workspace-name-case-mismatch branch from 39275a4 to ed9c76c Compare December 27, 2025 17:40
@pull-request-size pull-request-size bot added size/M and removed size/S labels Dec 27, 2025
@pull-request-size pull-request-size bot added size/S and removed size/M labels Dec 27, 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.

Miss match alphabet case

2 participants