1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-09-25 16:39:02 +02:00

feat: add project's user count (#6992)

* feat: add project user count

* feat: add user count

* fix: user count
This commit is contained in:
Arik Chakma
2024-09-04 23:22:15 +06:00
committed by GitHub
parent c48c9e75f9
commit d5b9c97fed
4 changed files with 45 additions and 22 deletions

View File

@@ -40,10 +40,11 @@ function DifficultyButton(props: DifficultyButtonProps) {
type ProjectsListProps = {
projects: ProjectFileType[];
userCounts: Record<string, number>;
};
export function ProjectsList(props: ProjectsListProps) {
const { projects } = props;
const { projects, userCounts } = props;
const { difficulty: urlDifficulty } = getUrlParams();
const [difficulty, setDifficulty] = useState<
@@ -127,9 +128,10 @@ export function ProjectsList(props: ProjectsListProps) {
.sort((a, b) => {
return a.frontmatter.sort - b.frontmatter.sort;
})
.map((matchingProject) => (
<ProjectCard project={matchingProject} />
))}
.map((matchingProject) => {
const count = userCounts[matchingProject?.id] || 0;
return <ProjectCard project={matchingProject} userCount={count} />;
})}
</div>
</div>
);