1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-27 11:02:16 +01:00
unleash.unleash/frontend/src/component/project/ProjectList/group-projects.ts
Thomas Heartman b6833d92aa
feat: split projects view into "my projects" and "other projects" (#6886)
This PR removes the previous "my projects" filter in favor always
splitting projects, but showing both on the main screen.

To make it a bit easier to work with, it also moves the project group
component into its own file, causing some extra lines of code change. My
apologies 🙇🏼
2024-04-22 13:16:53 +02:00

19 lines
506 B
TypeScript

import type { IProjectCard } from 'interfaces/project';
export const groupProjects = (
myProjectIds: Set<string>,
filteredProjects: IProjectCard[],
) => {
const mine: IProjectCard[] = [];
const other: IProjectCard[] = [];
for (const project of filteredProjects) {
if (project.favorite || myProjectIds.has(project.id)) {
mine.push(project);
} else {
other.push(project);
}
}
return { myProjects: mine, otherProjects: other };
};