From aba6e081c90bc225b8a787c941458e62320a9e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nandy=20B=C3=A2?= Date: Thu, 19 Dec 2024 00:40:52 +0100 Subject: [PATCH] update preprod with filter unchecked fix and preprod branch protection (#105) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Revert "Master" * merge preprod <> master (#67) * add dropdown * simplify selector and add all token option * feat: change allPage value to Infinity * feat: estimate the fully rented rent * feat: add fully rented estimation to asset cards * refactor: move hook calls to top of the page * fix: propInfo definition * fix: last rent condition * feat: add estimation for property with not fully rented history * feat: get fully rented APR * apply max APR method * rename variable and functions * feat: add RWA token * feat: re-enable property onClick * feat: add rwa valuation on the rwa card * fix: missing property * feat: add rwa to summary card * define useRWA * take into account user currency * feat: add RWA value to net value calculation * remove comment * refactor: clean imports * feat: include RWA on Ethereum * fix: en communs * feat: update filter to support RWA token * fix: prettier * fix: other prettier errors * let prettier add strange semi-column * fix: imports * use hook * add fallback * switch for a useMemo * feat: add real time fully rented APR * feat: add gloabl metric fully rented APR * feat: add disclaimer * feat: add disclaimer * feat: update disclaimer message * fix: disclaimer message * improve message * feat: create yam statics stics page * feat: add yam statistics for all RealT Tokens on Gnosis (who have Gnosis chain contract prop) * feat: mask tokens with no volume * fix: add token name * feat: add pagination * feat: improve style * feat: change token per page to 100 * feat: add fully rented APR to asset grid * refactor: remove logs * feat: add fully rented APR to property details * fix: reset current page when tokens changed * fix: reset current page when user change page size * feat: add translation for YAM statistics hearder label * fix: yamStatistics: use selected currency for token price * feat: yamStatistics: add owned | all filter * feat: yamStatistics: add subsidized, fullySubsidized and notSubsidized filters * add additional fallbacks RPC URLs * fix: RPC initialization on currencies file --------- Co-authored-by: Nandy Bâ * merge preprod <> master (#77) * add dropdown * simplify selector and add all token option * feat: change allPage value to Infinity * feat: estimate the fully rented rent * feat: add fully rented estimation to asset cards * refactor: move hook calls to top of the page * fix: propInfo definition * fix: last rent condition * feat: add estimation for property with not fully rented history * feat: get fully rented APR * apply max APR method * rename variable and functions * feat: add RWA token * feat: re-enable property onClick * feat: add rwa valuation on the rwa card * fix: missing property * feat: add rwa to summary card * define useRWA * take into account user currency * feat: add RWA value to net value calculation * remove comment * refactor: clean imports * feat: include RWA on Ethereum * fix: en communs * feat: update filter to support RWA token * fix: prettier * fix: other prettier errors * let prettier add strange semi-column * fix: imports * use hook * add fallback * switch for a useMemo * feat: add real time fully rented APR * feat: add gloabl metric fully rented APR * feat: add disclaimer * feat: add disclaimer * feat: update disclaimer message * fix: disclaimer message * improve message * feat: create yam statics stics page * feat: add yam statistics for all RealT Tokens on Gnosis (who have Gnosis chain contract prop) * feat: mask tokens with no volume * fix: add token name * feat: add pagination * feat: improve style * feat: change token per page to 100 * feat: add fully rented APR to asset grid * refactor: remove logs * feat: add fully rented APR to property details * fix: reset current page when tokens changed * fix: reset current page when user change page size * feat: add translation for YAM statistics hearder label * fix: yamStatistics: use selected currency for token price * feat: yamStatistics: add owned | all filter * feat: yamStatistics: add subsidized, fullySubsidized and notSubsidized filters * add additional fallbacks RPC URLs * fix: RPC initialization on currencies file * feat: YamStatistic: add Yamp Volume's number of days * fix: fullyRentedAPR: fix french disclaimer text * fix: second disclaimer text small error * feat: fullyRentedAPR: manage VEFA properties * refactore: improve comment * feat: show VEFA properties forced fully rented APR only if property do not have tenants * fix: RWA table view * feat: add bridge link on header (#74) * fix: VEFA Realtime APR --------- Co-authored-by: Nandy Bâ Co-authored-by: Yohann Durand * Revert "merge preprod <> master (#77)" This reverts commit 68daad55434377c91e0224a580528e9a501e392f. * fix: APY fully rented for properties before start rent day (#85) Co-authored-by: alex <123092072+AlexRLT@users.noreply.github.com> * Change NS for RealToken (#89) (#90) * fix: unchecked asset filters (#95) * merge master in develop (#103) * Revert "Master" * merge preprod <> master (#67) * add dropdown * simplify selector and add all token option * feat: change allPage value to Infinity * feat: estimate the fully rented rent * feat: add fully rented estimation to asset cards * refactor: move hook calls to top of the page * fix: propInfo definition * fix: last rent condition * feat: add estimation for property with not fully rented history * feat: get fully rented APR * apply max APR method * rename variable and functions * feat: add RWA token * feat: re-enable property onClick * feat: add rwa valuation on the rwa card * fix: missing property * feat: add rwa to summary card * define useRWA * take into account user currency * feat: add RWA value to net value calculation * remove comment * refactor: clean imports * feat: include RWA on Ethereum * fix: en communs * feat: update filter to support RWA token * fix: prettier * fix: other prettier errors * let prettier add strange semi-column * fix: imports * use hook * add fallback * switch for a useMemo * feat: add real time fully rented APR * feat: add gloabl metric fully rented APR * feat: add disclaimer * feat: add disclaimer * feat: update disclaimer message * fix: disclaimer message * improve message * feat: create yam statics stics page * feat: add yam statistics for all RealT Tokens on Gnosis (who have Gnosis chain contract prop) * feat: mask tokens with no volume * fix: add token name * feat: add pagination * feat: improve style * feat: change token per page to 100 * feat: add fully rented APR to asset grid * refactor: remove logs * feat: add fully rented APR to property details * fix: reset current page when tokens changed * fix: reset current page when user change page size * feat: add translation for YAM statistics hearder label * fix: yamStatistics: use selected currency for token price * feat: yamStatistics: add owned | all filter * feat: yamStatistics: add subsidized, fullySubsidized and notSubsidized filters * add additional fallbacks RPC URLs * fix: RPC initialization on currencies file --------- Co-authored-by: Nandy Bâ * merge preprod <> master (#77) * add dropdown * simplify selector and add all token option * feat: change allPage value to Infinity * feat: estimate the fully rented rent * feat: add fully rented estimation to asset cards * refactor: move hook calls to top of the page * fix: propInfo definition * fix: last rent condition * feat: add estimation for property with not fully rented history * feat: get fully rented APR * apply max APR method * rename variable and functions * feat: add RWA token * feat: re-enable property onClick * feat: add rwa valuation on the rwa card * fix: missing property * feat: add rwa to summary card * define useRWA * take into account user currency * feat: add RWA value to net value calculation * remove comment * refactor: clean imports * feat: include RWA on Ethereum * fix: en communs * feat: update filter to support RWA token * fix: prettier * fix: other prettier errors * let prettier add strange semi-column * fix: imports * use hook * add fallback * switch for a useMemo * feat: add real time fully rented APR * feat: add gloabl metric fully rented APR * feat: add disclaimer * feat: add disclaimer * feat: update disclaimer message * fix: disclaimer message * improve message * feat: create yam statics stics page * feat: add yam statistics for all RealT Tokens on Gnosis (who have Gnosis chain contract prop) * feat: mask tokens with no volume * fix: add token name * feat: add pagination * feat: improve style * feat: change token per page to 100 * feat: add fully rented APR to asset grid * refactor: remove logs * feat: add fully rented APR to property details * fix: reset current page when tokens changed * fix: reset current page when user change page size * feat: add translation for YAM statistics hearder label * fix: yamStatistics: use selected currency for token price * feat: yamStatistics: add owned | all filter * feat: yamStatistics: add subsidized, fullySubsidized and notSubsidized filters * add additional fallbacks RPC URLs * fix: RPC initialization on currencies file * feat: YamStatistic: add Yamp Volume's number of days * fix: fullyRentedAPR: fix french disclaimer text * fix: second disclaimer text small error * feat: fullyRentedAPR: manage VEFA properties * refactore: improve comment * feat: show VEFA properties forced fully rented APR only if property do not have tenants * fix: RWA table view * feat: add bridge link on header (#74) * fix: VEFA Realtime APR --------- Co-authored-by: Nandy Bâ Co-authored-by: Yohann Durand * Revert "merge preprod <> master (#77)" This reverts commit 68daad55434377c91e0224a580528e9a501e392f. * fix: APY fully rented for properties before start rent day (#85) Co-authored-by: alex <123092072+AlexRLT@users.noreply.github.com> * Change NS for RealToken (#89) (#90) --------- Co-authored-by: Sigri Co-authored-by: Kurtisone <104103601+Kurtisone@users.noreply.github.com> Co-authored-by: jycssu-com <110905167+jycssu-com@users.noreply.github.com> Co-authored-by: alex <123092072+AlexRLT@users.noreply.github.com> Co-authored-by: Jycssu Co-authored-by: Yohann Durand * feat: restrict merges to preprod (#104) --------- Co-authored-by: Sigri Co-authored-by: Kurtisone <104103601+Kurtisone@users.noreply.github.com> Co-authored-by: jycssu-com <110905167+jycssu-com@users.noreply.github.com> Co-authored-by: alex <123092072+AlexRLT@users.noreply.github.com> Co-authored-by: Jycssu Co-authored-by: Yohann Durand --- .github/workflows/branch-check-preprod.yml | 17 +++++++++++++++++ .../filters/AssetsViewRentStatusFilter.tsx | 7 ++++++- .../filters/AssetsViewRmmStatusFilter.tsx | 8 +++++++- .../assetsView/filters/AssetsViewSort.tsx | 7 ++++++- .../filters/AssetsViewSubsidyFilter.tsx | 8 +++++++- .../filters/AssetsViewUserProtocolFilter.tsx | 7 ++++++- .../filters/AssetsViewUserStatusFilter.tsx | 7 ++++++- src/hooks/useFullyRentedAPR.ts | 2 +- 8 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/branch-check-preprod.yml diff --git a/.github/workflows/branch-check-preprod.yml b/.github/workflows/branch-check-preprod.yml new file mode 100644 index 00000000..f743b6c9 --- /dev/null +++ b/.github/workflows/branch-check-preprod.yml @@ -0,0 +1,17 @@ +name: Restrict merges to preprod + +on: + pull_request: + branches: + - preprod + +jobs: + check-branch: + runs-on: ubuntu-latest + steps: + - name: Check if the source branch is develop + run: | + if [ "${{ github.event.pull_request.head.ref }}" != "develop" ]; then + echo "Pull requests to preprod must come from develop branch." + exit 1 + fi diff --git a/src/components/assetsView/filters/AssetsViewRentStatusFilter.tsx b/src/components/assetsView/filters/AssetsViewRentStatusFilter.tsx index fe905d9b..d40b18db 100644 --- a/src/components/assetsView/filters/AssetsViewRentStatusFilter.tsx +++ b/src/components/assetsView/filters/AssetsViewRentStatusFilter.tsx @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next' import { Select } from '@mantine/core' +import { assetsViewDefaultFilter } from 'src/states' import { OtherRealtoken, UserRealtoken, @@ -50,7 +51,11 @@ export const AssetsViewRentStatusFilter: FC< data={viewOptions} value={filter.rentStatus} onChange={(value) => - onChange({ rentStatus: value as AssetRentStatusType }) + onChange({ + rentStatus: + (value as AssetRentStatusType) ?? + assetsViewDefaultFilter.rentStatus, + }) } classNames={inputClasses} /> diff --git a/src/components/assetsView/filters/AssetsViewRmmStatusFilter.tsx b/src/components/assetsView/filters/AssetsViewRmmStatusFilter.tsx index aa68f88f..adc05b69 100644 --- a/src/components/assetsView/filters/AssetsViewRmmStatusFilter.tsx +++ b/src/components/assetsView/filters/AssetsViewRmmStatusFilter.tsx @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next' import { Select } from '@mantine/core' +import { assetsViewDefaultFilter } from 'src/states' import { OtherRealtoken, UserRealtoken, @@ -46,7 +47,12 @@ export const AssetsViewRmmStatusFilter: FC = ({ label={t('label')} data={viewOptions} value={filter.rmmStatus} - onChange={(value) => onChange({ rmmStatus: value as AssetRmmStatusType })} + onChange={(value) => + onChange({ + rmmStatus: + (value as AssetRmmStatusType) ?? assetsViewDefaultFilter.rmmStatus, + }) + } classNames={inputClasses} /> ) diff --git a/src/components/assetsView/filters/AssetsViewSort.tsx b/src/components/assetsView/filters/AssetsViewSort.tsx index b4fa4506..c4e4e762 100644 --- a/src/components/assetsView/filters/AssetsViewSort.tsx +++ b/src/components/assetsView/filters/AssetsViewSort.tsx @@ -4,6 +4,7 @@ import { useSelector } from 'react-redux' import { Grid, Select, Switch } from '@mantine/core' +import { assetsViewDefaultFilter } from 'src/states' import { selectTransfersIsLoaded } from 'src/store/features/transfers/transfersSelector' import { OtherRealtoken, @@ -73,7 +74,11 @@ export const AssetsViewSort: FC = ({ data={sortOptions} value={filter.sortBy} onChange={(value) => - onChange({ ...filter, sortBy: value as AssetSortType }) + onChange({ + ...filter, + sortBy: + (value as AssetSortType) ?? assetsViewDefaultFilter.sortBy, + }) } classNames={inputClasses} /> diff --git a/src/components/assetsView/filters/AssetsViewSubsidyFilter.tsx b/src/components/assetsView/filters/AssetsViewSubsidyFilter.tsx index 92aed5e6..1d2270cf 100644 --- a/src/components/assetsView/filters/AssetsViewSubsidyFilter.tsx +++ b/src/components/assetsView/filters/AssetsViewSubsidyFilter.tsx @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next' import { Select } from '@mantine/core' +import { assetsViewDefaultFilter } from 'src/states' import { OtherRealtoken, UserRealtoken, @@ -66,7 +67,12 @@ export const AssetsViewSubsidyFilter: FC = ({ label={t('label')} data={viewOptions} value={filter.subsidy} - onChange={(value) => onChange({ subsidy: value as AssetSubsidyType })} + onChange={(value) => + onChange({ + subsidy: + (value as AssetSubsidyType) ?? assetsViewDefaultFilter.subsidy, + }) + } classNames={inputClasses} /> ) diff --git a/src/components/assetsView/filters/AssetsViewUserProtocolFilter.tsx b/src/components/assetsView/filters/AssetsViewUserProtocolFilter.tsx index 533880e5..8c56e6d8 100644 --- a/src/components/assetsView/filters/AssetsViewUserProtocolFilter.tsx +++ b/src/components/assetsView/filters/AssetsViewUserProtocolFilter.tsx @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next' import { Select } from '@mantine/core' +import { assetsViewDefaultFilter } from 'src/states' import { OtherRealtoken, UserRealtoken, @@ -54,7 +55,11 @@ export const AssetsViewUserProtocolFilter: FC< data={viewOptions} value={filter.userProtocol} onChange={(value) => - onChange({ userProtocol: value as AssetUserProtocolType }) + onChange({ + userProtocol: + (value as AssetUserProtocolType) ?? + assetsViewDefaultFilter.userProtocol, + }) } classNames={inputClasses} /> diff --git a/src/components/assetsView/filters/AssetsViewUserStatusFilter.tsx b/src/components/assetsView/filters/AssetsViewUserStatusFilter.tsx index fd30fcf1..c85e7ae1 100644 --- a/src/components/assetsView/filters/AssetsViewUserStatusFilter.tsx +++ b/src/components/assetsView/filters/AssetsViewUserStatusFilter.tsx @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next' import { Select } from '@mantine/core' +import { assetsViewDefaultFilter } from 'src/states' import { OtherRealtoken, UserRealtoken, @@ -58,7 +59,11 @@ export const AssetsViewUserStatusFilter: FC< data={viewOptions} value={filter.userStatus} onChange={(value) => - onChange({ userStatus: value as AssetUserStatusType }) + onChange({ + userStatus: + (value as AssetUserStatusType) ?? + assetsViewDefaultFilter.userStatus, + }) } classNames={inputClasses} /> diff --git a/src/hooks/useFullyRentedAPR.ts b/src/hooks/useFullyRentedAPR.ts index 20454c26..d303399e 100644 --- a/src/hooks/useFullyRentedAPR.ts +++ b/src/hooks/useFullyRentedAPR.ts @@ -19,8 +19,8 @@ const fullyRentedAPREstimation = ( return getVEFAFullRentedAPR(token, rentCalculation) } + // Case of fully rented property if (token.rentedUnits === token.totalUnits) { - // Case of fully rented property return token.annualPercentageYield }