Skip to content

Commit 2f930b5

Browse files
authored
Merge pull request #86 from RealToken-Community/preprod
Merge preprod to master
2 parents ed61a4c + 80f8e5a commit 2f930b5

File tree

9 files changed

+121
-14
lines changed

9 files changed

+121
-14
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "realtoken-dashboard-v2",
3-
"version": "2.3.3",
3+
"version": "2.4.0",
44
"scripts": {
55
"dev": "next dev",
66
"build": "next build",

src/components/assetsView/filters/AssetsViewSort.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export function useAssetsViewSort(filter: AssetsViewSortFilter) {
114114
case AssetSortType.RENT:
115115
return B.amount * B.netRentDayPerToken - A.amount * A.netRentDayPerToken
116116
case AssetSortType.RENT_START:
117-
return B.rentStartDate.date.localeCompare(A.rentStartDate.date)
117+
return B.rentStartDate?.date.localeCompare(A.rentStartDate?.date)
118118
case AssetSortType.NAME:
119119
return A.shortName.localeCompare(b.shortName)
120120
case AssetSortType.SUPPLY:

src/components/assetsView/views/AssetTable.tsx

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const AssetTable: FC<{
3030
{props.realtokens.map((item, index) => {
3131
const isAProperty = item.hasOwnProperty('rentStatus')
3232
if (!isAProperty) {
33-
return <AssetTableRow key={'0'} value={item as UserRealtoken} />
33+
return <RWATableRow key={'0'} value={item as RWARealtoken} />
3434
}
3535
return <AssetTableRow key={index} value={item as UserRealtoken} />
3636
})}
@@ -159,4 +159,62 @@ const AssetTableRow: FC<{ value: UserRealtoken }> = (props) => {
159159
</Table.Tr>
160160
)
161161
}
162+
163+
const RWATableRow: FC<{ value: RWARealtoken }> = (props) => {
164+
const { t } = useTranslation('common', { keyPrefix: 'numbers' })
165+
const transfersIsLoaded = useSelector(selectTransfersIsLoaded)
166+
167+
const { shortName, value, unitPriceCost, amount, totalInvestment } =
168+
props.value
169+
170+
return (
171+
<Table.Tr>
172+
<Table.Td style={{ minWidth: '150px' }}>
173+
<Anchor>{shortName}</Anchor>
174+
</Table.Td>
175+
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
176+
{useCurrencyValue(value)}
177+
</Table.Td>
178+
{transfersIsLoaded ? (
179+
<>
180+
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
181+
{'-'}
182+
</Table.Td>
183+
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
184+
{'-'}
185+
</Table.Td>
186+
</>
187+
) : null}
188+
189+
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
190+
{useCurrencyValue(unitPriceCost)}
191+
</Table.Td>
192+
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
193+
{t('decimal', { value: amount })}
194+
</Table.Td>
195+
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
196+
{'-'}
197+
</Table.Td>
198+
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
199+
{'-'}
200+
</Table.Td>
201+
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
202+
{'-'}
203+
</Table.Td>
204+
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
205+
{'-'}
206+
</Table.Td>
207+
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
208+
{'-'}
209+
</Table.Td>
210+
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
211+
{useCurrencyValue(totalInvestment)}
212+
</Table.Td>
213+
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
214+
{'-'}
215+
</Table.Td>
216+
</Table.Tr>
217+
)
218+
}
219+
162220
AssetTableRow.displayName = 'AssetTableRow'

src/components/layouts/Header.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@ export const Header: FC = () => {
113113
label={t('YAM')}
114114
leftSection={<IconExternalLink size={'1rem'} stroke={1.5} />}
115115
/>
116+
<NavLink
117+
component={'a'}
118+
href={'https://bridge.realtoken.network/'}
119+
target={'_blank'}
120+
label={t('Bridge')}
121+
leftSection={<IconExternalLink size={'1rem'} stroke={1.5} />}
122+
/>
116123
</Drawer>
117124
<div>
118125
<Box className={styles.container}>

src/hooks/useFullyRentedAPR.ts

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ import {
1010
RentCalculationState,
1111
} from 'src/types/RentCalculation'
1212

13-
const fullyRentedAPREstimation = (token: UserRealtoken) => {
13+
const fullyRentedAPREstimation = (
14+
token: UserRealtoken,
15+
rentCalculation: RentCalculation,
16+
) => {
17+
// VEFA properties
18+
if (isVEFA(token)) {
19+
return getVEFAFullRentedAPR(token, rentCalculation)
20+
}
21+
1422
// Case of fully rented property
1523
if (token.rentedUnits === token.totalUnits) {
1624
return token.annualPercentageYield
@@ -59,7 +67,7 @@ export const useFullyRentedAPR = (token: UserRealtoken) => {
5967
const fullyRentedAPR = useMemo(() => {
6068
const isDisabled = APRDisabled(rentCalculation, token)
6169
if (isDisabled) return 0
62-
return fullyRentedAPREstimation(token)
70+
return fullyRentedAPREstimation(token, rentCalculation)
6371
}, [token, rentCalculation])
6472

6573
return fullyRentedAPR
@@ -70,14 +78,16 @@ export const useGeneralFullyRentedAPR = (tokens: UserRealtoken[]) => {
7078
// Fully rented APR average using valuation ponderation
7179
const fullyRentedAPR = useMemo(() => {
7280
const totalValue = tokens.reduce((acc, token) => {
73-
const isDisabled = APRDisabled(rentCalculation, token)
81+
const isDisabled = APRDisabled(rentCalculation, token) && !isVEFA(token)
7482
if (isDisabled) return acc
7583
return acc + token.value
7684
}, 0)
7785
const totalAPR = tokens.reduce((acc, token) => {
78-
const isDisabled = APRDisabled(rentCalculation, token)
86+
const isDisabled = APRDisabled(rentCalculation, token) && !isVEFA(token)
7987
if (isDisabled) return acc
80-
return acc + token.value * fullyRentedAPREstimation(token)
88+
return (
89+
acc + token.value * fullyRentedAPREstimation(token, rentCalculation)
90+
)
8191
}, 0)
8292
return totalAPR / totalValue
8393
}, [tokens, rentCalculation])
@@ -96,3 +106,33 @@ const APRDisabled = (
96106
rentStartDate > realtimeDate.toDate()
97107
return isDisabled
98108
}
109+
110+
export const isVEFA = (token: UserRealtoken) => {
111+
return (
112+
token.shortName === 'Playa Caracol Cottage 10' ||
113+
token.shortName === 'Playa Caracol 303300 E' ||
114+
token.shortName === 'Playa Caracol 303200 E' ||
115+
token.shortName === 'PH Pinoalto A002' ||
116+
token.shortName === 'PH Pinoalto A003' ||
117+
token.shortName === 'Vervana T1 '
118+
)
119+
}
120+
121+
const VEFAAPRs = {
122+
'Playa Caracol Cottage 10': 10.77,
123+
'Playa Caracol 303300 E': 10.69,
124+
'Playa Caracol 303200 E': 10.8,
125+
'PH Pinoalto A002': 10.11,
126+
'PH Pinoalto A003': 10.11,
127+
'Vervana T1 ': 11.33,
128+
}
129+
130+
const getVEFAFullRentedAPR = (
131+
token: UserRealtoken,
132+
rentCalculation: RentCalculation,
133+
) => {
134+
if (rentCalculation.state === RentCalculationState.Realtime) {
135+
return token.annualPercentageYield
136+
}
137+
return VEFAAPRs[token.shortName as keyof typeof VEFAAPRs]
138+
}

src/i18next/locales/en/common.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"home": "Home",
99
"realt": "RealT",
1010
"RMM": "RMM",
11-
"YAM": "YAM"
11+
"YAM": "YAM",
12+
"Bridge": "Bridge"
1213
},
1314
"settings": {
1415
"title": "Language",

src/i18next/locales/fr/common.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"home": "Accueil",
99
"realt": "RealT",
1010
"RMM": "RMM",
11-
"YAM": "YAM"
11+
"YAM": "YAM",
12+
"Bridge": "Bridge"
1213
},
1314
"settings": {
1415
"title": "Langue",
@@ -395,6 +396,6 @@
395396
"description": "Récupération de vos transactions en cours. Ce chargement peut prendre un certain temps en fonction du nombre de transactions effecutées (10-20 secondes / 1000 transactions). Lors de vos prochaines visites, seul les nouvelles transactions seront récupérées."
396397
},
397398
"disclaimer":{
398-
"fullyRentedAPR": "Cette estimation est en phase bêta et a été développée par la communauté RealT. Nous vous invitons à signaler tout problème éventuel. Les informations fournies sont à titre indicatif uniquement. La communauté RealT ou RealT ne peut être tenu responsable en cas de décision prise à partir de données inexactites."
399+
"fullyRentedAPR": "Cette estimation est en phase bêta et a été développée par la communauté RealT. Nous vous invitons à signaler tout problème éventuel. Les informations fournies sont à titre indicatif uniquement. La communauté RealT ou RealT ne peut être tenue responsable en cas de décision prise à partir de données inexactes."
399400
}
400401
}

src/pages/yamStatistics.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const YamStatisticsPage = () => {
146146
<th>Token Price</th>
147147
<th>Yam Price</th>
148148
<th>Yam Difference (30 days)</th>
149-
<th>Yam Volume</th>
149+
<th>Yam Volume (30 days)</th>
150150
</tr>
151151
{paginationYamStatistics.map((statistics, index) => (
152152
<YamStatisticsRow

0 commit comments

Comments
 (0)