Skip to content

Commit 70b3c8e

Browse files
committed
fix: prevent rendering empty project groups in the project listing
1 parent fbca05e commit 70b3c8e

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

web/src/pages/projects/index.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,23 @@ export default function Page(): JSX.Element {
6767
) : projectsList === null ? (
6868
<Loading />
6969
) : (
70-
projectsGroupedByTag.map((group, groupIndex) => (
71-
<Fragment key={groupIndex}>
72-
<h1 className="text-xl font-bold m-2 mt-8 self-center">
73-
<Locale localeKey={`projects-tag-${group.tag}` as DictionaryKeys<"projects-tag">} />
74-
</h1>
75-
<div className="flex flex-row flex-wrap gap-4 justify-center p-4 max-w-7xl">
76-
{group.projects.map((project, projectIndex) => (
77-
<ProjectCard project={project} key={projectIndex} />
78-
))}
79-
</div>
80-
</Fragment>
81-
))
70+
projectsGroupedByTag.map(
71+
(group, groupIndex) =>
72+
group.projects.length > 0 && (
73+
<Fragment key={groupIndex}>
74+
<h1 className="text-xl font-bold m-2 mt-8 self-center">
75+
<Locale
76+
localeKey={`projects-tag-${group.tag}` as DictionaryKeys<"projects-tag">}
77+
/>
78+
</h1>
79+
<div className="flex flex-row flex-wrap gap-4 justify-center p-4 max-w-7xl">
80+
{group.projects.map((project, projectIndex) => (
81+
<ProjectCard project={project} key={projectIndex} />
82+
))}
83+
</div>
84+
</Fragment>
85+
),
86+
)
8287
)}
8388
</div>
8489
</main>

0 commit comments

Comments
 (0)