refactor: setup sidebar header

This commit is contained in:
Haileyesus
2026-03-27 16:44:56 +03:00
parent 186dbcde63
commit b57fec9d66
7 changed files with 183 additions and 54 deletions

View 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);
});
};