mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-06-03 02:55:39 +08:00
refactor: setup sidebar header
This commit is contained in:
16
src/components/refactored/sidebar/utils/search.ts
Normal file
16
src/components/refactored/sidebar/utils/search.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { Project } from '@/types/app';
|
||||
|
||||
/**
|
||||
* Filters workspaces/projects by matching the search string against
|
||||
* both `displayName` and `name` (case-insensitive substring match).
|
||||
*/
|
||||
export const filterWorkspacesByName = (workspaces: Project[], filter: string): Project[] => {
|
||||
const normalized = filter.trim().toLowerCase();
|
||||
if (!normalized) return workspaces;
|
||||
|
||||
return workspaces.filter((project) => {
|
||||
const displayName = (project.displayName || project.name).toLowerCase();
|
||||
const projectName = project.name.toLowerCase();
|
||||
return displayName.includes(normalized) || projectName.includes(normalized);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user