-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e4cd69e
commit 3b1bed3
Showing
4 changed files
with
34 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
import { REWARDS_KEY, KUDOS_ISSUE_KEY } from "@/data/filters"; | ||
import { ProjectInfosLabel, ProjectMetrics } from "@/types/project"; | ||
import { | ||
ProjectInfos, | ||
ProjectInfosLabel, | ||
ProjectMetrics, | ||
} from "@/types/project"; | ||
|
||
export function constructLabels(metrics: ProjectMetrics): ProjectInfosLabel[] { | ||
export function constructLabels( | ||
infos: ProjectInfos, | ||
metrics: ProjectMetrics, | ||
): ProjectInfosLabel[] { | ||
const { certifiedTotal, rewardsTotal } = metrics; | ||
|
||
return [ | ||
rewardsTotal > 0 && { | ||
infos.attributes.rewards && { | ||
color: "success", | ||
emoji: "💰", | ||
label: "Rewards", | ||
type: REWARDS_KEY, | ||
tooltip: "This project is willing to distributed rewards (e.g. tipping)", | ||
}, | ||
certifiedTotal > 0 && { | ||
color: "default", | ||
label: "Kudos Pick", | ||
type: KUDOS_ISSUE_KEY, | ||
tooltip: "This project participates to the Kudos Carnival", | ||
}, | ||
].filter((label): label is ProjectInfosLabel => Boolean(label)); // Type-safe filtering | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters