Skip to content

Commit

Permalink
fix: project leaderboard amount formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
steliosrammos committed Nov 21, 2024
1 parent ff08929 commit 7a7feda
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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 (
Expand All @@ -45,7 +46,7 @@ export const AmbassadorItem = ({ ambassador, rank, ...props }: AmbassadorItemPro
</Body>
<HStack spacing={2}>
<Body size="sm">
{`$${commaFormatted(ambassador.contributionsTotalUsd)}`}{' '}
{`${formatAmount(ambassador.contributionsTotalUsd, FormatCurrencyType.Usd)}`}{' '}
<Body as="span" size="sm" muted>
{`(${commaFormatted(ambassador.contributionsTotal)} sats)`}
</Body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -23,6 +25,7 @@ export const LeaderboardItem = ({ funder, rank, hideLabel, ...props }: Leaderboa
const { t } = useTranslation()

const { user } = useAuthContext()
const { formatAmount } = useCurrencyFormatter()

const funderContributionModal = useModal()

Expand All @@ -48,7 +51,7 @@ export const LeaderboardItem = ({ funder, rank, hideLabel, ...props }: Leaderboa
</Body>
<HStack spacing={2}>
<Body size="sm">
{`$${commaFormatted(funder.contributionsTotalUsd)}`}{' '}
{`${formatAmount(funder.contributionsTotalUsd, FormatCurrencyType.Usd)}`}{' '}
<Body as="span" size="sm" muted>
{`(${commaFormatted(funder.contributionsTotal)} sats)`}
</Body>
Expand Down

0 comments on commit 7a7feda

Please sign in to comment.