From ff08929fb6a106e24f5a08c6f1682f0a56f8612b Mon Sep 17 00:00:00 2001 From: Stelios Rammos Date: Thu, 21 Nov 2024 15:20:16 -0600 Subject: [PATCH 1/2] fix: sats to usd conversion for creators --- src/modules/discovery/pages/hallOfFame/components/TopHeroes.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/discovery/pages/hallOfFame/components/TopHeroes.tsx b/src/modules/discovery/pages/hallOfFame/components/TopHeroes.tsx index d3403a1f8..e46a5c5d7 100644 --- a/src/modules/discovery/pages/hallOfFame/components/TopHeroes.tsx +++ b/src/modules/discovery/pages/hallOfFame/components/TopHeroes.tsx @@ -190,7 +190,7 @@ const HeroDisplay = ({ {{usdAmount}} ({{satsAmount}} sats) across <3>{{numberOfProjects}} projects'} values={{ - usdAmount: formatAmount(data[labels.amountUsd], FormatCurrencyType.Usdcent), + usdAmount: formatAmount(data[labels.amountUsd], FormatCurrencyType.Usd), satsAmount: getShortAmountLabel(data[labels.amount]), numberOfProjects: data[labels.numberOfProjects], }} From 7a7fedaf78ee316170d0c8f6274ca006ff99f356 Mon Sep 17 00:00:00 2001 From: Stelios Rammos Date: Thu, 21 Nov 2024 17:44:55 -0600 Subject: [PATCH 2/2] fix: project leaderboard amount formatting --- .../views/leaderboard/components/AmbassadorItem.tsx | 5 +++-- .../views/leaderboard/components/LeaderboardItem.tsx | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/modules/project/pages1/projectView/views/leaderboard/views/leaderboard/components/AmbassadorItem.tsx b/src/modules/project/pages1/projectView/views/leaderboard/views/leaderboard/components/AmbassadorItem.tsx index da5d56208..95d62df0b 100644 --- a/src/modules/project/pages1/projectView/views/leaderboard/views/leaderboard/components/AmbassadorItem.tsx +++ b/src/modules/project/pages1/projectView/views/leaderboard/views/leaderboard/components/AmbassadorItem.tsx @@ -7,6 +7,7 @@ import { RankMedal } from '@/shared/components/display/RankMedal' import { SkeletonLayout } from '@/shared/components/layouts' import { Body } from '@/shared/components/typography' import { getPath } from '@/shared/constants' +import { FormatCurrencyType, useCurrencyFormatter } from '@/shared/utils/hooks/useCurrencyFormatter' import { ProjectLeaderboardAmbassadorsFragment } from '@/types' import { commaFormatted } from '@/utils' @@ -21,7 +22,7 @@ export const AmbassadorItem = ({ ambassador, rank, ...props }: AmbassadorItemPro const { t } = useTranslation() const { user } = useAuthContext() - + const { formatAmount } = useCurrencyFormatter() const isViewer = user.id ? user.id === ambassador.user?.id : false return ( @@ -45,7 +46,7 @@ export const AmbassadorItem = ({ ambassador, rank, ...props }: AmbassadorItemPro - {`$${commaFormatted(ambassador.contributionsTotalUsd)}`}{' '} + {`${formatAmount(ambassador.contributionsTotalUsd, FormatCurrencyType.Usd)}`}{' '} {`(${commaFormatted(ambassador.contributionsTotal)} sats)`} diff --git a/src/modules/project/pages1/projectView/views/leaderboard/views/leaderboard/components/LeaderboardItem.tsx b/src/modules/project/pages1/projectView/views/leaderboard/views/leaderboard/components/LeaderboardItem.tsx index 1a5bf6a6a..307d3e0ca 100644 --- a/src/modules/project/pages1/projectView/views/leaderboard/views/leaderboard/components/LeaderboardItem.tsx +++ b/src/modules/project/pages1/projectView/views/leaderboard/views/leaderboard/components/LeaderboardItem.tsx @@ -7,6 +7,8 @@ import { RankMedal } from '@/shared/components/display/RankMedal' import { SkeletonLayout } from '@/shared/components/layouts' import { Body } from '@/shared/components/typography' import { useModal } from '@/shared/hooks' +import { useCurrencyFormatter } from '@/shared/utils/hooks' +import { FormatCurrencyType } from '@/shared/utils/hooks/useCurrencyFormatter' import { ProjectLeaderboardContributorsFragment } from '@/types' import { commaFormatted } from '@/utils' @@ -23,6 +25,7 @@ export const LeaderboardItem = ({ funder, rank, hideLabel, ...props }: Leaderboa const { t } = useTranslation() const { user } = useAuthContext() + const { formatAmount } = useCurrencyFormatter() const funderContributionModal = useModal() @@ -48,7 +51,7 @@ export const LeaderboardItem = ({ funder, rank, hideLabel, ...props }: Leaderboa - {`$${commaFormatted(funder.contributionsTotalUsd)}`}{' '} + {`${formatAmount(funder.contributionsTotalUsd, FormatCurrencyType.Usd)}`}{' '} {`(${commaFormatted(funder.contributionsTotal)} sats)`}