Skip to content

Commit

Permalink
feat: add fully rented APR to asset grid
Browse files Browse the repository at this point in the history
  • Loading branch information
NandyBa committed Aug 17, 2024
1 parent 553a319 commit 94102b8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/components/assetsView/views/AssetTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Anchor, ScrollArea, Table } from '@mantine/core'
import moment from 'moment'

import { useCurrencyValue } from 'src/hooks/useCurrencyValue'
import { useFullyRentedAPR } from 'src/hooks/useFullyRentedAPR'
import { selectTransfersIsLoaded } from 'src/store/features/transfers/transfersSelector'
import {
RWARealtoken,
Expand Down Expand Up @@ -62,6 +63,7 @@ const AssetTableHeader: FC = () => {
) : null}
<Table.Th style={{ textAlign: 'right' }}>{t('ownedTokens')}</Table.Th>
<Table.Th style={{ textAlign: 'right' }}>{t('apr')}</Table.Th>
<Table.Th style={{ textAlign: 'right' }}>{t('fullyRentedAPR')}</Table.Th>
<Table.Th style={{ textAlign: 'right' }}>{t('weeklyRents')}</Table.Th>
<Table.Th style={{ textAlign: 'right' }}>{t('yearlyRents')}</Table.Th>
<Table.Th style={{ textAlign: 'right' }}>{t('rentedUnits')}</Table.Th>
Expand All @@ -85,6 +87,10 @@ const AssetTableRow: FC<{ value: UserRealtoken }> = (props) => {
const weeklyAmount = props.value.amount * props.value.netRentDayPerToken * 7
const yearlyAmount = props.value.amount * props.value.netRentYearPerToken
const totalInvestment = props.value.totalInvestment
const isAProperty = props.value.hasOwnProperty('rentStatus')
const fullyRentedAPR = isAProperty
? useFullyRentedAPR(props.value as UserRealtoken)
: null

return (
<Table.Tr>
Expand Down Expand Up @@ -121,6 +127,13 @@ const AssetTableRow: FC<{ value: UserRealtoken }> = (props) => {
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
{t('percent', { value: props.value.annualPercentageYield })}
</Table.Td>
{isAProperty ? (
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
{t('percent', { value: fullyRentedAPR })}
</Table.Td>
) : (
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }} />
)}
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
{useCurrencyValue(weeklyAmount)}
</Table.Td>
Expand Down
1 change: 1 addition & 0 deletions src/i18next/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
"unitPriceCost": "Unit price cost",
"unrealizedCapitalGain": "Capital gain",
"apr": "Yield",
"fullyRentedAPR":"Fully rented APR *",
"weeklyRents": "Weekly rents",
"yearlyRents": "Yearly rents",
"rentedUnits": "Rented units",
Expand Down
1 change: 1 addition & 0 deletions src/i18next/locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
"tokenPrice": "Prix du token",
"unitPriceCost": "Prix de revient",
"apr": "Rendement annuel",
"fullyRentedAPR":"Rendement 100% loué *",
"weeklyRents": "Loyer hebdo",
"yearlyRents": "Loyer annuel",
"rentedUnits": "Logements loués",
Expand Down

0 comments on commit 94102b8

Please sign in to comment.