mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-05-16 01:12:46 +00:00
17 lines
635 B
TypeScript
17 lines
635 B
TypeScript
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);
|
|
});
|
|
};
|