feat: Moved Workspace Selector to the Titlebar of the window. (#6319)

* refactor: update sidebar components and styles, replace TitleBar with SidebarHeader, and enhance collections search functionality

* refactor: improve event listener management in AppTitleBar and clean up SidebarHeader styles

* fix: ensure safe access to layout preferences in AppTitleBar and set default order in SidebarHeader

* refactor: centralize toTitleCase utility and remove redundant implementations in AppTitleBar and WorkspaceSelector

* feat: enhance accessibility and testing for sidebar and devtools toggle buttons in AppTitleBar

* chore: quick fix on a flaky test

---------

Co-authored-by: Bijin A B <bijin@usebruno.com>
This commit is contained in:
Abhishek S Lal
2025-12-06 02:07:05 +05:30
committed by GitHub
parent f5211f6a08
commit 4a8d787f31
30 changed files with 1158 additions and 527 deletions

View File

@@ -338,3 +338,23 @@ export const prettifyJsonString = (jsonDataString) => {
}
return jsonDataString;
};
/**
* Returns the given string value converted to title case.
* - If the value is falsy, returns an empty string.
* - Special-case: if the value is 'default', returns 'Default'.
* - Otherwise, splits the string on whitespace, hyphens, or underscores,
* uppercases the first letter of each word, and lowercases the rest.
*
* @param {string} str - The input string to convert.
* @returns {string} - The converted title-case string.
*/
export const toTitleCase = (str) => {
if (!str) return '';
if (str === 'default') return 'Default';
return str
.split(/[\s-_]+/)
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
.join(' ');
};