From 958e7973f6feeada77bfd37d8538b0d2cf9f9c74 Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Fri, 19 Jan 2024 18:39:12 -0500 Subject: [PATCH] fix: use correct label for reward dispatch metric --- apps/trading/components/competitions/team-stats.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/trading/components/competitions/team-stats.tsx b/apps/trading/components/competitions/team-stats.tsx index bb150331e..2034aba16 100644 --- a/apps/trading/components/competitions/team-stats.tsx +++ b/apps/trading/components/competitions/team-stats.tsx @@ -14,6 +14,7 @@ import { type TeamGame, } from '../../lib/hooks/use-team'; import { useT } from '../../lib/use-t'; +import { DispatchMetricLabels, type DispatchMetric } from '@vegaprotocol/types'; export const TeamStats = ({ stats, @@ -97,7 +98,9 @@ const LatestResults = ({ games }: { games: TeamGame[] }) => { const FavoriteGame = ({ games }: { games: TeamGame[] }) => { const t = useT(); - const rewardMetrics = games.map((game) => game.team.rewardMetric); + const rewardMetrics = games.map( + (game) => game.team.rewardMetric as DispatchMetric + ); const count = countBy(rewardMetrics); let favoriteMetric = ''; @@ -112,6 +115,10 @@ const FavoriteGame = ({ games }: { games: TeamGame[] }) => { if (!favoriteMetric) return null; + // rewardMetric is a string, should be typed as DispatchMetric + const favoriteMetricLabel = + DispatchMetricLabels[favoriteMetric as DispatchMetric]; + return (
{t('Favorite game')}
@@ -121,7 +128,7 @@ const FavoriteGame = ({ games }: { games: TeamGame[] }) => { name={VegaIconNames.STAR} className="text-vega-yellow-400" />{' '} - {favoriteMetric} + {favoriteMetricLabel}