diff --git a/.github/workflows/branch-check-preprod.yml b/.github/workflows/branch-check-preprod.yml new file mode 100644 index 0000000..f743b6c --- /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 fe905d9..d40b18d 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 aa68f88..adc05b6 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 b4fa450..c4e4e76 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 92aed5e..1d2270c 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 533880e..8c56e6d 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 fd30fcf..c85e7ae 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 20454c2..d303399 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 }