diff --git a/package-lock.json b/package-lock.json index 947f4e6..1742925 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "realtoken-dashboard-v2", - "version": "2.3.3", + "version": "2.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "realtoken-dashboard-v2", - "version": "2.3.3", + "version": "2.4.0", "dependencies": { "@apollo/client": "^3.9.5", "@mantine/core": "^7.5.3", diff --git a/package.json b/package.json index 2ecc65b..f146668 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "realtoken-dashboard-v2", - "version": "2.3.3", + "version": "2.4.0", "scripts": { "dev": "next dev", "build": "next build", diff --git a/src/components/assetsView/filters/AssetsViewSort.tsx b/src/components/assetsView/filters/AssetsViewSort.tsx index 08f5a6c..fe73051 100644 --- a/src/components/assetsView/filters/AssetsViewSort.tsx +++ b/src/components/assetsView/filters/AssetsViewSort.tsx @@ -114,7 +114,7 @@ export function useAssetsViewSort(filter: AssetsViewSortFilter) { case AssetSortType.RENT: return B.amount * B.netRentDayPerToken - A.amount * A.netRentDayPerToken case AssetSortType.RENT_START: - return B.rentStartDate.date.localeCompare(A.rentStartDate.date) + return B.rentStartDate?.date.localeCompare(A.rentStartDate?.date) case AssetSortType.NAME: return A.shortName.localeCompare(b.shortName) case AssetSortType.SUPPLY: diff --git a/src/components/assetsView/views/AssetTable.tsx b/src/components/assetsView/views/AssetTable.tsx index f125cc5..3efd274 100644 --- a/src/components/assetsView/views/AssetTable.tsx +++ b/src/components/assetsView/views/AssetTable.tsx @@ -30,7 +30,7 @@ export const AssetTable: FC<{ {props.realtokens.map((item, index) => { const isAProperty = item.hasOwnProperty('rentStatus') if (!isAProperty) { - return + return } return })} @@ -159,4 +159,62 @@ const AssetTableRow: FC<{ value: UserRealtoken }> = (props) => { ) } + +const RWATableRow: FC<{ value: RWARealtoken }> = (props) => { + const { t } = useTranslation('common', { keyPrefix: 'numbers' }) + const transfersIsLoaded = useSelector(selectTransfersIsLoaded) + + const { shortName, value, unitPriceCost, amount, totalInvestment } = + props.value + + return ( + + + {shortName} + + + {useCurrencyValue(value)} + + {transfersIsLoaded ? ( + <> + + {'-'} + + + {'-'} + + + ) : null} + + + {useCurrencyValue(unitPriceCost)} + + + {t('decimal', { value: amount })} + + + {'-'} + + + {'-'} + + + {'-'} + + + {'-'} + + + {'-'} + + + {useCurrencyValue(totalInvestment)} + + + {'-'} + + + ) +} + AssetTableRow.displayName = 'AssetTableRow' diff --git a/src/components/layouts/Header.tsx b/src/components/layouts/Header.tsx index c76fc3c..4c1a465 100644 --- a/src/components/layouts/Header.tsx +++ b/src/components/layouts/Header.tsx @@ -113,6 +113,13 @@ export const Header: FC = () => { label={t('YAM')} leftSection={} /> + } + />
diff --git a/src/hooks/useFullyRentedAPR.ts b/src/hooks/useFullyRentedAPR.ts index 08f166a..d303399 100644 --- a/src/hooks/useFullyRentedAPR.ts +++ b/src/hooks/useFullyRentedAPR.ts @@ -10,7 +10,15 @@ import { RentCalculationState, } from 'src/types/RentCalculation' -const fullyRentedAPREstimation = (token: UserRealtoken) => { +const fullyRentedAPREstimation = ( + token: UserRealtoken, + rentCalculation: RentCalculation, +) => { + // VEFA properties + if (isVEFA(token)) { + return getVEFAFullRentedAPR(token, rentCalculation) + } + // Case of fully rented property if (token.rentedUnits === token.totalUnits) { return token.annualPercentageYield @@ -59,7 +67,7 @@ export const useFullyRentedAPR = (token: UserRealtoken) => { const fullyRentedAPR = useMemo(() => { const isDisabled = APRDisabled(rentCalculation, token) if (isDisabled) return 0 - return fullyRentedAPREstimation(token) + return fullyRentedAPREstimation(token, rentCalculation) }, [token, rentCalculation]) return fullyRentedAPR @@ -70,14 +78,16 @@ export const useGeneralFullyRentedAPR = (tokens: UserRealtoken[]) => { // Fully rented APR average using valuation ponderation const fullyRentedAPR = useMemo(() => { const totalValue = tokens.reduce((acc, token) => { - const isDisabled = APRDisabled(rentCalculation, token) + const isDisabled = APRDisabled(rentCalculation, token) && !isVEFA(token) if (isDisabled) return acc return acc + token.value }, 0) const totalAPR = tokens.reduce((acc, token) => { - const isDisabled = APRDisabled(rentCalculation, token) + const isDisabled = APRDisabled(rentCalculation, token) && !isVEFA(token) if (isDisabled) return acc - return acc + token.value * fullyRentedAPREstimation(token) + return ( + acc + token.value * fullyRentedAPREstimation(token, rentCalculation) + ) }, 0) return totalAPR / totalValue }, [tokens, rentCalculation]) @@ -96,3 +106,33 @@ const APRDisabled = ( rentStartDate > realtimeDate.toDate() return isDisabled } + +export const isVEFA = (token: UserRealtoken) => { + return ( + token.shortName === 'Playa Caracol Cottage 10' || + token.shortName === 'Playa Caracol 303300 E' || + token.shortName === 'Playa Caracol 303200 E' || + token.shortName === 'PH Pinoalto A002' || + token.shortName === 'PH Pinoalto A003' || + token.shortName === 'Vervana T1 ' + ) +} + +const VEFAAPRs = { + 'Playa Caracol Cottage 10': 10.77, + 'Playa Caracol 303300 E': 10.69, + 'Playa Caracol 303200 E': 10.8, + 'PH Pinoalto A002': 10.11, + 'PH Pinoalto A003': 10.11, + 'Vervana T1 ': 11.33, +} + +const getVEFAFullRentedAPR = ( + token: UserRealtoken, + rentCalculation: RentCalculation, +) => { + if (rentCalculation.state === RentCalculationState.Realtime) { + return token.annualPercentageYield + } + return VEFAAPRs[token.shortName as keyof typeof VEFAAPRs] +} diff --git a/src/i18next/locales/en/common.json b/src/i18next/locales/en/common.json index 32ee90b..3f7f755 100644 --- a/src/i18next/locales/en/common.json +++ b/src/i18next/locales/en/common.json @@ -8,7 +8,8 @@ "home": "Home", "realt": "RealT", "RMM": "RMM", - "YAM": "YAM" + "YAM": "YAM", + "Bridge": "Bridge" }, "settings": { "title": "Language", diff --git a/src/i18next/locales/fr/common.json b/src/i18next/locales/fr/common.json index 096f2d4..e05985a 100644 --- a/src/i18next/locales/fr/common.json +++ b/src/i18next/locales/fr/common.json @@ -8,7 +8,8 @@ "home": "Accueil", "realt": "RealT", "RMM": "RMM", - "YAM": "YAM" + "YAM": "YAM", + "Bridge": "Bridge" }, "settings": { "title": "Langue", @@ -395,6 +396,6 @@ "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." }, "disclaimer":{ - "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." + "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." } } diff --git a/src/pages/yamStatistics.tsx b/src/pages/yamStatistics.tsx index dba6596..5b6ce7a 100644 --- a/src/pages/yamStatistics.tsx +++ b/src/pages/yamStatistics.tsx @@ -146,7 +146,7 @@ const YamStatisticsPage = () => { Token Price Yam Price Yam Difference (30 days) - Yam Volume + Yam Volume (30 days) {paginationYamStatistics.map((statistics, index) => (