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 33f59da..7026af6 100644 --- a/src/hooks/useFullyRentedAPR.ts +++ b/src/hooks/useFullyRentedAPR.ts @@ -12,17 +12,9 @@ import { const fullyRentedAPREstimation = (token: UserRealtoken) => { // VEFA properties - if (token.shortName === 'Playa Caracol Cottage 10' && !token.hasTenants) - return 10.77 - else if (token.shortName === 'Playa Caracol 303300' && !token.hasTenants) - return 10.69 - else if (token.shortName === 'Playa Caracol 303200' && !token.hasTenants) - return 10.8 - else if (token.shortName === 'PH Pinoalto A002' && !token.hasTenants) - return 10.11 - else if (token.shortName === 'PH Pinoalto A003' && !token.hasTenants) - return 10.11 - else if (token.shortName === 'Vervana T1 ' && !token.hasTenants) return 11.33 + if (isVEFA(token)) { + return VEFAAPRs[token.shortName as keyof typeof VEFAAPRs] + } if (token.rentedUnits === token.totalUnits) { // Case of fully rented property @@ -71,7 +63,7 @@ export const useFullyRentedAPR = (token: UserRealtoken) => { const fullyRentedAPR = useMemo(() => { const isDisabled = APRDisabled(rentCalculation, token) - if (isDisabled) return 0 + if (isDisabled && !isVEFA(token)) return 0 return fullyRentedAPREstimation(token) }, [token, rentCalculation]) @@ -83,12 +75,12 @@ 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) }, 0) @@ -109,3 +101,23 @@ const APRDisabled = ( rentStartDate > realtimeDate.toDate() return isDisabled } + +export const isVEFA = (token: UserRealtoken) => { + return ( + token.shortName === 'Playa Caracol Cottage 10' || + token.shortName === 'Playa Caracol 303300' || + token.shortName === 'Playa Caracol 303200' || + 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': 10.69, + 'Playa Caracol 303200': 10.8, + 'PH Pinoalto A002': 10.11, + 'PH Pinoalto A003': 10.11, + 'Vervana T1 ': 11.33, +} 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 5e1a0f4..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",