Skip to content

Commit

Permalink
🚰 Show potential revenue on revenue share (#6331)
Browse files Browse the repository at this point in the history
  • Loading branch information
ikprk authored Jun 3, 2024
1 parent b3f307b commit 0fc9ca8
Showing 1 changed file with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
GetTokenRevenueSharesQuery,
useGetCreatorTokenHoldersQuery,
useGetFullCreatorTokenQuery,
useGetRevenueShareDividendQuery,
} from '@/api/queries/__generated__/creatorTokens.generated'
import { SvgActionCalendar, SvgActionLock, SvgJoyTokenMonochrome16 } from '@/assets/icons'
import { Avatar } from '@/components/Avatar'
Expand Down Expand Up @@ -45,6 +46,13 @@ export const RevenueShareWidget = ({ tokenName, tokenId, revenueShare, memberId
},
},
})
const { data: dividendData, loading: loadingDividendData } = useGetRevenueShareDividendQuery({
variables: {
tokenId: tokenId,
stakingAmount: +(holderData?.tokenAccounts[0]?.totalAmount ?? 0),
},
skip: !holderData?.tokenAccounts[0] || !tokenId,
})
const status = getRevenueShareStatusForMember({
currentBlock,
endingAt: revenueShare.endsAt,
Expand Down Expand Up @@ -119,13 +127,17 @@ export const RevenueShareWidget = ({ tokenName, tokenId, revenueShare, memberId
</Detail>

<Detail title="YOUR SHARE">
<NumberFormat
value={new BN(memberStake?.earnings ?? 0)}
as="p"
variant="t300"
withDenomination="after"
icon={<SvgJoyTokenMonochrome16 />}
/>
{loadingDividendData ? (
<SkeletonLoader height={30} width={60} />
) : (
<NumberFormat
value={new BN(dividendData?.getShareDividend.dividendJoyAmount ?? memberStake?.earnings ?? 0)}
as="p"
variant="t300"
withDenomination="after"
icon={<SvgJoyTokenMonochrome16 />}
/>
)}
</Detail>

<Detail title="YOUR TOKENS">
Expand Down

0 comments on commit 0fc9ca8

Please sign in to comment.