Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions src/tags/components/TagDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,24 @@ const TagDisplay = () => {
})

// Flatten all tags into a single array
const flattenedTags = allTags.map((tag) => ({
id: tag.key,
text: tag.value,
className: "",
}))

// Optional: Remove duplicates
const uniqueTags = Array.from(new Map(flattenedTags.map((tag) => [tag.id, tag])).values())
const seenText = new Set<string>()
const uniqueTags = allTags
.map((tag) => ({
id: tag.key,
text: tag.value.trim(),
className: "",
}))
.filter((tag) => {
const normalized = tag.text.toLowerCase()
if (!normalized) {
return false
}
if (seenText.has(normalized)) {
return false
}
seenText.add(normalized)
return true
})
// Sort tags alphabetically by their text value
uniqueTags.sort((a, b) => a.text.localeCompare(b.text))

Expand Down
24 changes: 18 additions & 6 deletions src/tags/components/TagOverall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ export const TagOverall = ({ people, tasks, milestones }: TagOverallProps) => {
content="Number of individual contributors"
className="z-[1099] ourtooltips"
/>
<GetIconDisplay number={numIndividuals} icon={UsersIcon} />
{numIndividuals === 0 ? (
<span>No contributors</span>
) : (
<GetIconDisplay number={numIndividuals} icon={UsersIcon} />
)}
</div>

<div className="stat w-1/3 place-items-center p-4">
Expand All @@ -93,7 +97,11 @@ export const TagOverall = ({ people, tasks, milestones }: TagOverallProps) => {
content="Number of project teams"
className="z-[1099] ourtooltips"
/>
<GetIconDisplay number={numTeams} icon={UserGroupIcon} />
{numTeams === 0 ? (
<span>No teams</span>
) : (
<GetIconDisplay number={numTeams} icon={UserGroupIcon} />
)}
</div>

<div className="stat w-1/3 place-items-center p-4">
Expand All @@ -108,7 +116,11 @@ export const TagOverall = ({ people, tasks, milestones }: TagOverallProps) => {
content="Number of tagged milestones"
className="z-[1099] ourtooltips"
/>
<GetIconDisplay number={numMilestones} icon={FlagIcon} />
{numMilestones === 0 ? (
<span>No milestones</span>
) : (
<GetIconDisplay number={numMilestones} icon={FlagIcon} />
)}
</div>

<div className="stat w-1/3 place-items-center p-4">
Expand All @@ -121,7 +133,7 @@ export const TagOverall = ({ people, tasks, milestones }: TagOverallProps) => {
className="z-[1099] ourtooltips"
/>
{tasks.length === 0 ? (
<>No tasks were found</>
<>No tasks</>
) : (
<div className="w-20 h-20 m-2">
<GetCircularProgressDisplay proportion={totalPercentComplete / 100} />
Expand All @@ -139,7 +151,7 @@ export const TagOverall = ({ people, tasks, milestones }: TagOverallProps) => {
className="z-[1099] ourtooltips"
/>
{tasks.length === 0 ? (
<>No tasks were found</>
<>No tasks</>
) : (
<div className="w-20 h-20 m-2">
<GetCircularProgressDisplay proportion={totalPercentApproved / 100} />
Expand All @@ -158,7 +170,7 @@ export const TagOverall = ({ people, tasks, milestones }: TagOverallProps) => {
/>
<div className="h-24 flex items-center justify-center">
{totalFormAssignments === 0 ? (
<span>No forms required</span>
<span>No forms</span>
) : (
<div className="w-20 h-20 m-2">
<GetCircularProgressDisplay proportion={percentFormsComplete / 100} />
Expand Down