Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

[PAY-1725] Display proper amount in track sold notification #4039

Merged
merged 2 commits into from
Sep 7, 2023
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
3 changes: 2 additions & 1 deletion packages/common/src/services/audius-backend/AudiusBackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
PlaylistTrackId,
ProfilePictureSizes,
SquareSizes,
StringUSDC,
StringWei,
Track,
TrackMetadata,
Expand Down Expand Up @@ -2183,7 +2184,7 @@ export const audiusBackend = ({
} else if (notification.type === 'usdc_purchase_seller') {
let entityId = 0
let entityType = Entity.Track
let amount = 0
let amount = '' as StringUSDC
const userIds = notification.actions
.map((action) => {
const data = action.data
Expand Down
6 changes: 3 additions & 3 deletions packages/common/src/store/notifications/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ID } from 'models/Identifiers'
import { Status } from 'models/Status'
import { Track } from 'models/Track'
import { User } from 'models/User'
import { StringWei } from 'models/Wallet'
import { StringUSDC, StringWei } from 'models/Wallet'
import { Nullable } from 'utils'

export enum NotificationType {
Expand Down Expand Up @@ -247,7 +247,7 @@ export type DiscoveryUSDCPurchaseNotificationAction = {
content_id: string
seller_user_id: string
buyer_user_id: string
amount: number
amount: StringUSDC
}

export type TrendingRange = 'week' | 'month' | 'year'
Expand Down Expand Up @@ -891,7 +891,7 @@ export type USDCPurchaseSellerNotification = BaseNotification & {
entityId: ID
userIds: ID[]
entityType: string
amount: number
amount: StringUSDC
}

export type USDCPurchaseBuyerNotification = BaseNotification & {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import type {
TrackEntity,
USDCPurchaseSellerNotification as USDCPurchaseSellerNotificationType
} from '@audius/common'
import { formatPrice, notificationsSelectors } from '@audius/common'
import {
formatUSDCWeiToUSDString,
notificationsSelectors
} from '@audius/common'
import { useSelector } from 'react-redux'

import IconCart from 'app/assets/images/iconCart.svg'
Expand Down Expand Up @@ -63,7 +66,7 @@ export const USDCPurchaseSellerNotification = (
<NotificationText>
{messages.congrats} <UserNameLink user={buyerUser} />{' '}
{messages.justBoughtYourTrack} <EntityLink entity={track} /> for $
{formatPrice(amount)}
{formatUSDCWeiToUSDString(amount)}
{messages.exclamation}
</NotificationText>
</NotificationTile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useCallback } from 'react'

import {
Entity,
formatPrice,
formatUSDCWeiToUSDString,
notificationsSelectors,
Nullable,
TrackEntity,
Expand Down Expand Up @@ -65,7 +65,7 @@ export const USDCPurchaseSellerNotification = (
<UserNameLink user={buyerUser} notification={notification} />{' '}
{messages.justBoughtYourTrack}{' '}
<EntityLink entity={track} entityType={Entity.Track} /> for $
{formatPrice(amount)}
{formatUSDCWeiToUSDString(amount)}
{messages.exclamation}
</NotificationBody>
</NotificationTile>
Expand Down