From 2035fab598c343e3c3be48b3f7edd7c5787dacf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Miko=C5=82ajczyk?= Date: Tue, 24 Sep 2024 16:11:56 +0200 Subject: [PATCH] oct-1971: client refactor 1 --- .../Allocation/AllocationItem/types.ts | 9 +- .../AllocationNavigation.tsx | 4 +- .../AllocationSliderBox.tsx | 2 +- .../EarnBoxGlmLock/EarnBoxGlmLock.module.scss | 17 - .../Earn/EarnBoxGlmLock/EarnBoxGlmLock.tsx | 141 ------- .../components/Earn/EarnBoxGlmLock/types.ts | 3 - .../EarnBoxPersonalAllocation.module.scss | 15 - .../EarnBoxPersonalAllocation.tsx | 162 -------- .../Earn/EarnBoxPersonalAllocation/index.tsx | 2 - .../Earn/EarnBoxPersonalAllocation/types.ts | 3 - .../Earn/EarnGlmLock/EarnGlmLock.module.scss | 10 - .../Earn/EarnGlmLock/EarnGlmLock.tsx | 249 ------------ .../EarnGlmLockBudget.module.scss | 3 - .../EarnGlmLockBudget/EarnGlmLockBudget.tsx | 26 -- .../EarnGlmLock/EarnGlmLockBudget/index.tsx | 2 - .../EarnGlmLock/EarnGlmLockBudget/types.ts | 3 - .../EarnGlmLockBudgetBox.module.scss | 65 --- .../EarnGlmLockBudgetBox.tsx | 73 ---- .../EarnGlmLockBudgetBox/index.tsx | 2 - .../EarnGlmLock/EarnGlmLockBudgetBox/types.ts | 5 - .../EarnGlmLockNotification.module.scss | 35 -- .../EarnGlmLockNotification.tsx | 96 ----- .../EarnGlmLockNotification/index.tsx | 2 - .../EarnGlmLockNotification/types.ts | 9 - .../EarnGlmLockStepper/EarnGlmLockStepper.tsx | 32 -- .../EarnGlmLock/EarnGlmLockStepper/index.tsx | 2 - .../EarnGlmLock/EarnGlmLockStepper/types.ts | 7 - .../EarnGlmLockTabs.module.scss | 52 --- .../EarnGlmLockTabs/EarnGlmLockTabs.tsx | 177 -------- .../EarnGlmLock/EarnGlmLockTabs/index.tsx | 2 - .../Earn/EarnGlmLock/EarnGlmLockTabs/types.ts | 18 - .../EarnGlmLockTabsInputs.module.scss | 19 - .../EarnGlmLockTabsInputs.tsx | 149 ------- .../EarnGlmLockTabsInputs/index.tsx | 2 - .../EarnGlmLockTabsInputs/types.ts | 20 - .../src/components/Earn/EarnGlmLock/types.ts | 24 -- .../src/components/Earn/EarnGlmLock/utils.ts | 41 -- .../Earn/EarnHistory/EarnHistory.module.scss | 43 -- .../Earn/EarnHistory/EarnHistory.tsx | 73 ---- .../EarnHistoryItem.module.scss | 41 -- .../EarnHistoryItem/EarnHistoryItem.tsx | 103 ----- .../EarnHistory/EarnHistoryItem/index.tsx | 2 - .../Earn/EarnHistory/EarnHistoryItem/types.ts | 13 - .../EarnHistoryItemDateAndTime.module.scss | 3 - .../EarnHistoryItemDateAndTime.tsx | 11 - .../EarnHistoryItemDateAndTime/index.tsx | 2 - .../EarnHistoryItemDateAndTime/types.ts | 3 - .../EarnHistoryItemDateAndTime/utils.ts | 6 - .../EarnHistoryItemDetails.tsx | 15 - ...rnHistoryItemDetailsAllocation.module.scss | 22 - .../EarnHistoryItemDetailsAllocation.tsx | 152 ------- .../index.tsx | 2 - .../EarnHistoryItemDetailsAllocation/types.ts | 8 - .../EarnHistoryItemDetailsRest.module.scss | 8 - .../EarnHistoryItemDetailsRest.tsx | 92 ----- .../EarnHistoryItemDetailsRest/index.tsx | 2 - .../EarnHistoryItemDetailsRest/types.ts | 5 - .../EarnHistoryItemDetails/index.tsx | 2 - .../EarnHistoryItemDetails/types.ts | 5 - .../EarnHistoryItemDetailsModal.tsx | 50 --- .../EarnHistoryItemDetailsModal/index.tsx | 2 - .../EarnHistoryItemDetailsModal/types.ts | 6 - .../EarnHistoryList.module.scss | 10 - .../EarnHistoryList/EarnHistoryList.tsx | 26 -- .../EarnHistory/EarnHistoryList/index.tsx | 2 - .../Earn/EarnHistory/EarnHistoryList/types.ts | 5 - .../EarnHistorySkeleton.module.scss | 30 -- .../EarnHistorySkeleton.tsx | 21 - .../EarnHistory/EarnHistorySkeleton/index.tsx | 2 - .../EarnHistoryTransactionLabel.module.scss | 17 - .../EarnHistoryTransactionLabel.tsx | 30 -- .../EarnHistoryTransactionLabel/index.tsx | 2 - .../EarnHistoryTransactionLabel/types.ts | 4 - .../src/components/Earn/EarnHistory/types.ts | 3 - .../EarnRewardsCalculator.module.scss | 3 - .../EarnRewardsCalculator.tsx | 146 ------- ...rdsCalculatorEpochDaysSelector.module.scss | 74 ---- ...EarnRewardsCalculatorEpochDaysSelector.tsx | 58 --- .../index.tsx | 2 - .../types.ts | 4 - ...EarnRewardsCalculatorEstimates.module.scss | 56 --- .../EarnRewardsCalculatorEstimates.tsx | 52 --- .../EarnRewardsCalculatorEstimates/index.tsx | 2 - .../EarnRewardsCalculatorEstimates/types.ts | 7 - ...arnRewardsCalculatorUqSelector.module.scss | 63 --- .../EarnRewardsCalculatorUqSelector.tsx | 56 --- .../EarnRewardsCalculatorUqSelector/index.tsx | 2 - .../EarnRewardsCalculatorUqSelector/types.ts | 4 - .../Earn/EarnRewardsCalculator/index.tsx | 2 - .../Earn/EarnRewardsCalculator/types.ts | 5 - .../EarnTipTiles/EarnTipTiles.module.scss | 27 -- .../Earn/EarnTipTiles/EarnTipTiles.tsx | 115 ------ .../EarnWithdrawEth.module.scss | 20 - .../Earn/EarnWithdrawEth/EarnWithdrawEth.tsx | 101 ----- .../components/Earn/EarnWithdrawEth/index.tsx | 2 - .../components/Earn/EarnWithdrawEth/types.ts | 3 - .../ModalEarnGlmLock/ModalEarnGlmLock.tsx | 29 -- .../Earn/ModalEarnGlmLock/index.tsx | 2 - .../components/Earn/ModalEarnGlmLock/types.ts | 5 - .../ModalEarnRewardsCalculator.module.scss | 21 - .../ModalEarnRewardsCalculator.tsx | 48 --- .../Earn/ModalEarnRewardsCalculator/index.tsx | 2 - .../Earn/ModalEarnRewardsCalculator/types.ts | 5 - .../ModalEarnWithdrawEth.tsx | 21 - .../Earn/ModalEarnWithdrawEth/index.tsx | 2 - .../Earn/ModalEarnWithdrawEth/types.ts | 5 - .../HomeGridCurrentGlmLock.tsx | 2 +- .../HomeGridDonations/HomeGridDonations.tsx | 8 +- .../EpochResultsDetails.tsx | 8 +- .../HomeGridPersonalAllocation.tsx | 2 +- .../WithdrawEth/WithdrawEth.tsx | 2 +- .../HomeGridRewardsEstimator.tsx | 5 +- .../Home/HomeGridRewardsEstimator/types.ts | 6 + .../HomeGridRewardsEstimator}/utils.ts | 0 .../ModalTransactionDetails.tsx | 6 +- .../TransactionDetailsAllocation.tsx | 4 +- .../TransactionDetailsAllocation/types.ts | 4 +- .../TransactionDetailsDateAndTime/types.ts | 2 +- .../TransactionDetailsRest.tsx | 4 +- .../TransactionDetailsRest/types.ts | 4 +- .../TransactionLabel/TransactionLabel.tsx | 4 +- .../TransactionsListItem.tsx | 4 +- .../Home/HomeGridUQScore/HomeGridUQScore.tsx | 2 +- .../Home/HomeRewards/HomeRewards.tsx | 6 +- .../MetricsEpochGridDonationsVsMatching.tsx | 4 +- ...pochGridDonationsVsPersonalAllocations.tsx | 4 +- .../MetricsEpochGridTopProjects.tsx | 10 +- .../ButtonAddToAllocate.tsx | 4 +- .../src/components/shared/Layout/Layout.tsx | 217 +--------- .../LayoutNavbar/LayoutNavbar.module.scss | 3 +- .../shared/ViewTitle/ViewTitle.module.scss | 8 + client/src/constants/store.ts | 1 - client/src/hooks/events/useAllocate.ts | 2 +- .../src/hooks/helpers/useNavigationTabs.tsx | 4 +- .../hooks/mutations/useAllocateSimulate.ts | 2 +- client/src/hooks/utils/utils.ts | 2 +- client/src/locales/en/translation.json | 263 +----------- client/src/routes/RootRoutes/RootRoutes.tsx | 14 +- client/src/routes/RootRoutes/routes.ts | 2 - client/src/styles/utils/_keyframes.scss | 63 ++- client/src/styles/utils/_mixins.scss | 17 - client/src/styles/utils/_variables.scss | 1 - client/src/svg/history.ts | 13 - client/src/svg/misc.ts | 18 - client/src/svg/navigation.ts | 6 - .../AllocationView/AllocationView.module.scss | 28 -- .../AllocationView}/index.tsx | 2 +- client/src/views/AllocationView/types.ts | 21 - client/src/views/AllocationView/utils.test.ts | 379 ------------------ client/src/views/AllocationView/utils.ts | 292 -------------- .../src/views/EarnView/EarnView.module.scss | 38 -- client/src/views/EarnView/EarnView.tsx | 66 --- .../EarnGlmLock => views/HomeView}/index.tsx | 2 +- .../views/MetricsView/MetricsView.module.scss | 22 - client/src/views/MetricsView/MetricsView.tsx | 7 +- .../MetricsView}/index.tsx | 2 +- client/src/views/PlaygroundView/index.tsx | 2 + .../ProjectView}/index.tsx | 2 +- client/src/views/ProjectsView/index.tsx | 2 + client/src/views/SettingsView/index.tsx | 2 + client/src/views/SyncView/index.tsx | 2 + 161 files changed, 140 insertions(+), 4710 deletions(-) delete mode 100644 client/src/components/Earn/EarnBoxGlmLock/EarnBoxGlmLock.module.scss delete mode 100644 client/src/components/Earn/EarnBoxGlmLock/EarnBoxGlmLock.tsx delete mode 100644 client/src/components/Earn/EarnBoxGlmLock/types.ts delete mode 100644 client/src/components/Earn/EarnBoxPersonalAllocation/EarnBoxPersonalAllocation.module.scss delete mode 100644 client/src/components/Earn/EarnBoxPersonalAllocation/EarnBoxPersonalAllocation.tsx delete mode 100644 client/src/components/Earn/EarnBoxPersonalAllocation/index.tsx delete mode 100644 client/src/components/Earn/EarnBoxPersonalAllocation/types.ts delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLock.module.scss delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLock.tsx delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockBudget/EarnGlmLockBudget.module.scss delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockBudget/EarnGlmLockBudget.tsx delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockBudget/index.tsx delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockBudget/types.ts delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockBudgetBox/EarnGlmLockBudgetBox.module.scss delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockBudgetBox/EarnGlmLockBudgetBox.tsx delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockBudgetBox/index.tsx delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockBudgetBox/types.ts delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockNotification/EarnGlmLockNotification.module.scss delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockNotification/EarnGlmLockNotification.tsx delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockNotification/index.tsx delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockNotification/types.ts delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockStepper/EarnGlmLockStepper.tsx delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockStepper/index.tsx delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockStepper/types.ts delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockTabs/EarnGlmLockTabs.module.scss delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockTabs/EarnGlmLockTabs.tsx delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockTabs/index.tsx delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockTabs/types.ts delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockTabsInputs/EarnGlmLockTabsInputs.module.scss delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockTabsInputs/EarnGlmLockTabsInputs.tsx delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockTabsInputs/index.tsx delete mode 100644 client/src/components/Earn/EarnGlmLock/EarnGlmLockTabsInputs/types.ts delete mode 100644 client/src/components/Earn/EarnGlmLock/types.ts delete mode 100644 client/src/components/Earn/EarnGlmLock/utils.ts delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistory.module.scss delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistory.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItem/EarnHistoryItem.module.scss delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItem/EarnHistoryItem.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItem/index.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItem/types.ts delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetails/EarnHistoryItemDateAndTime/EarnHistoryItemDateAndTime.module.scss delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetails/EarnHistoryItemDateAndTime/EarnHistoryItemDateAndTime.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetails/EarnHistoryItemDateAndTime/index.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetails/EarnHistoryItemDateAndTime/types.ts delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetails/EarnHistoryItemDateAndTime/utils.ts delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetails/EarnHistoryItemDetails.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetails/EarnHistoryItemDetailsAllocation/EarnHistoryItemDetailsAllocation.module.scss delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetails/EarnHistoryItemDetailsAllocation/EarnHistoryItemDetailsAllocation.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetails/EarnHistoryItemDetailsAllocation/index.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetails/EarnHistoryItemDetailsAllocation/types.ts delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetails/EarnHistoryItemDetailsRest/EarnHistoryItemDetailsRest.module.scss delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetails/EarnHistoryItemDetailsRest/EarnHistoryItemDetailsRest.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetails/EarnHistoryItemDetailsRest/index.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetails/EarnHistoryItemDetailsRest/types.ts delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetails/index.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetails/types.ts delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetailsModal/EarnHistoryItemDetailsModal.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetailsModal/index.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryItemDetailsModal/types.ts delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryList/EarnHistoryList.module.scss delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryList/EarnHistoryList.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryList/index.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryList/types.ts delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistorySkeleton/EarnHistorySkeleton.module.scss delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistorySkeleton/EarnHistorySkeleton.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistorySkeleton/index.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryTransactionLabel/EarnHistoryTransactionLabel.module.scss delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryTransactionLabel/EarnHistoryTransactionLabel.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryTransactionLabel/index.tsx delete mode 100644 client/src/components/Earn/EarnHistory/EarnHistoryTransactionLabel/types.ts delete mode 100644 client/src/components/Earn/EarnHistory/types.ts delete mode 100644 client/src/components/Earn/EarnRewardsCalculator/EarnRewardsCalculator.module.scss delete mode 100644 client/src/components/Earn/EarnRewardsCalculator/EarnRewardsCalculator.tsx delete mode 100644 client/src/components/Earn/EarnRewardsCalculator/EarnRewardsCalculatorEpochDaysSelector/EarnRewardsCalculatorEpochDaysSelector.module.scss delete mode 100644 client/src/components/Earn/EarnRewardsCalculator/EarnRewardsCalculatorEpochDaysSelector/EarnRewardsCalculatorEpochDaysSelector.tsx delete mode 100644 client/src/components/Earn/EarnRewardsCalculator/EarnRewardsCalculatorEpochDaysSelector/index.tsx delete mode 100644 client/src/components/Earn/EarnRewardsCalculator/EarnRewardsCalculatorEpochDaysSelector/types.ts delete mode 100644 client/src/components/Earn/EarnRewardsCalculator/EarnRewardsCalculatorEstimates/EarnRewardsCalculatorEstimates.module.scss delete mode 100644 client/src/components/Earn/EarnRewardsCalculator/EarnRewardsCalculatorEstimates/EarnRewardsCalculatorEstimates.tsx delete mode 100644 client/src/components/Earn/EarnRewardsCalculator/EarnRewardsCalculatorEstimates/index.tsx delete mode 100644 client/src/components/Earn/EarnRewardsCalculator/EarnRewardsCalculatorEstimates/types.ts delete mode 100644 client/src/components/Earn/EarnRewardsCalculator/EarnRewardsCalculatorUqSelector/EarnRewardsCalculatorUqSelector.module.scss delete mode 100644 client/src/components/Earn/EarnRewardsCalculator/EarnRewardsCalculatorUqSelector/EarnRewardsCalculatorUqSelector.tsx delete mode 100644 client/src/components/Earn/EarnRewardsCalculator/EarnRewardsCalculatorUqSelector/index.tsx delete mode 100644 client/src/components/Earn/EarnRewardsCalculator/EarnRewardsCalculatorUqSelector/types.ts delete mode 100644 client/src/components/Earn/EarnRewardsCalculator/index.tsx delete mode 100644 client/src/components/Earn/EarnRewardsCalculator/types.ts delete mode 100644 client/src/components/Earn/EarnTipTiles/EarnTipTiles.module.scss delete mode 100644 client/src/components/Earn/EarnTipTiles/EarnTipTiles.tsx delete mode 100644 client/src/components/Earn/EarnWithdrawEth/EarnWithdrawEth.module.scss delete mode 100644 client/src/components/Earn/EarnWithdrawEth/EarnWithdrawEth.tsx delete mode 100644 client/src/components/Earn/EarnWithdrawEth/index.tsx delete mode 100644 client/src/components/Earn/EarnWithdrawEth/types.ts delete mode 100644 client/src/components/Earn/ModalEarnGlmLock/ModalEarnGlmLock.tsx delete mode 100644 client/src/components/Earn/ModalEarnGlmLock/index.tsx delete mode 100644 client/src/components/Earn/ModalEarnGlmLock/types.ts delete mode 100644 client/src/components/Earn/ModalEarnRewardsCalculator/ModalEarnRewardsCalculator.module.scss delete mode 100644 client/src/components/Earn/ModalEarnRewardsCalculator/ModalEarnRewardsCalculator.tsx delete mode 100644 client/src/components/Earn/ModalEarnRewardsCalculator/index.tsx delete mode 100644 client/src/components/Earn/ModalEarnRewardsCalculator/types.ts delete mode 100644 client/src/components/Earn/ModalEarnWithdrawEth/ModalEarnWithdrawEth.tsx delete mode 100644 client/src/components/Earn/ModalEarnWithdrawEth/index.tsx delete mode 100644 client/src/components/Earn/ModalEarnWithdrawEth/types.ts rename client/src/components/{Earn/EarnRewardsCalculator => Home/HomeGridRewardsEstimator}/utils.ts (100%) delete mode 100644 client/src/constants/store.ts delete mode 100644 client/src/svg/history.ts delete mode 100644 client/src/views/AllocationView/AllocationView.module.scss rename client/src/{components/Earn/EarnBoxGlmLock => views/AllocationView}/index.tsx (53%) delete mode 100644 client/src/views/AllocationView/types.ts delete mode 100644 client/src/views/AllocationView/utils.test.ts delete mode 100644 client/src/views/AllocationView/utils.ts delete mode 100644 client/src/views/EarnView/EarnView.module.scss delete mode 100644 client/src/views/EarnView/EarnView.tsx rename client/src/{components/Earn/EarnGlmLock => views/HomeView}/index.tsx (54%) delete mode 100644 client/src/views/MetricsView/MetricsView.module.scss rename client/src/{components/Earn/EarnHistory => views/MetricsView}/index.tsx (54%) create mode 100644 client/src/views/PlaygroundView/index.tsx rename client/src/{components/Earn/EarnTipTiles => views/ProjectView}/index.tsx (54%) create mode 100644 client/src/views/ProjectsView/index.tsx create mode 100644 client/src/views/SettingsView/index.tsx create mode 100644 client/src/views/SyncView/index.tsx diff --git a/client/src/components/Allocation/AllocationItem/types.ts b/client/src/components/Allocation/AllocationItem/types.ts index 5811ffcc8..783ad16b4 100644 --- a/client/src/components/Allocation/AllocationItem/types.ts +++ b/client/src/components/Allocation/AllocationItem/types.ts @@ -1,8 +1,8 @@ import React from 'react'; import { LeverageMatched } from 'api/calls/allocate'; +import { AllocationValue } from 'components/Allocation/types'; import { ProjectIpfsWithRewards } from 'hooks/queries/useProjectsIpfsWithRewards'; -import { AllocationValue } from 'views/AllocationView/types'; export interface AllocationItemWithAllocations extends ProjectIpfsWithRewards { isAllocatedTo: boolean; @@ -12,12 +12,7 @@ export interface AllocationItemWithAllocations extends ProjectIpfsWithRewards { export default interface AllocationItemProps extends Omit< AllocationItemWithAllocations, - | 'totalValueOfAllocations' - | 'percentage' - | 'numberOfDonors' - | 'matchedRewards' - | 'donations' - | 'matchingFund' + 'totalValueOfAllocations' | 'percentage' | 'numberOfDonors' | 'matchedRewards' | 'donations' > { className?: string; isError: boolean; diff --git a/client/src/components/Allocation/AllocationNavigation/AllocationNavigation.tsx b/client/src/components/Allocation/AllocationNavigation/AllocationNavigation.tsx index 59f1e962e..abfc9a584 100644 --- a/client/src/components/Allocation/AllocationNavigation/AllocationNavigation.tsx +++ b/client/src/components/Allocation/AllocationNavigation/AllocationNavigation.tsx @@ -15,7 +15,7 @@ const AllocationNavigation: FC = ({ onResetValues, isWaitingForAllMultisigSignatures, }) => { - const { t } = useTranslation('translation', { + const { i18n, t } = useTranslation('translation', { keyPrefix: 'components.dedicated.allocationNavigation', }); @@ -39,7 +39,7 @@ const AllocationNavigation: FC = ({ onClick: onAllocate, } : { - label: t('edit'), + label: i18n.t('common.edit'), onClick: () => setCurrentView('edit'), }; diff --git a/client/src/components/Allocation/AllocationSliderBox/AllocationSliderBox.tsx b/client/src/components/Allocation/AllocationSliderBox/AllocationSliderBox.tsx index c2b5d5569..e369bf39a 100644 --- a/client/src/components/Allocation/AllocationSliderBox/AllocationSliderBox.tsx +++ b/client/src/components/Allocation/AllocationSliderBox/AllocationSliderBox.tsx @@ -80,7 +80,7 @@ const AllocationSliderBox: FC = ({ : 50; const sections = [ { - header: isLocked ? t('donated') : t('donate'), + header: isLocked ? i18n.t('common.donated') : t('donate'), value: getValuesToDisplay({ cryptoCurrency: 'ethereum', showCryptoSuffix: true, diff --git a/client/src/components/Earn/EarnBoxGlmLock/EarnBoxGlmLock.module.scss b/client/src/components/Earn/EarnBoxGlmLock/EarnBoxGlmLock.module.scss deleted file mode 100644 index 2708f078c..000000000 --- a/client/src/components/Earn/EarnBoxGlmLock/EarnBoxGlmLock.module.scss +++ /dev/null @@ -1,17 +0,0 @@ -.tooltip { - width: 10.4rem !important; -} - -.calculateRewards { - display: flex; - align-items: center; - justify-content: center; - width: 3.2rem; - height: 3.2rem; - background: $color-octant-grey8; - border-radius: $border-radius-10; -} - -.effectiveTooltip { - padding: 1.8rem 1.4rem 1.4rem 2.4rem !important; -} diff --git a/client/src/components/Earn/EarnBoxGlmLock/EarnBoxGlmLock.tsx b/client/src/components/Earn/EarnBoxGlmLock/EarnBoxGlmLock.tsx deleted file mode 100644 index c3801b49a..000000000 --- a/client/src/components/Earn/EarnBoxGlmLock/EarnBoxGlmLock.tsx +++ /dev/null @@ -1,141 +0,0 @@ -import _first from 'lodash/first'; -import React, { FC, Fragment, useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { useAccount } from 'wagmi'; - -import ModalEarnGlmLock from 'components/Earn/ModalEarnGlmLock/ModalEarnGlmLock'; -import ModalEarnRewardsCalculator from 'components/Earn/ModalEarnRewardsCalculator'; -import BoxRounded from 'components/ui/BoxRounded'; -import Sections from 'components/ui/BoxRounded/Sections/Sections'; -import { SectionProps } from 'components/ui/BoxRounded/Sections/types'; -import Svg from 'components/ui/Svg'; -import Tooltip from 'components/ui/Tooltip'; -import useCurrentEpoch from 'hooks/queries/useCurrentEpoch'; -import useDepositValue from 'hooks/queries/useDepositValue'; -import useEstimatedEffectiveDeposit from 'hooks/queries/useEstimatedEffectiveDeposit'; -import useTransactionLocalStore from 'store/transactionLocal/store'; -import { calculator } from 'svg/misc'; -import getIsPreLaunch from 'utils/getIsPreLaunch'; - -import styles from './EarnBoxGlmLock.module.scss'; -import EarnBoxGlmLockProps from './types'; - -const EarnBoxGlmLock: FC = ({ classNameBox }) => { - const { t, i18n } = useTranslation('translation', { - keyPrefix: 'components.dedicated.boxGlmLock', - }); - const { isConnected } = useAccount(); - const { isAppWaitingForTransactionToBeIndexed, transactionsPending } = useTransactionLocalStore( - state => ({ - isAppWaitingForTransactionToBeIndexed: state.data.isAppWaitingForTransactionToBeIndexed, - transactionsPending: state.data.transactionsPending, - }), - ); - - const [isModalGlmLockOpen, setIsModalGlmLockOpen] = useState(false); - const { data: estimatedEffectiveDeposit, isFetching: isFetchingEstimatedEffectiveDeposit } = - useEstimatedEffectiveDeposit(); - const [isModalRewardsCalculatorOpen, setIsModalRewardsCalculatorOpen] = useState(false); - const { data: depositsValue, isFetching: isFetchingDepositValue } = useDepositValue(); - const { data: currentEpoch } = useCurrentEpoch(); - - const isPreLaunch = getIsPreLaunch(currentEpoch); - - const sections: SectionProps[] = [ - { - dataTest: 'BoxGlmLock__Section--current', - doubleValueProps: { - cryptoCurrency: 'golem', - dataTest: 'BoxGlmLock__Section--current__DoubleValue', - isFetching: - isFetchingDepositValue || - (isAppWaitingForTransactionToBeIndexed && - _first(transactionsPending)?.type !== 'withdrawal'), - showCryptoSuffix: true, - valueCrypto: depositsValue, - }, - isDisabled: isPreLaunch && !isConnected, - label: t('current'), - }, - { - dataTest: 'BoxGlmLock__Section--effective', - doubleValueProps: { - coinPricesServerDowntimeText: '...', - cryptoCurrency: 'golem', - dataTest: 'BoxGlmLock__Section--effective__DoubleValue', - isFetching: - isFetchingEstimatedEffectiveDeposit || - (isAppWaitingForTransactionToBeIndexed && - _first(transactionsPending)?.type !== 'withdrawal'), - showCryptoSuffix: true, - valueCrypto: estimatedEffectiveDeposit, - }, - isDisabled: isPreLaunch && !isConnected, - label: t('effective'), - tooltipProps: { - dataTest: 'TooltipEffectiveLockedBalance', - position: 'bottom-right', - text: t('tooltipText'), - tooltipClassName: styles.effectiveTooltip, - }, - }, - ]; - - return ( - - setIsModalGlmLockOpen(true), - variant: 'cta', - }} - className={classNameBox} - dataTest="BoxGlmLock__BoxRounded" - hasSections - isVertical - title={t('lockedBalance')} - titleSuffix={ - -
setIsModalRewardsCalculatorOpen(true)} - > - -
-
- } - > - -
- setIsModalGlmLockOpen(false), - }} - /> - setIsModalRewardsCalculatorOpen(false), - }} - /> -
- ); -}; - -export default EarnBoxGlmLock; diff --git a/client/src/components/Earn/EarnBoxGlmLock/types.ts b/client/src/components/Earn/EarnBoxGlmLock/types.ts deleted file mode 100644 index 10b646c2a..000000000 --- a/client/src/components/Earn/EarnBoxGlmLock/types.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default interface EarnBoxGlmLockProps { - classNameBox: string; -} diff --git a/client/src/components/Earn/EarnBoxPersonalAllocation/EarnBoxPersonalAllocation.module.scss b/client/src/components/Earn/EarnBoxPersonalAllocation/EarnBoxPersonalAllocation.module.scss deleted file mode 100644 index 7130b1e15..000000000 --- a/client/src/components/Earn/EarnBoxPersonalAllocation/EarnBoxPersonalAllocation.module.scss +++ /dev/null @@ -1,15 +0,0 @@ -.pendingTooltip { - margin-left: -2.6rem; -} - -.pendingTooltipLabel { - font-size: $font-size-12; - font-weight: $font-weight-semibold; - line-height: 2rem; -} - -.pendingTooltipDate { - font-size: $font-size-20; - font-weight: $font-weight-semibold; - margin: 0.8rem 0 0.4rem; -} diff --git a/client/src/components/Earn/EarnBoxPersonalAllocation/EarnBoxPersonalAllocation.tsx b/client/src/components/Earn/EarnBoxPersonalAllocation/EarnBoxPersonalAllocation.tsx deleted file mode 100644 index c2dfb6ee7..000000000 --- a/client/src/components/Earn/EarnBoxPersonalAllocation/EarnBoxPersonalAllocation.tsx +++ /dev/null @@ -1,162 +0,0 @@ -import { format } from 'date-fns'; -import _first from 'lodash/first'; -import React, { FC, Fragment, useMemo, useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { useAccount } from 'wagmi'; - -import ModalEarnWithdrawEth from 'components/Earn/ModalEarnWithdrawEth'; -import BoxRounded from 'components/ui/BoxRounded'; -import Sections from 'components/ui/BoxRounded/Sections/Sections'; -import { SectionProps } from 'components/ui/BoxRounded/Sections/types'; -import useEpochAndAllocationTimestamps from 'hooks/helpers/useEpochAndAllocationTimestamps'; -import useIsProjectAdminMode from 'hooks/helpers/useIsProjectAdminMode'; -import useTotalPatronDonations from 'hooks/helpers/useTotalPatronDonations'; -import useCurrentEpoch from 'hooks/queries/useCurrentEpoch'; -import useCurrentEpochProps from 'hooks/queries/useCurrentEpochProps'; -import useIndividualReward from 'hooks/queries/useIndividualReward'; -import useIsDecisionWindowOpen from 'hooks/queries/useIsDecisionWindowOpen'; -import useIsPatronMode from 'hooks/queries/useIsPatronMode'; -import useWithdrawals from 'hooks/queries/useWithdrawals'; -import useTransactionLocalStore from 'store/transactionLocal/store'; -import getIsPreLaunch from 'utils/getIsPreLaunch'; - -import styles from './EarnBoxPersonalAllocation.module.scss'; -import EarnBoxPersonalAllocationProps from './types'; - -const EarnBoxPersonalAllocation: FC = ({ className }) => { - const { i18n, t } = useTranslation('translation', { - keyPrefix: 'components.dedicated.boxPersonalAllocation', - }); - const [isModalOpen, setIsModalOpen] = useState(false); - const { isConnected } = useAccount(); - const { data: currentEpoch } = useCurrentEpoch(); - const { data: isDecisionWindowOpen } = useIsDecisionWindowOpen(); - const { timeCurrentEpochStart, timeCurrentAllocationEnd } = useEpochAndAllocationTimestamps(); - const { data: currentEpochProps } = useCurrentEpochProps(); - const { data: withdrawals, isFetching: isFetchingWithdrawals } = useWithdrawals(); - const { data: individualReward, isFetching: isFetchingIndividualReward } = useIndividualReward(); - const { data: isPatronMode } = useIsPatronMode(); - const { data: totalPatronDonations, isFetching: isFetchingTotalPatronDonations } = - useTotalPatronDonations({ isEnabledAdditional: !!isPatronMode }); - const { isAppWaitingForTransactionToBeIndexed, transactionsPending } = useTransactionLocalStore( - state => ({ - isAppWaitingForTransactionToBeIndexed: state.data.isAppWaitingForTransactionToBeIndexed, - transactionsPending: state.data.transactionsPending, - }), - ); - - const isPreLaunch = getIsPreLaunch(currentEpoch); - const isProjectAdminMode = useIsProjectAdminMode(); - - const sections: SectionProps[] = [ - ...(!isProjectAdminMode - ? [ - { - dataTest: 'BoxPersonalAllocation__Section', - doubleValueProps: { - cryptoCurrency: 'ethereum', - dataTest: 'BoxPersonalAllocation__Section--pending__DoubleValue', - isFetching: - (isPatronMode ? isFetchingIndividualReward : isFetchingWithdrawals) || - (isAppWaitingForTransactionToBeIndexed && - _first(transactionsPending)?.type === 'withdrawal'), - showCryptoSuffix: true, - valueCrypto: isPatronMode ? individualReward : withdrawals?.sums.pending, - }, - label: isPatronMode ? t('currentEpoch') : t('pending'), - tooltipProps: isPatronMode - ? undefined - : { - position: 'bottom-right', - text: ( -
-
- {t('pendingFundsAvailableAfter')} -
-
- {/* TODO OCT-1041 fetch next epoch props instead of assuming the same length */} - {currentEpochProps && timeCurrentEpochStart && timeCurrentAllocationEnd - ? format( - new Date( - isDecisionWindowOpen - ? timeCurrentAllocationEnd - : // When AW is closed, it's when the last AW closed. - timeCurrentEpochStart + currentEpochProps.decisionWindow, - ), - 'haaa z, d LLLL', - ) - : ''} -
-
- ), - }, - } as SectionProps, - ] - : []), - { - dataTest: 'BoxPersonalAllocation__Section', - doubleValueProps: { - coinPricesServerDowntimeText: !isProjectAdminMode ? '...' : undefined, - cryptoCurrency: 'ethereum', - dataTest: 'BoxPersonalAllocation__Section--availableNow__DoubleValue', - isFetching: - (isPatronMode ? isFetchingTotalPatronDonations : isFetchingWithdrawals) || - (isAppWaitingForTransactionToBeIndexed && - _first(transactionsPending)?.type === 'withdrawal'), - showCryptoSuffix: true, - valueCrypto: isPatronMode ? totalPatronDonations?.value : withdrawals?.sums.available, - }, - label: isPatronMode && !isProjectAdminMode ? t('allTime') : i18n.t('common.availableNow'), - }, - ]; - - const title = useMemo(() => { - if (isProjectAdminMode) { - return i18n.t('common.donations'); - } - if (isPatronMode) { - return t('patronEarnings'); - } - return i18n.t('common.personalAllocation'); - }, [isProjectAdminMode, isPatronMode, i18n, t]); - - return ( - - setIsModalOpen(true), - variant: isProjectAdminMode ? 'cta' : 'secondary', - } - } - className={className} - dataTest="BoxPersonalAllocation" - hasSections - isVertical - title={title} - > - - - setIsModalOpen(false), - }} - /> - - ); -}; - -export default EarnBoxPersonalAllocation; diff --git a/client/src/components/Earn/EarnBoxPersonalAllocation/index.tsx b/client/src/components/Earn/EarnBoxPersonalAllocation/index.tsx deleted file mode 100644 index dedc208a2..000000000 --- a/client/src/components/Earn/EarnBoxPersonalAllocation/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line no-restricted-exports -export { default } from './EarnBoxPersonalAllocation'; diff --git a/client/src/components/Earn/EarnBoxPersonalAllocation/types.ts b/client/src/components/Earn/EarnBoxPersonalAllocation/types.ts deleted file mode 100644 index c73db828a..000000000 --- a/client/src/components/Earn/EarnBoxPersonalAllocation/types.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default interface EarnBoxPersonalAllocationProps { - className?: string; -} diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLock.module.scss b/client/src/components/Earn/EarnGlmLock/EarnGlmLock.module.scss deleted file mode 100644 index 2f5b7fd1f..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLock.module.scss +++ /dev/null @@ -1,10 +0,0 @@ -.form { - width: 100%; - height: 100%; -} - -.element { - &:not(:last-child) { - margin: 0 auto 1.6rem; - } -} diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLock.tsx b/client/src/components/Earn/EarnGlmLock/EarnGlmLock.tsx deleted file mode 100644 index 3a966b373..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLock.tsx +++ /dev/null @@ -1,249 +0,0 @@ -import { Formik } from 'formik'; -import React, { FC, useEffect, useRef, useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { useAccount, useWalletClient, usePublicClient, useWaitForTransactionReceipt } from 'wagmi'; - -import { apiGetSafeTransactions } from 'api/calls/safeTransactions'; -import EarnGlmLockBudget from 'components/Earn/EarnGlmLock/EarnGlmLockBudget'; -import EarnGlmLockNotification from 'components/Earn/EarnGlmLock/EarnGlmLockNotification'; -import EarnGlmLockStepper from 'components/Earn/EarnGlmLock/EarnGlmLockStepper'; -import EarnGlmLockTabs from 'components/Earn/EarnGlmLock/EarnGlmLockTabs'; -import networkConfig from 'constants/networkConfig'; -import env from 'env'; -import { writeContractERC20 } from 'hooks/contracts/writeContracts'; -import useAvailableFundsGlm from 'hooks/helpers/useAvailableFundsGlm'; -import useApprovalState, { ApprovalState } from 'hooks/helpers/useMaxApproveCallback'; -import useMediaQuery from 'hooks/helpers/useMediaQuery'; -import useLock from 'hooks/mutations/useLock'; -import useUnlock from 'hooks/mutations/useUnlock'; -import useDepositValue from 'hooks/queries/useDepositValue'; -import useEstimatedEffectiveDeposit from 'hooks/queries/useEstimatedEffectiveDeposit'; -import useHistory from 'hooks/queries/useHistory'; -import useIsContract from 'hooks/queries/useIsContract'; -import useProjectsEpoch from 'hooks/queries/useProjectsEpoch'; -import useLockedSummaryLatest from 'hooks/subgraph/useLockedSummaryLatest'; -import toastService from 'services/toastService'; -import useTransactionLocalStore from 'store/transactionLocal/store'; -import { parseUnitsBigInt } from 'utils/parseUnitsBigInt'; - -import styles from './EarnGlmLock.module.scss'; -import EarnGlmLockProps, { Step, OnReset } from './types'; -import { formInitialValues, validationSchema } from './utils'; - -const EarnGlmLock: FC = ({ currentMode, onCurrentModeChange, onCloseModal }) => { - const { i18n } = useTranslation(); - const { address } = useAccount(); - const publicClient = usePublicClient({ chainId: networkConfig.id }); - const { data: walletClient } = useWalletClient(); - const { isDesktop } = useMediaQuery(); - const { data: isContract } = useIsContract(); - const [transactionHashForEtherscan, setTransactionHashForEtherscan] = useState< - string | undefined - >(undefined); - const { addTransactionPending } = useTransactionLocalStore(state => ({ - addTransactionPending: state.addTransactionPending, - })); - const { data: transactionReceipt, isLoading: isLoadingTransactionReceipt } = - useWaitForTransactionReceipt({ - hash: transactionHashForEtherscan as `0x${string}` | undefined, - onReplaced: response => - setTransactionHashForEtherscan(response.transactionReceipt.transactionHash), - }); - - /** - * Value to depose so that we don't ask for allowance when user - * requests less than already approved. - */ - const [valueToDepose, setValueToDepose] = useState(BigInt(0)); - const [step, setStep] = useState(1); - const [intervalId, setIntervalId] = useState(null); - const [isCryptoOrFiatInputFocused, setIsCryptoOrFiatInputFocused] = useState(true); - const buttonUseMaxRef = useRef(null); - - const { data: availableFundsGlm } = useAvailableFundsGlm(); - const { data: projectsEpoch } = useProjectsEpoch(); - const { refetch: refetchHistory } = useHistory(); - const { data: depositsValue, refetch: refetchDeposit } = useDepositValue(); - const { refetch: refetchEstimatedEffectiveDeposit } = useEstimatedEffectiveDeposit(); - const { refetch: refetchLockedSummaryLatest } = useLockedSummaryLatest(); - - useEffect(() => { - if (transactionReceipt && !isLoadingTransactionReceipt) { - setStep(3); - } - }, [transactionReceipt, isLoadingTransactionReceipt, setStep]); - - const [approvalState, approveCallback] = useApprovalState( - address, - env.contractDepositsAddress, - valueToDepose, - ); - - const isButtonUseMaxFocused = document.activeElement === buttonUseMaxRef.current; - /** - * When input is focused isCryptoOrFiatInputFocused is true. - * Clicking "use max" blurs inputs, setting isCryptoOrFiatInputFocused to false. - * EarnGlmLockTabs onMax sets the focus back on inputs, triggering isCryptoOrFiatInputFocused to true. - * - * Between second and third update flickering can occur, when focus is already set to input, - * but state didn't update yet. - * - * To check it out set isAnyInputFocused to permanent "false" and click "use max" fast. - */ - const isAnyInputFocused = document.activeElement?.tagName === 'INPUT'; - const showBudgetBox = - isDesktop || - (!isDesktop && !isCryptoOrFiatInputFocused && !isButtonUseMaxFocused && !isAnyInputFocused); - - const onMutate = async (): Promise => { - if (!publicClient || !walletClient || !availableFundsGlm) { - return; - } - - setStep(2); - - const approvalStateCurrent = await approveCallback(); - if (currentMode === 'lock' && approvalStateCurrent !== ApprovalState.APPROVED) { - const hash = await writeContractERC20({ - args: [env.contractDepositsAddress, availableFundsGlm.value], - functionName: 'approve', - walletClient, - }); - await publicClient.waitForTransactionReceipt({ hash }); - } - }; - - const onSuccess = async ({ hash, value }): Promise => { - if (isContract) { - const id = setInterval(async () => { - const nextSafeTransactions = await apiGetSafeTransactions(address!); - const safeTransaction = nextSafeTransactions.results.find( - t => t.safeTxHash === hash && t.transactionHash, - ); - - if (safeTransaction) { - clearInterval(id); - Promise.all([ - refetchDeposit(), - refetchEstimatedEffectiveDeposit(), - refetchLockedSummaryLatest(), - refetchHistory(), - ]).then(() => { - setTransactionHashForEtherscan(safeTransaction.transactionHash); - setStep(3); - }); - } - }, 2000); - setIntervalId(id); - return; - } - addTransactionPending({ - eventData: { - amount: value, - transactionHash: hash, - }, - isMultisig: !!isContract, - // GET /history uses seconds. Normalization here. - timestamp: Math.floor(Date.now() / 1000).toString(), - type: currentMode, - }); - setTransactionHashForEtherscan(hash); - }; - - const onReset: OnReset = ({ setFieldValue, newMode = 'lock' }) => { - onCurrentModeChange(newMode); - setTransactionHashForEtherscan(undefined); - setStep(1); - - if (setFieldValue) { - setFieldValue('currentMode', newMode); - } - }; - - const onError = () => onReset({ newMode: currentMode }); - - const lockMutation = useLock({ onError, onMutate, onSuccess }); - const unlockMutation = useUnlock({ onError, onMutate, onSuccess }); - - const onApproveOrDeposit = async ({ valueToDeposeOrWithdraw }): Promise => { - const isSignedInAsAProject = projectsEpoch!.projectsAddresses.includes(address!); - - if (isSignedInAsAProject) { - toastService.showToast({ - name: 'projectForbiddenOperation', - title: i18n.t('common.projectForbiddenOperation'), - type: 'error', - }); - return; - } - - const valueToDeposeOrWithdrawBigInt = parseUnitsBigInt(valueToDeposeOrWithdraw); - if (currentMode === 'lock') { - await lockMutation.mutateAsync(valueToDeposeOrWithdrawBigInt); - } else { - await unlockMutation.mutateAsync(valueToDeposeOrWithdrawBigInt); - } - }; - - const isLockingApproved = approvalState === ApprovalState.APPROVED; - const isApprovalKnown = approvalState !== ApprovalState.UNKNOWN; - - useEffect(() => { - return () => { - if (!intervalId) { - return; - } - clearInterval(intervalId); - }; - }, [intervalId]); - - return ( - - {props => ( -
- {isDesktop && ( - - )} - {(step === 2 && currentMode === 'lock' && isApprovalKnown && !isLockingApproved) || - step === 3 ? ( - - ) : ( - - )} - - - )} -
- ); -}; - -export default EarnGlmLock; diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudget/EarnGlmLockBudget.module.scss b/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudget/EarnGlmLockBudget.module.scss deleted file mode 100644 index 2b4bc5cd0..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudget/EarnGlmLockBudget.module.scss +++ /dev/null @@ -1,3 +0,0 @@ -.root { - margin: 0 auto 1.6rem -} diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudget/EarnGlmLockBudget.tsx b/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudget/EarnGlmLockBudget.tsx deleted file mode 100644 index 2dc354521..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudget/EarnGlmLockBudget.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { useFormikContext } from 'formik'; -import React, { FC } from 'react'; - -import EarnGlmLockBudgetBox from 'components/Earn/EarnGlmLock/EarnGlmLockBudgetBox'; -import { FormFields } from 'components/Earn/EarnGlmLock/types'; - -import styles from './EarnGlmLockBudget.module.scss'; -import EarnGlmLockBudgetProps from './types'; - -const EarnGlmLockBudget: FC = ({ isVisible }) => { - const { errors } = useFormikContext(); - - if (!isVisible) { - return null; - } - - return ( - - ); -}; - -export default EarnGlmLockBudget; diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudget/index.tsx b/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudget/index.tsx deleted file mode 100644 index 5a45b6c2e..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudget/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line no-restricted-exports -export { default } from './EarnGlmLockBudget'; diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudget/types.ts b/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudget/types.ts deleted file mode 100644 index 4be2791ae..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudget/types.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default interface EarnGlmLockBudgetProps { - isVisible: boolean; -} diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudgetBox/EarnGlmLockBudgetBox.module.scss b/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudgetBox/EarnGlmLockBudgetBox.module.scss deleted file mode 100644 index 876257226..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudgetBox/EarnGlmLockBudgetBox.module.scss +++ /dev/null @@ -1,65 +0,0 @@ -.transactionHash { - display: flex; - justify-content: center; - margin: 1rem 0 0 0; -} - -.availableFunds { - height: 3.2rem; - display: flex; - align-items: flex-end; - border-top: 0.1rem solid $color-white; - margin-top: 1.6rem; - - .value { - color: $color-black; - - &.isError { - color: $color-octant-orange; - } - } -} - -.button { - padding: 0; -} - -.budgetRow { - position: relative; - height: 5.6rem; - display: flex; - align-items: center; - justify-content: space-between; - width: 100%; - font-size: $font-size-14; - font-weight: $font-weight-bold; - - &:not(:last-child)::after { - content: ''; - width: 100%; - position: absolute; - height: 0.1rem; - background-color: $color-octant-grey1; - bottom: 0; - left: 0; - } - - .skeleton { - @include skeleton(); - height: 1.7rem; - width: 10rem; - } - - - .budgetLabel { - color: $color-octant-grey5; - } - - .budgetValue { - color: $color-octant-dark; - - &.isError { - color: $color-octant-orange; - } - } -} diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudgetBox/EarnGlmLockBudgetBox.tsx b/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudgetBox/EarnGlmLockBudgetBox.tsx deleted file mode 100644 index 37733eaf7..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudgetBox/EarnGlmLockBudgetBox.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import cx from 'classnames'; -import React, { FC, useMemo } from 'react'; -import { useTranslation } from 'react-i18next'; - -import BoxRounded from 'components/ui/BoxRounded'; -import useAvailableFundsGlm from 'hooks/helpers/useAvailableFundsGlm'; -import useDepositValue from 'hooks/queries/useDepositValue'; -import getFormattedGlmValue from 'utils/getFormattedGlmValue'; - -import styles from './EarnGlmLockBudgetBox.module.scss'; -import EarnGlmLockBudgetBoxProps from './types'; - -const EarnGlmLockBudgetBox: FC = ({ - className, - isWalletBalanceError, - isCurrentlyLockedError, -}) => { - const { data: depositsValue, isFetching: isFetchingDepositValue } = useDepositValue(); - const { data: availableFundsGlm, isFetched: isFetchedAvailableFundsGlm } = useAvailableFundsGlm(); - - const { t } = useTranslation('translation', { - keyPrefix: 'components.dedicated.budgetBox', - }); - - const depositsValueString = useMemo( - () => getFormattedGlmValue({ value: depositsValue || BigInt(0) }).fullString, - [depositsValue], - ); - - const availableFundsGlmString = getFormattedGlmValue({ - value: BigInt(availableFundsGlm ? availableFundsGlm!.value : 0), - }).fullString; - - return ( - -
-
{t('currentlyLocked')}
- {isFetchingDepositValue ? ( -
- ) : ( -
- {depositsValueString} -
- )} -
-
-
{t('walletBalance')}
- {!isFetchedAvailableFundsGlm ? ( -
- ) : ( -
- {availableFundsGlmString} -
- )} -
- - ); -}; - -export default EarnGlmLockBudgetBox; diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudgetBox/index.tsx b/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudgetBox/index.tsx deleted file mode 100644 index 07c38db41..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudgetBox/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line no-restricted-exports -export { default } from './EarnGlmLockBudgetBox'; diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudgetBox/types.ts b/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudgetBox/types.ts deleted file mode 100644 index 74d224f84..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLockBudgetBox/types.ts +++ /dev/null @@ -1,5 +0,0 @@ -export default interface EarnGlmLockBudgetBoxProps { - className?: string; - isCurrentlyLockedError?: boolean; - isWalletBalanceError?: boolean; -} diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLockNotification/EarnGlmLockNotification.module.scss b/client/src/components/Earn/EarnGlmLock/EarnGlmLockNotification/EarnGlmLockNotification.module.scss deleted file mode 100644 index 8c77ef598..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLockNotification/EarnGlmLockNotification.module.scss +++ /dev/null @@ -1,35 +0,0 @@ -.notification { - display: flex; - align-items: center; -} - -.info { - height: 11.2rem; - display: flex; - flex-direction: column; - justify-content: center; - align-items: start; - font-size: $font-size-12; - line-height: 2rem; - margin-left: 2rem; - - .label { - color: $color-octant-dark; - } - - .text { - color: $color-octant-grey5; - text-align: left; - - .link { - font-size: $font-size-12; - min-height: 2rem; - font-weight: $font-weight-semibold; - - &:hover { - cursor: pointer; - transform: none; - } - } - } -} diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLockNotification/EarnGlmLockNotification.tsx b/client/src/components/Earn/EarnGlmLock/EarnGlmLockNotification/EarnGlmLockNotification.tsx deleted file mode 100644 index e32df3f92..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLockNotification/EarnGlmLockNotification.tsx +++ /dev/null @@ -1,96 +0,0 @@ -import React, { FC, useMemo } from 'react'; -import { Trans, useTranslation } from 'react-i18next'; - -import BoxRounded from 'components/ui/BoxRounded'; -import Button from 'components/ui/Button'; -import Svg from 'components/ui/Svg'; -import networkConfig from 'constants/networkConfig'; -import { arrowTopRight, checkMark, notificationIconWarning } from 'svg/misc'; - -import styles from './EarnGlmLockNotification.module.scss'; -import EarnGlmLockNotificationProps from './types'; - -const ButtonLinkWithIcon: FC<{ children?: React.ReactNode; transactionHash: string }> = ({ - children, - transactionHash, -}) => { - return ( - - ); -}; - -const EarnGlmLockNotification: FC = ({ - className, - isLockingApproved, - type, - transactionHash, - currentMode, -}) => { - const keyPrefix = 'components.dedicated.glmLock.glmLockNotification'; - - const { t } = useTranslation('translation', { - keyPrefix, - }); - - const label = useMemo(() => { - if (type === 'info' && currentMode === 'lock' && !isLockingApproved) { - return t('info.lock.notApproved.label'); - } - if (type === 'success' && currentMode === 'lock') { - return t('success.labelLocked'); - } - if (type === 'success' && currentMode === 'unlock') { - return t('success.labelUnlocked'); - } - }, [t, currentMode, type, isLockingApproved]); - - const text = useMemo(() => { - if (type === 'success') { - return `${keyPrefix}.success.text`; - } - if (type === 'info' && currentMode === 'lock' && !isLockingApproved) { - return `${keyPrefix}.info.lock.notApproved.text`; - } - }, [type, currentMode, isLockingApproved]); - - return ( - -
- -
- {label &&
{label}
} - {text && ( -
- ] - : undefined - } - i18nKey={text} - /> -
- )} -
-
-
- ); -}; - -export default EarnGlmLockNotification; diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLockNotification/index.tsx b/client/src/components/Earn/EarnGlmLock/EarnGlmLockNotification/index.tsx deleted file mode 100644 index 6f753d108..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLockNotification/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line no-restricted-exports -export { default } from './EarnGlmLockNotification'; diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLockNotification/types.ts b/client/src/components/Earn/EarnGlmLock/EarnGlmLockNotification/types.ts deleted file mode 100644 index 44c72a0b3..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLockNotification/types.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { CurrentMode } from 'components/Earn/EarnGlmLock/types'; - -export default interface EarnGlmLockNotificationProps { - className?: string; - currentMode: CurrentMode; - isLockingApproved: boolean; - transactionHash?: string; - type: 'success' | 'info'; -} diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLockStepper/EarnGlmLockStepper.tsx b/client/src/components/Earn/EarnGlmLock/EarnGlmLockStepper/EarnGlmLockStepper.tsx deleted file mode 100644 index e2c30eb9d..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLockStepper/EarnGlmLockStepper.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { useFormikContext } from 'formik'; -import React, { FC } from 'react'; -import { useTranslation } from 'react-i18next'; - -import { FormFields } from 'components/Earn/EarnGlmLock/types'; -import BoxRounded from 'components/ui/BoxRounded'; -import ProgressStepper from 'components/ui/ProgressStepper'; - -import EarnGlmLockStepperProps from './types'; - -const EarnGlmLockStepper: FC = ({ currentMode, step, className }) => { - const { t, i18n } = useTranslation('translation', { - keyPrefix: 'components.dedicated.glmLock', - }); - const { isValid } = useFormikContext(); - - return ( - - - - ); -}; - -export default EarnGlmLockStepper; diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLockStepper/index.tsx b/client/src/components/Earn/EarnGlmLock/EarnGlmLockStepper/index.tsx deleted file mode 100644 index 002295c96..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLockStepper/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line no-restricted-exports -export { default } from './EarnGlmLockStepper'; diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLockStepper/types.ts b/client/src/components/Earn/EarnGlmLock/EarnGlmLockStepper/types.ts deleted file mode 100644 index 5eee7e952..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLockStepper/types.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { CurrentMode } from '../types'; - -export default interface EarnGlmLockStepperProps { - className?: string; - currentMode: CurrentMode; - step: 1 | 2 | 3; -} diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLockTabs/EarnGlmLockTabs.module.scss b/client/src/components/Earn/EarnGlmLock/EarnGlmLockTabs/EarnGlmLockTabs.module.scss deleted file mode 100644 index 067a9b9fb..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLockTabs/EarnGlmLockTabs.module.scss +++ /dev/null @@ -1,52 +0,0 @@ -.box { - position: relative; - padding: 1.8rem 2.4rem 2.4rem; - - .max { - position: absolute; - font-size: $font-size-14; - line-height: 2rem; - top: 1.8rem; - right: 2.4rem; - color: $color-octant-green; - cursor: pointer; - - &.isDisabled { - opacity: 0.3; - cursor: default; - } - - &:not(.isDisabled):hover { - color: $color-octant-green2; - } - } -} - -.inputsLabel { - display: flex; - justify-content: space-between; - - .inputsLabelBalance { - display: flex; - - .availableValue { - margin: 0 0.2rem; - - &.dontHaveEnough { - color: $color-octant-orange; - } - } - - .lockedValue { - margin-right: 0.2rem; - - &.cantUnlock { - color: $color-octant-orange; - } - } - } -} - -.button { - width: 100%; -} diff --git a/client/src/components/Earn/EarnGlmLock/EarnGlmLockTabs/EarnGlmLockTabs.tsx b/client/src/components/Earn/EarnGlmLock/EarnGlmLockTabs/EarnGlmLockTabs.tsx deleted file mode 100644 index 02b418d63..000000000 --- a/client/src/components/Earn/EarnGlmLock/EarnGlmLockTabs/EarnGlmLockTabs.tsx +++ /dev/null @@ -1,177 +0,0 @@ -import cx from 'classnames'; -import { useFormikContext } from 'formik'; -import React, { FC, useMemo, useRef } from 'react'; -import { useTranslation } from 'react-i18next'; - -import EarnGlmLockTabsInputs from 'components/Earn/EarnGlmLock/EarnGlmLockTabsInputs'; -import { FormFields } from 'components/Earn/EarnGlmLock/types'; -import BoxRounded from 'components/ui/BoxRounded'; -import Button from 'components/ui/Button'; -import ButtonProps from 'components/ui/Button/types'; -import useAvailableFundsGlm from 'hooks/helpers/useAvailableFundsGlm'; -import useDepositValue from 'hooks/queries/useDepositValue'; -import { formatUnitsBigInt } from 'utils/formatUnitsBigInt'; -import getFormattedGlmValue from 'utils/getFormattedGlmValue'; -import { parseUnitsBigInt } from 'utils/parseUnitsBigInt'; - -import styles from './EarnGlmLockTabs.module.scss'; -import EarnGlmLockTabsProps from './types'; - -const EarnGlmLockTabs: FC = ({ - buttonUseMaxRef, - className, - currentMode, - isLoading, - onClose, - onInputsFocusChange, - onReset, - setFieldValue, - setValueToDepose, - showBalances, - step, -}) => { - const { i18n, t } = useTranslation('translation', { - keyPrefix: 'components.dedicated.glmLock', - }); - const formik = useFormikContext(); - const inputRef = useRef(null); - - const { data: availableFundsGlm } = useAvailableFundsGlm(); - const { data: depositsValue } = useDepositValue(); - - const isMaxDisabled = isLoading || step > 1; - - const onSetValue = (value: string): void => { - formik.setFieldValue('valueToDeposeOrWithdraw', value); - setValueToDepose(value ? parseUnitsBigInt(value) : BigInt(0)); - }; - - const onMax = () => { - if (isMaxDisabled || depositsValue === undefined || !availableFundsGlm) { - return; - } - const value = - currentMode === 'lock' - ? formatUnitsBigInt(BigInt(availableFundsGlm.value)) - : formatUnitsBigInt(depositsValue); - - onSetValue(value); - inputRef.current?.focus(); - }; - - const buttonCtaProps: ButtonProps = - step === 3 - ? { - onClick: onClose, - type: 'button', - } - : { - type: 'submit', - }; - - const buttonLabel = useMemo(() => { - if (isLoading) { - return i18n.t('common.waitingForConfirmation'); - } - if (step === 3) { - return i18n.t('common.close'); - } - if (currentMode === 'unlock') { - return t('unlock'); - } - return t('lock'); - }, [currentMode, step, t, isLoading, i18n]); - - const isButtonDisabled = - !formik.isValid || parseUnitsBigInt(formik.values.valueToDeposeOrWithdraw || '0') === 0n; - - return ( - onReset({ newMode: 'lock', setFieldValue }), - title: t('lock'), - }, - { - isActive: currentMode === 'unlock', - isDisabled: isLoading, - onClick: () => onReset({ newMode: 'unlock', setFieldValue }), - title: t('unlock'), - }, - ]} - > - - - {t(currentMode === 'lock' ? 'glmLockTabs.amountToLock' : 'glmLockTabs.amountToUnlock')} - {showBalances && ( -
-
- {getFormattedGlmValue({ value: depositsValue || BigInt(0) }).value} -
- {t('glmLockTabs.locked')} -
- { - getFormattedGlmValue({ - value: BigInt(availableFundsGlm ? availableFundsGlm?.value : 0), - }).value - } -
- {i18n.t('common.available')} -
- )} -
- } - mode={currentMode} - onChange={onSetValue} - onInputsFocusChange={onInputsFocusChange} - /> -
- ); -}; - -export default EarnWithdrawEth; diff --git a/client/src/components/Earn/EarnWithdrawEth/index.tsx b/client/src/components/Earn/EarnWithdrawEth/index.tsx deleted file mode 100644 index 0939f1d9b..000000000 --- a/client/src/components/Earn/EarnWithdrawEth/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line no-restricted-exports -export { default } from './EarnWithdrawEth'; diff --git a/client/src/components/Earn/EarnWithdrawEth/types.ts b/client/src/components/Earn/EarnWithdrawEth/types.ts deleted file mode 100644 index e332c4c25..000000000 --- a/client/src/components/Earn/EarnWithdrawEth/types.ts +++ /dev/null @@ -1,3 +0,0 @@ -export default interface EarnWithdrawEthProps { - onCloseModal: () => void; -} diff --git a/client/src/components/Earn/ModalEarnGlmLock/ModalEarnGlmLock.tsx b/client/src/components/Earn/ModalEarnGlmLock/ModalEarnGlmLock.tsx deleted file mode 100644 index 2f8e83315..000000000 --- a/client/src/components/Earn/ModalEarnGlmLock/ModalEarnGlmLock.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import React, { FC, useState } from 'react'; -import { useTranslation } from 'react-i18next'; - -import EarnGlmLock from 'components/Earn/EarnGlmLock'; -import { CurrentMode } from 'components/Earn/EarnGlmLock/types'; -import Modal from 'components/ui/Modal'; - -import ModalEarnGlmLockProps from './types'; - -const ModalEarnGlmLock: FC = ({ modalProps }) => { - const { t, i18n } = useTranslation('translation', { - keyPrefix: 'components.dedicated.modalGlmLock', - }); - const [currentMode, setCurrentMode] = useState('lock'); - - const modalHeader = currentMode === 'lock' ? i18n.t('common.lockGlm') : t('unlockGLM'); - - return ( - - - - ); -}; - -export default ModalEarnGlmLock; diff --git a/client/src/components/Earn/ModalEarnGlmLock/index.tsx b/client/src/components/Earn/ModalEarnGlmLock/index.tsx deleted file mode 100644 index 252540a7b..000000000 --- a/client/src/components/Earn/ModalEarnGlmLock/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line no-restricted-exports -export { default } from './ModalEarnGlmLock'; diff --git a/client/src/components/Earn/ModalEarnGlmLock/types.ts b/client/src/components/Earn/ModalEarnGlmLock/types.ts deleted file mode 100644 index a282b96ba..000000000 --- a/client/src/components/Earn/ModalEarnGlmLock/types.ts +++ /dev/null @@ -1,5 +0,0 @@ -import ModalProps from 'components/ui/Modal/types'; - -export default interface ModalEarnGlmLockProps { - modalProps: Omit; -} diff --git a/client/src/components/Earn/ModalEarnRewardsCalculator/ModalEarnRewardsCalculator.module.scss b/client/src/components/Earn/ModalEarnRewardsCalculator/ModalEarnRewardsCalculator.module.scss deleted file mode 100644 index f73dec9c8..000000000 --- a/client/src/components/Earn/ModalEarnRewardsCalculator/ModalEarnRewardsCalculator.module.scss +++ /dev/null @@ -1,21 +0,0 @@ -.root { - .header { - display: flex; - align-items: center; - overflow: visible; - } -} - -.tooltip { - margin-left: 0.8rem; - position: relative; - - .tooltipContainer { - top: 3.6rem; - left: -16.7rem; - } -} - -.tooltipWrapper { - position: relative; -} diff --git a/client/src/components/Earn/ModalEarnRewardsCalculator/ModalEarnRewardsCalculator.tsx b/client/src/components/Earn/ModalEarnRewardsCalculator/ModalEarnRewardsCalculator.tsx deleted file mode 100644 index aa8394560..000000000 --- a/client/src/components/Earn/ModalEarnRewardsCalculator/ModalEarnRewardsCalculator.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import React, { FC } from 'react'; -import { useTranslation } from 'react-i18next'; - -import EarnRewardsCalculator from 'components/Earn/EarnRewardsCalculator'; -import Modal from 'components/ui/Modal'; -import Svg from 'components/ui/Svg'; -import Tooltip from 'components/ui/Tooltip'; -import { questionMark } from 'svg/misc'; - -import styles from './ModalEarnRewardsCalculator.module.scss'; -import ModalEarnRewardsCalculatorProps from './types'; - -const ModalEarnRewardsCalculator: FC = ({ modalProps }) => { - const { i18n, t } = useTranslation('translation', { - keyPrefix: 'components.dedicated.rewardsCalculator', - }); - - return ( - -
{i18n.t('common.estimateRewards')}
- - - - - } - headerClassName={styles.header} - isOpen={modalProps.isOpen} - onClosePanel={modalProps.onClosePanel} - > - -
- ); -}; - -export default ModalEarnRewardsCalculator; diff --git a/client/src/components/Earn/ModalEarnRewardsCalculator/index.tsx b/client/src/components/Earn/ModalEarnRewardsCalculator/index.tsx deleted file mode 100644 index 975cda719..000000000 --- a/client/src/components/Earn/ModalEarnRewardsCalculator/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line no-restricted-exports -export { default } from './ModalEarnRewardsCalculator'; diff --git a/client/src/components/Earn/ModalEarnRewardsCalculator/types.ts b/client/src/components/Earn/ModalEarnRewardsCalculator/types.ts deleted file mode 100644 index 04220a105..000000000 --- a/client/src/components/Earn/ModalEarnRewardsCalculator/types.ts +++ /dev/null @@ -1,5 +0,0 @@ -import ModalProps from 'components/ui/Modal/types'; - -export default interface ModalEarnRewardsCalculatorProps { - modalProps: Omit; -} diff --git a/client/src/components/Earn/ModalEarnWithdrawEth/ModalEarnWithdrawEth.tsx b/client/src/components/Earn/ModalEarnWithdrawEth/ModalEarnWithdrawEth.tsx deleted file mode 100644 index 1004f04d8..000000000 --- a/client/src/components/Earn/ModalEarnWithdrawEth/ModalEarnWithdrawEth.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React, { FC } from 'react'; -import { useTranslation } from 'react-i18next'; - -import EarnWithdrawEth from 'components/Earn/EarnWithdrawEth'; -import Modal from 'components/ui/Modal'; - -import ModalEarnWithdrawingProps from './types'; - -const ModalEarnWithdrawEth: FC = ({ modalProps }) => { - const { t } = useTranslation('translation', { - keyPrefix: 'components.dedicated.modalWithdrawEth', - }); - - return ( - - - - ); -}; - -export default ModalEarnWithdrawEth; diff --git a/client/src/components/Earn/ModalEarnWithdrawEth/index.tsx b/client/src/components/Earn/ModalEarnWithdrawEth/index.tsx deleted file mode 100644 index 1744f844c..000000000 --- a/client/src/components/Earn/ModalEarnWithdrawEth/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line no-restricted-exports -export { default } from './ModalEarnWithdrawEth'; diff --git a/client/src/components/Earn/ModalEarnWithdrawEth/types.ts b/client/src/components/Earn/ModalEarnWithdrawEth/types.ts deleted file mode 100644 index a455783d0..000000000 --- a/client/src/components/Earn/ModalEarnWithdrawEth/types.ts +++ /dev/null @@ -1,5 +0,0 @@ -import ModalProps from 'components/ui/Modal/types'; - -export default interface ModaEarnlWithdrawEthProps { - modalProps: Omit; -} diff --git a/client/src/components/Home/HomeGridCurrentGlmLock/HomeGridCurrentGlmLock.tsx b/client/src/components/Home/HomeGridCurrentGlmLock/HomeGridCurrentGlmLock.tsx index 694b2eab2..f81599ea2 100644 --- a/client/src/components/Home/HomeGridCurrentGlmLock/HomeGridCurrentGlmLock.tsx +++ b/client/src/components/Home/HomeGridCurrentGlmLock/HomeGridCurrentGlmLock.tsx @@ -77,7 +77,7 @@ const HomeGridCurrentGlmLock: FC = ({ className }) valueCrypto: estimatedEffectiveDeposit, }, isDisabled: isPreLaunch && !isConnected, - label: isProjectAdminMode ? t('pending') : t('effective'), + label: isProjectAdminMode ? i18n.t('common.pending') : t('effective'), tooltipProps: { dataTest: 'TooltipEffectiveLockedBalance', position: 'bottom-right', diff --git a/client/src/components/Home/HomeGridDonations/HomeGridDonations.tsx b/client/src/components/Home/HomeGridDonations/HomeGridDonations.tsx index 6dcf09150..93b09933b 100644 --- a/client/src/components/Home/HomeGridDonations/HomeGridDonations.tsx +++ b/client/src/components/Home/HomeGridDonations/HomeGridDonations.tsx @@ -18,7 +18,7 @@ import HomeGridDonationsProps from './types'; import { getReducedUserAllocationsAllEpochs } from './utils'; const HomeGridDonations: FC = ({ className }) => { - const { t } = useTranslation('translation', { + const { i18n, t } = useTranslation('translation', { keyPrefix: 'components.home.homeGridDonations', }); const { isConnected } = useAccount(); @@ -50,7 +50,9 @@ const HomeGridDonations: FC = ({ className }) => { showTitleDivider={!areAllocationsEmpty} title={
- {!isDecisionWindowOpen && !areAllocationsEmpty ? t('donationHistory') : t('donations')} + {!isDecisionWindowOpen && !areAllocationsEmpty + ? t('donationHistory') + : i18n.t('common.donations')} {isDecisionWindowOpen && userAllocations?.elements !== undefined && (
{userAllocations?.elements?.length}
)} @@ -67,7 +69,7 @@ const HomeGridDonations: FC = ({ className }) => { }} variant="cta" > - {t('edit')} + {i18n.t('common.edit')} ) : null } diff --git a/client/src/components/Home/HomeGridEpochResults/EpochResultsDetails/EpochResultsDetails.tsx b/client/src/components/Home/HomeGridEpochResults/EpochResultsDetails/EpochResultsDetails.tsx index 1f4444964..000e7ab95 100644 --- a/client/src/components/Home/HomeGridEpochResults/EpochResultsDetails/EpochResultsDetails.tsx +++ b/client/src/components/Home/HomeGridEpochResults/EpochResultsDetails/EpochResultsDetails.tsx @@ -11,7 +11,7 @@ import styles from './EpochResultsDetails.module.scss'; import EpochResultsDetailsProps from './types'; const EpochResultsDetails: FC = ({ details }) => { - const { t } = useTranslation('translation', { + const { i18n, t } = useTranslation('translation', { keyPrefix: 'components.home.homeGridEpochResults', }); const { isMobile } = useMediaQuery(); @@ -60,13 +60,13 @@ const EpochResultsDetails: FC = ({ details }) => { <>
{details.name}
- {isMobile ? t('donationsShort') : t('donations')} {donationsToDisplay} + {isMobile ? t('donationsShort') : i18n.t('common.donations')} {donationsToDisplay}
- {isMobile ? t('matchingShort') : t('matching')} {matchingToDisplay} + {isMobile ? t('matchingShort') : i18n.t('common.matching')} {matchingToDisplay}
- {isMobile ? t('totalShort') : t('total')} {totalToDisplay} + {isMobile ? t('totalShort') : i18n.t('common.total')} {totalToDisplay}
{!isMobile && (
- {/* {isHeaderVisible && ( - - {showHeaderBlur &&
} -
-
-
- - {networkConfig.isTestnet && ( -
-
{networkConfig.name}
-
- )} -
-
- {isConnected && address ? ( -
isUserTOSAccepted && setIsWalletModalOpen(true)} - > -
-
- {(isProjectAdminMode || isPatronMode) && ( -
- {isProjectAdminMode ? t('admin') : t('patron')} -
- )} - -
- {truncatedEthAddress} -
-
- {!!currentEpoch && - currentEpoch > 1 && - (showAllocationPeriod ? ( -
- , - ]} - i18nKey={ - isDecisionWindowOpen - ? 'layout.main.allocationEndsIn' - : 'layout.main.allocationStartsIn' - } - values={{ currentPeriod }} - /> -
- ) : ( -
{individualRewardText}
- ))} -
-
- ) : ( -
-
-
- - )} */}
= ({ !!navigationBottomSuffix && styles.isNavigationBottomSuffix, classNameBody, )} - data-test="MainLayout__body" + data-test="Layout__body" id={LAYOUT_BODY_ID} > - {isLoading ? : children} + {isLoading ? : children}
{!isDesktop && isNavigationVisible && ( diff --git a/client/src/components/shared/Layout/LayoutNavbar/LayoutNavbar.module.scss b/client/src/components/shared/Layout/LayoutNavbar/LayoutNavbar.module.scss index bbd81d94d..27a8b07c0 100644 --- a/client/src/components/shared/Layout/LayoutNavbar/LayoutNavbar.module.scss +++ b/client/src/components/shared/Layout/LayoutNavbar/LayoutNavbar.module.scss @@ -4,7 +4,8 @@ } .navigationWrapper { - @include layoutFloatingElementWidth(); + width: 100%; + min-width: 39rem; display: flex; justify-content: center; position: fixed; diff --git a/client/src/components/shared/ViewTitle/ViewTitle.module.scss b/client/src/components/shared/ViewTitle/ViewTitle.module.scss index b175639f9..aa3189468 100644 --- a/client/src/components/shared/ViewTitle/ViewTitle.module.scss +++ b/client/src/components/shared/ViewTitle/ViewTitle.module.scss @@ -11,4 +11,12 @@ height: 14.4rem; font-size: $font-size-32; } + + @media #{$desktop-up} { + font-size: $font-size-40; + } + + @media #{$large-desktop-up} { + font-size: $font-size-48; + } } diff --git a/client/src/constants/store.ts b/client/src/constants/store.ts deleted file mode 100644 index c944d141b..000000000 --- a/client/src/constants/store.ts +++ /dev/null @@ -1 +0,0 @@ -export const REQUEST_ACTIONS_SPACER = '_'; diff --git a/client/src/hooks/events/useAllocate.ts b/client/src/hooks/events/useAllocate.ts index 8b06a33a4..1bda81b8b 100644 --- a/client/src/hooks/events/useAllocate.ts +++ b/client/src/hooks/events/useAllocate.ts @@ -4,11 +4,11 @@ import { useAccount, useSignTypedData } from 'wagmi'; import { SignatureOpType, apiPostPendingMultisigSignatures } from 'api/calls/multisigSignatures'; import { apiGetSafeMessages } from 'api/calls/safeMessages'; import { handleError } from 'api/errorMessages'; +import { AllocationValues } from 'components/Allocation/types'; import networkConfig from 'constants/networkConfig'; import useIsContract from 'hooks/queries/useIsContract'; import { getAllocationsMapped } from 'hooks/utils/utils'; import { WebsocketEmitEvent } from 'types/websocketEvents'; -import { AllocationValues } from 'views/AllocationView/types'; const websocketService = () => import('services/websocketService'); diff --git a/client/src/hooks/helpers/useNavigationTabs.tsx b/client/src/hooks/helpers/useNavigationTabs.tsx index 75be2ab61..2ba1a5853 100644 --- a/client/src/hooks/helpers/useNavigationTabs.tsx +++ b/client/src/hooks/helpers/useNavigationTabs.tsx @@ -22,7 +22,7 @@ const useNavigationTabs = (isTopBar?: boolean): NavigationTab[] => { // TODO: patron mode support -> https://linear.app/golemfoundation/issue/OCT-1893/layout-patron-mode // const { data: isPatronMode } = useIsPatronMode(); - const { t } = useTranslation('translation', { keyPrefix: 'layout.navigationTabs' }); + const { i18n, t } = useTranslation('translation', { keyPrefix: 'layout.navigationTabs' }); const { isConnected } = useAccount(); const { data: isUserTOSAccepted } = useUserTOS(); const { pathname } = useLocation(); @@ -45,7 +45,7 @@ const useNavigationTabs = (isTopBar?: boolean): NavigationTab[] => { ROOT_ROUTES.projects.absolute === pathname || pathname.includes(`${ROOT_ROUTES.project.absolute}/`), key: 'projects', - label: t('projects'), + label: i18n.t('common.projects'), to: ROOT_ROUTES.projects.absolute, }, { diff --git a/client/src/hooks/mutations/useAllocateSimulate.ts b/client/src/hooks/mutations/useAllocateSimulate.ts index 0922389fa..f90602171 100644 --- a/client/src/hooks/mutations/useAllocateSimulate.ts +++ b/client/src/hooks/mutations/useAllocateSimulate.ts @@ -3,8 +3,8 @@ import { useRef } from 'react'; import { useAccount } from 'wagmi'; import { apiPostAllocateLeverage, ApiPostAllocateLeverageResponse } from 'api/calls/allocate'; +import { AllocationValues } from 'components/Allocation/types'; import { getAllocationsMapped } from 'hooks/utils/utils'; -import { AllocationValues } from 'views/AllocationView/types'; export type AllocateSimulate = Omit & { threshold: bigint; diff --git a/client/src/hooks/utils/utils.ts b/client/src/hooks/utils/utils.ts index dbe8cc528..06761e979 100644 --- a/client/src/hooks/utils/utils.ts +++ b/client/src/hooks/utils/utils.ts @@ -1,6 +1,6 @@ +import { AllocationValues } from 'components/Allocation/types'; import { formatUnitsBigInt } from 'utils/formatUnitsBigInt'; import { parseUnitsBigInt } from 'utils/parseUnitsBigInt'; -import { AllocationValues } from 'views/AllocationView/types'; export function getAllocationsMapped( allocationValues: AllocationValues, diff --git a/client/src/locales/en/translation.json b/client/src/locales/en/translation.json index 86be90a9a..ef1f37595 100644 --- a/client/src/locales/en/translation.json +++ b/client/src/locales/en/translation.json @@ -25,8 +25,6 @@ }, "common": { "availableNow": "Available now", - "calculateRewards": "Calculate rewards", - "estimateRewards": "Estimate rewards", "close": "Close", "copied": "Copied", "copy": "Copy link", @@ -34,17 +32,11 @@ "donations": "Donations", "done": "Done", "gettingStarted": "Getting started", - "history": "History", "lockGlm": "Lock GLM", - "octantTips": "Octant tips", "personal": "Personal", "personalAllocation": "Personal allocation", "projectForbiddenOperation": "As a project you are not able to proceed with this operation", "rewards": "Rewards {{rewards}}", - "thresholdDataUnavailable": { - "desktop": "Threshold data unavailable", - "mobile": "No threshold data" - }, "matchFunding": "Match funding", "valueCantBeEmpty": "Value can't be empty", "lessThan1m": "less than 1m", @@ -52,7 +44,15 @@ "projects": "Projects", "available": "Available", "totalDonated": "Total donated", - "waitingForConfirmation": "Waiting for confirmation" + "waitingForConfirmation": "Waiting for confirmation", + "pending": "Pending", + "amount": "Amount", + "edit": "Edit", + "donated": "Donated", + "lockedGLM": "Locked GLM", + "unlockedGLM": "Unlocked GLM", + "total": "Total", + "matching": "Matching" }, "components": { "allocation": { @@ -93,9 +93,6 @@ "mobile": "You will receive only 20% of the max. match funding. Visit <0>Settings to recalculate before you allocate" } } - }, - "modalAllocationValuesEdit": { - "header": "Edit {{allocation}}" } }, "shared": { @@ -107,10 +104,8 @@ "homeRewards": { "currentRewards": "Current rewards", "currentDonations": "Current donations", - "donations": "Donations", "totalRewards": "Total rewards", "currentMatchFunding": "Current match funding", - "matchFunding": "Match funding", "rewardsRate": "Rewards rate", "epochTotalMatchFunding": "Epoch total match funding", "epochMF": "Epoch MF" @@ -120,33 +115,20 @@ "yourFunds": "Your funds", "editLockedGLM": "Edit Locked GLM", "effective": "Effective", - "pending": "Pending", - "lockedBalance": "Locked balance", "tooltipText": "Effective lock (EL) is the part of your locked GLM that is currently earning rewards. Equal to your current balance, if that is unchanged during the ongoing epoch. Increase lock & EL increases proportionally to epoch time remaining. Decrease lock & this amount is removed from EL for the epoch.", "modalLockGlm": { "unlockGLM": "Unlock GLM", "lockGlmBudgetBox": { - "approve2Transactions": "Please approve 2 transactions in your wallet. The first (required only once and for locking) allows ERC-20 tokens, and the second locks / unlocks GLM.", "currentlyLocked": "Currently Locked", - "stakeWillUpdate": "Your stake will update when the transaction is confirmed", - "waitingForTransactionHash": "Waiting for transaction hash from Etherscan...", - "walletBalance": "Wallet balance", - "viewOnEtherscan": "View on Etherscan" + "walletBalance": "Wallet balance" } } }, "homeGridPersonalAllocation": { - "personalAllocation": "Personal allocation", - "patronEarnings": "Patron earnings", - "pending": "Pending", "withdrawToWallet": "Withdraw to wallet", "pendingFundsAvailableAfter": "Pending funds available after", - "currentEpoch": "Current epoch", "modalWithdrawEth": { "withdrawETH": "Withdraw ETH", - "withdrawalsDistributedEpoch": "Withdrawals are distributed when Epoch {{currentEpoch}} ends", - "rewardsBudget": "Rewards Budget", - "amount": "Amount", "estimatedGasPrice": "Est. gas price", "withdrawAll": "Withdraw all" } @@ -175,7 +157,6 @@ "calculatingYourUniquenessStep3": "Delegation will not link your addresses or compromise your privacy in any way.

We require proof of uniqueness to defend against sybil attacks as we have switched to a quadratic funding model.

To learn more, check out Gitcoin’s handy guide to <0>scoring 20, for humans." }, "modalCalculatingUQScore": { - "switchAccounts": "Switch accounts", "signMessages": "Sign messages", "switchAccount": "Switch account", "calculatingScore": "Calculating score", @@ -201,20 +182,15 @@ "modalTransactionDetails": { "header": { "allocation": "Epoch {{epoch}} Allocations", - "lock": "Locked GLM", - "unlock": "Unlocked GLM", "withdrawal": "Withdrew ETH" }, "sections": { - "allocationPersonal": "Personal", "allocationProjects": "Projects ({{projectsNumber}})", - "amount": "Amount", "gasPrice": "Gas price", "viewOnEtherscan": "View on Etherscan", "estimatedLeverage": "Est. leverage", "finalMatchFunding": "Final match funding", "when": "When", - "withdrawal": "Withdrew ETH", "matchingFundDonation": "Matching fund donation", "leverageUnknown": "Unknown", "allocationTooltips": { @@ -229,33 +205,24 @@ }, "transactionsListItem": { "allocatedRewards": "Allocated rewards", - "lockedGLM": "Locked GLM", - "unlockedGLM": "Unlocked GLM", - "projects": "Projects", "withdrawnFunds": "Withdrawn funds", "epochDonation": "Epoch {{epoch}} donation" }, "transactionLabel": { "confirmed": "Confirmed", - "pending": "Pending", "pendingMultisig": "Pending multisig" } }, "homeGridDonations": { - "donations": "Donations", "donationHistory": "Donation history", "noDonationsYet": "No donations yet. Lock GLM
and earn rewards to donate", - "noDonationsYetAWOpen": "No donations yet in this
allocation window.", - "edit": "Edit" + "noDonationsYetAWOpen": "No donations yet in this
allocation window." }, "homeGridEpochResults": { "epochResults": "Epoch {{epoch}} results", "epochLive": "Epoch {{epoch}} live", - "donations": "Donations", "donationsShort": "D", - "matching": "Matching", "matchingShort": "M", - "total": "Total", "totalShort": "T", "clickToVisitProject": "Click to visit project" } @@ -282,41 +249,16 @@ "saveToAllocate": "Save to allocate", "saved": "Saved", "removeFromAllocate": "Remove from allocate", - "removed": "Removed", - "donated": "Donated" - }, - "rewardsCalculator": { - "modalHeaderTooltip": "Calculator assumes GLM is locked before allocation window and remains locked until the next window. Estimated match funding is based on 100% of rewards being allocated to projects.", - "estimates": "Estimates", - "enterGLMAmount": "Enter a GLM amount", - "lockForEpoch_one": "Lock for {{count}} epoch", - "lockForEpoch_other": "Lock for {{count}} epochs", - "estimatedRewards": "Estimated rewards", - "uqSelector": { - "header": "UQ Score 20+", - "isUqScoreOver20_true": "Yes", - "isUqScoreOver20_false": "No" - }, - "errors": { - "valueCryptoTooBig": "That isn’t a valid amount" - } - }, - "allocationInfoBoxes": { - "decisionWindowClosed": "The decision window is now closed. Allocating funds is not possible.", - "connectWallet": "In order to manipulate allocation values and vote, please connect your wallet first." + "removed": "Removed" }, "allocationNavigation": { "confirm": "Confirm", - "edit": "Edit", "reset": "Reset", "waiting": "Waiting" }, "allocationRewardsBox": { - "title": "Allocate rewards", - "subtitle": "{{individualReward}} available", "subtitleNoRewards": "No rewards yet", "donate": "Donate", - "donated": "Donated", "donateWithPercentage": "Donate {{percentage}}%", "personalWithPercentage": "Personal {{percentage}}%", "allocated": "Allocated", @@ -326,38 +268,7 @@ "allocationSummary": { "totalImpact": "Total impact", "estimatedLeverage": "Est. leverage", - "confirmYourAllocations": "Confirm your allocations", - "confirmAllocations": "Confirm allocations", - "allocationProjects": "Projects ({{projectsNumber}})", - "tooltip": "<0>Leverage shows the multiplier effect of your donation to the projects you chose. Note that leverage will fluctuate significantly and might be very different at the end of the allocation window." - }, - "allocationInputsRewardsAvailable": { - "resetAllocations": "Reset allocations to manually edit this project", - "valueExceeded": "You can't allocate more than", - "rewardsAvailable": "Rewards available" - }, - "boxGlmLock": { - "current": "Current", - "editLockedGLM": "Edit Locked GLM", - "effective": "Effective", - "lockedBalance": "Locked balance", - "tooltipText": "Effective lock (EL) is the part of your locked GLM that is currently earning rewards. Equal to your current balance, if that is unchanged during the ongoing epoch. Increase lock & EL increases proportionally to epoch time remaining. Decrease lock & this amount is removed from EL for the epoch." - }, - "boxPersonalAllocation": { - "patronEarnings": "Patron earnings", - "pending": "Pending", - "withdrawToWallet": "Withdraw to wallet", - "pendingFundsAvailableAfter": "Pending funds available after", - "allTime": "All time", - "currentEpoch": "Current epoch" - }, - "budgetBox": { - "approve2Transactions": "Please approve 2 transactions in your wallet. The first (required only once and for locking) allows ERC-20 tokens, and the second locks / unlocks GLM.", - "currentlyLocked": "Currently Locked", - "stakeWillUpdate": "Your stake will update when the transaction is confirmed", - "waitingForTransactionHash": "Waiting for transaction hash from Etherscan...", - "walletBalance": "Wallet balance", - "viewOnEtherscan": "View on Etherscan" + "allocationProjects": "Projects ({{projectsNumber}})" }, "connectWallet": { "browserWallet": "Browser wallet", @@ -365,14 +276,6 @@ "walletConnect": "WalletConnect", "ledgerConnect": "Ledger" }, - "donationEstimateBox": { - "donationEstimate": "Donation estimate", - "showDetails": "Show details", - "hideDetails": "Hide details", - "totalDonationEstimate": "Total donation estimate", - "yourTotal": "Your total", - "matchFundingEstimate": "Match Funding estimate" - }, "donors": { "donationsNotEnabled": "Donations are not enabled in this epoch", "noDonationsYet": "No donations yet", @@ -406,22 +309,9 @@ } } }, - "metricsTimeSection": { - "epochEndsIn": "Epoch {{currentEpoch}} ends in", - "epochAllocationEndsIn": "Epoch {{currentEpoch}} Allocation ends in" - }, - "modalAllocationEditSelection": { - "uncheckToRemove": "Uncheck to remove" - }, "modalConnectWallet": { "connectVia": "Connect via" }, - "modalGlmLock": { - "unlockGLM": "Unlock GLM" - }, - "modalWithdrawEth": { - "withdrawETH": "Withdraw ETH" - }, "projectRewards": { "epoch": "Epoch {{epoch}}", "currentTotal": "Current total", @@ -432,8 +322,7 @@ "didNotReachThreshold": "Did not reach threshold" }, "projectsList": { - "epochArchive": "Epoch {{epoch}} Archive", - "noSearchResults": "No luck, please try again" + "epochArchive": "Epoch {{epoch}} Archive" }, "timeCounter": { "hours": "Hours", @@ -447,20 +336,12 @@ "balances": "Balances", "wallet": "Wallet", "disconnectWallet": "Disconnect Wallet" - }, - "withdrawEth": { - "withdrawalsDistributedEpoch": "Withdrawals are distributed when Epoch {{currentEpoch}} ends", - "rewardsBudget": "Rewards Budget", - "amount": "Amount", - "estimatedGasPrice": "Est. gas price", - "withdrawAll": "Withdraw all" } } }, "layout": { "navigationTabs": { "home": "Home", - "projects": "Projects", "metrics": "Metrics", "settings": "Settings", "allocate": "Allocate" @@ -487,15 +368,6 @@ "farcaster": "Farcaster", "twitterX": "Twitter/X" } - }, - "main": { - "buttonConnect": "Connect", - "noRewardsYet": "No rewards yet", - "loadingRewardBudget": "Loading reward budget...", - "allocationStartsIn": "Allocation starts in <0>{{currentPeriod}}", - "allocationEndsIn": "Allocation ends in <0>{{currentPeriod}}", - "admin": "Admin", - "patron": "Patron" } }, "meta": { @@ -515,89 +387,29 @@ "home": { "title": "Welcome to Epoch {{epoch}}" }, - "earn": { - "tips": { - "withdrawEth": { - "title": "Withdraw ETH", - "text": { - "desktop": "Rewards you allocate to yourself can be withdrawn to your wallet here in the Earn view once the allocation window has closed", - "mobile": "Rewards you allocate to yourself can be withdrawn to your wallet here in the Earn view" - } - }, - "connectWallet": { - "title": { - "desktop": "Connect your wallet", - "mobile": "Connect wallet" - }, - "text": { - "desktop": "Please connect your wallet to get started. You will need it to lock GLM, receive rewards and to prove your uniqueness", - "mobile": "Please connect your wallet to Octant in order to participate in this and future epochs" - } - }, - "lockGlm": { - "title": "Lock GLM to earn", - "text": { - "desktop": "Lock GLM for at least one complete epoch to earn ETH rewards you can donate (and get match funding) or allocate to yourself", - "mobile": "Lock GLM for at least 1 complete epoch to earn ETH rewards you can donate or withdraw" - } - }, - "allocateYourRewards": { - "title": "Allocate your rewards", - "text": { - "desktop": "Unallocated rewards will be swept back for restaking at the end of this allocation window, so don't forget to allocate!", - "mobile": "Unallocated rewards will be swept back for restaking at the end of this allocation window" - } - } - }, - "preLaunch": { - "timerTitle": "Octant launches in" - } - }, "metrics": { + "epoch1Info": "It's Epoch 1, so there are no metrics for the past. It's just a placeholder, please come back in Epoch 2.", "exploreTheData": "Explore the data", "fundingLeaderboard": "Funding leaderboard", - "donors": "Donors", - "personal": "Personal", - "donations": "Donations", - "matchFunding": "Match funding", - "total": "Total", "donatedToProjects": "Donated to projects", "claimedByUsers": "Claimed by users", "open": "Open", - "overview": "Overview", "epoch": "Epoch", "epochAllocationWindow": "Epoch {{epoch}} Allocation Window", "epochAllocation": "E{{epoch}} Allocation", - "yourMetrics": "Your metrics", - "totalRewards": "Total rewards", - "allocationsInEth": "Allocations in ETH", "generalMetrics": "General metrics", - "totalWithdrawals": "Total withdrawals", "donationsVsPersonal": "Donations vs personal", "donationsVsMatchFunding": "Donations vs match funding", "totalMatching": "Total matching", - "matching": "Matching", - "patronModeActive": "Patron mode active", - "patronModeActiveLabel": "{{numberOfEpochs}} epochs", - "donatedAsPatron": "Donated as patron", - "noAllocationsYet": "No allocations yet", "totalProjects": "Total projects", "totalEthStaked": "Total ETH Staked", "totalGlmLocked": "Total GLM Locked", "of1BTotalSupply": "of 1B total supply", - "totalAddresses": "Total addresses", "cumulativeGlmLocked": "Cumulative GLM Locked", "walletsWithGlmLocked": "Wallets with GLM locked", - "epochAllocationStartsIn": "Epoch {{epoch}} allocation starts in", - "epochAllocationEndsIn": "Epoch {{epoch}} allocation ends in", "totalProjectsSinceEpoch0": "{{projectsAmount}} total since E0", - "connectWalletTip": { - "title": "Connect your wallet", - "text": "To see your own personal stats here, <0/>you will need to connect your wallet" - }, "belowThreshold": "Below threshold", "ethBelowThreshold": "ETH Below threshold", - "totalPersonal": "Total personal", "totalDonations": "Total donations", "averageLeverage": "Average leverage", "currentDonors": "Current donors", @@ -605,7 +417,6 @@ "rewardsUnused": "Rewards unused", "unallocatedValue": "Unallocated value", "users": "Users", - "topProjectsByEthRaised": "Top {{numberOfProjects}} projects by ETH raised", "totalUsers": "Total users", "fundsUsage": "Epoch {{epoch}} funds usage ", "epochTotal": "Epoch {{epoch}} Total", @@ -694,55 +505,13 @@ "epoch": "Epoch {{epoch}}", "golemFoundationProject": "A Golem Foundation Project", "poweredByCoinGeckoApi": "Powered by CoinGecko API", - "termsAndConditions": "Terms & Conditions", "chooseDisplayCurrency": "Choose a display currency", "cryptoMainValueDisplay": "Use ETH as main value display", "alwaysShowOnboarding": "Always show onboarding", "alwaysShowOctantTips": "Always show tips", "enablePatronMode": "Enable patron mode", "patronModeTooltip": "Patron mode is for token holders who want to support Octant. It disables allocation to yourself or projects. All rewards go directly to the matching fund with no action required by the patron.", - "octantBuild": "Octant.build", - "userDocs": "User Docs", - "discordCommunity": "Discord Community", - "website": "Website", - "visitWebsite": "Visit the website", - "discord": "Discord", - "joinOurDiscord": "Join our Discord", - "docs": "Docs", - "octantInfo": "Octant is a platform for experiments in decentralized governance that reward participation. Learn more below.", - "recalculatingScore": "Recalculating score", - "calculatingScore": "Calculating score", - "checkingPassportScore": "Checking Passport score", - "finished": "Finished", - "checkingAllowlist": "Checking allowlist", - "checkOutDocs": "Check out the docs", - "yourUniquenessScore": "Your uniqueness score", - "recalculate": "Recalculate", - "delegate": "Delegate", - "whatIsThis": "What is this?", - "scoreTooLow": "Score too low? Visit the Octant Passport dashboard", - "addresses": "addresses", - "calculatingYourUniqueness": "Calculating your uniqueness", - "switchAccounts": "Switch accounts", - "calculatingYourUniquenessStep1": "To prove your uniqueness your need a <0>Gitcoin\u00a0Passport score of 20 or higher.

If you have this your donations will attract the maximum amount of match funding. If not, maximum match funding will be set to 20%.

You can increase your score in a couple of different ways.", - "calculatingYourUniquenessStep2": "You can go to our <0>Passport dashboard and add stamps to the score for your Octant address.

If your Passport score is not on your primary address, you can delegate your score from another address with a 20+ Passport score.

You can only do this once, and it must be done before allocating to benefit the current epoch.", - "calculatingYourUniquenessStep3": "Delegation will not link your addresses or compromise your privacy in any way.

We require proof of uniqueness to defend against sybil attacks as we have switched to a quadratic funding model.

To learn more, check out Gitcoin’s handy guide to <0>scoring 20, for humans.", - "primary": "Primary", - "delegationFailedText": "Delegation failed — your score needs to be 20 or higher. Please try another address", - "delegationMessageToSign": "Delegation of UQ score from {{delegationSecondaryAddress}} to {{delegationPrimaryAddress}}", - "signMessage": "Sign message", - "signMessages": "Sign messages", - "switchAccount": "Switch account", - "toasts": { - "delegationTooManyUniqueAddresses": { - "title": "Too many accounts", - "message": "Please connect up to 10 accounts to check your delegation status" - }, - "unableToDelegateToAddressWithPositiveGLMLock": { - "title": "Address with GLM locked", - "message": "Please delegate to an address without GLM locked" - } - } + "docs": "Docs" }, "syncStatus": { "information": "We're synchronizing things to prepare the
next epoch, so the app will be unavailable
for a little while. Please check back soon." diff --git a/client/src/routes/RootRoutes/RootRoutes.tsx b/client/src/routes/RootRoutes/RootRoutes.tsx index 1d8c822d2..aaff0a0af 100644 --- a/client/src/routes/RootRoutes/RootRoutes.tsx +++ b/client/src/routes/RootRoutes/RootRoutes.tsx @@ -7,13 +7,13 @@ import useMediaQuery from 'hooks/helpers/useMediaQuery'; import useCurrentEpoch from 'hooks/queries/useCurrentEpoch'; import useIsPatronMode from 'hooks/queries/useIsPatronMode'; import getIsPreLaunch from 'utils/getIsPreLaunch'; -import AllocationView from 'views/AllocationView/AllocationView'; -import HomeView from 'views/HomeView/HomeView'; -import MetricsView from 'views/MetricsView/MetricsView'; -import PlaygroundView from 'views/PlaygroundView/PlaygroundView'; -import ProjectsView from 'views/ProjectsView/ProjectsView'; -import ProjectView from 'views/ProjectView/ProjectView'; -import SettingsView from 'views/SettingsView/SettingsView'; +import AllocationView from 'views/AllocationView'; +import HomeView from 'views/HomeView'; +import MetricsView from 'views/MetricsView'; +import PlaygroundView from 'views/PlaygroundView'; +import ProjectsView from 'views/ProjectsView'; +import ProjectView from 'views/ProjectView'; +import SettingsView from 'views/SettingsView'; import { ROOT_ROUTES } from './routes'; diff --git a/client/src/routes/RootRoutes/routes.ts b/client/src/routes/RootRoutes/routes.ts index 4c6955281..a8bddb7dc 100644 --- a/client/src/routes/RootRoutes/routes.ts +++ b/client/src/routes/RootRoutes/routes.ts @@ -5,13 +5,11 @@ const PROJECT_PREFIX = 'project'; export const ROOT_ROUTES = { allocation: getPathObject(ROOT, 'allocation'), - earn: getPathObject(ROOT, 'earn'), home: getPathObject(ROOT, 'home'), metrics: getPathObject(ROOT, 'metrics'), playground: getPathObject(ROOT, 'playground'), project: getPathObject(ROOT, PROJECT_PREFIX), projectWithAddress: getPathObject(ROOT, `${PROJECT_PREFIX}/:epoch/:projectAddress`), projects: getPathObject(ROOT, 'projects'), - settings: getPathObject(ROOT, 'settings'), }; diff --git a/client/src/styles/utils/_keyframes.scss b/client/src/styles/utils/_keyframes.scss index 6503bef4d..06a5c5b73 100644 --- a/client/src/styles/utils/_keyframes.scss +++ b/client/src/styles/utils/_keyframes.scss @@ -1,53 +1,44 @@ -@keyframes scale1 { +@keyframes wave { 0% { - transform: scale(1); - } - 50% { - transform: scale(1.2); + background-position: -46.8rem 0; } 100% { - transform: scale(1); + background-position: 46.8rem 0; } } -@keyframes spin { +@keyframes horizontal-shaking { 0% { - transform: rotate(0deg); + transform: translateX(0); + } + 25% { + transform: translateX(0.5rem); + } + 50% { + transform: translateX(-0.5rem); + } + 75% { + transform: translateX(0.5rem); } 100% { - transform: rotate(360deg); + transform: translateX(0); } } -@keyframes wave { +@keyframes pulsatingOpacity { 0% { - background-position: -46.8rem 0; + opacity: 1; + } + 25% { + opacity: 0.5; + } + 50% { + opacity: 0; + } + 75% { + opacity: 0.5; } 100% { - background-position: 46.8rem 0; + opacity: 1; } } - -@keyframes horizontal-shaking { - 0% { transform: translateX(0) } - 25% { transform: translateX(0.5rem) } - 50% { transform: translateX(-0.5rem) } - 75% { transform: translateX(0.5rem) } - 100% { transform: translateX(0) } -} - -@keyframes pulsatingOpacity { - 0% { opacity: 1 } - 25% { opacity: 0.5 } - 50% { opacity: 0 } - 75% { opacity: 0.5 } - 100% { opacity: 1 } - } - -@keyframes movingLeftAndRight { - 0% { left: -100% } - 25% { left: 0 } - 50% { left: 100% } - 75% { left: 75% } - 100% { left: -100% } -} diff --git a/client/src/styles/utils/_mixins.scss b/client/src/styles/utils/_mixins.scss index bb7033dad..b9c2cbefc 100644 --- a/client/src/styles/utils/_mixins.scss +++ b/client/src/styles/utils/_mixins.scss @@ -36,10 +36,6 @@ ); } -@mixin boldText() { - font-weight: $font-weight-superbold; -} - @mixin layoutOverflowBlurCommonProperties() { backdrop-filter: blur(2rem); -webkit-backdrop-filter: blur(2rem); @@ -81,16 +77,3 @@ */ font-variant-ligatures: no-contextual; } - -@mixin layoutFloatingElementWidth() { - width: 100%; - min-width: 39rem; -} - -@mixin tipTileConnectWalletImage() { - height: 8.2rem; - - @media #{$desktop-up} { - height: 11.3rem; - } -} diff --git a/client/src/styles/utils/_variables.scss b/client/src/styles/utils/_variables.scss index a61a651e0..c938bc584 100644 --- a/client/src/styles/utils/_variables.scss +++ b/client/src/styles/utils/_variables.scss @@ -28,7 +28,6 @@ $z-index-7: 7; // modals $z-index-8: 8; // connect wallet modal // distances -$headerHeight: 7.2rem; $layoutMarginHorizontal: 2.4rem; $progressStepperSlimStepPadding: 2.4rem; $modalVariantSmallPaddingMobile: 2.4rem; diff --git a/client/src/svg/history.ts b/client/src/svg/history.ts deleted file mode 100644 index a4ab6efb8..000000000 --- a/client/src/svg/history.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { SvgImageConfig } from 'components/ui/Svg/types'; - -export const allocate: SvgImageConfig = { - markup: - '', - viewBox: '0 0 40 40', -}; - -export const donation: SvgImageConfig = { - markup: - '', - viewBox: '0 0 40 40', -}; diff --git a/client/src/svg/misc.ts b/client/src/svg/misc.ts index db7b9a322..d38c29a85 100644 --- a/client/src/svg/misc.ts +++ b/client/src/svg/misc.ts @@ -36,18 +36,6 @@ export const heart: SvgImageConfig = { viewBox: '0 0 32 32', }; -export const plus: SvgImageConfig = { - markup: - '', - viewBox: '0 0 15 15', -}; - -export const minus: SvgImageConfig = { - markup: - '', - viewBox: '0 0 14 2', -}; - export const notificationIconWarning: SvgImageConfig = { markup: '', @@ -78,12 +66,6 @@ export const checkMark: SvgImageConfig = { viewBox: '0 0 32 32', }; -export const pencil: SvgImageConfig = { - markup: - '', - viewBox: '0 0 24 24', -}; - export const share: SvgImageConfig = { markup: '', diff --git a/client/src/svg/navigation.ts b/client/src/svg/navigation.ts index aa945853c..efe5b6ec9 100644 --- a/client/src/svg/navigation.ts +++ b/client/src/svg/navigation.ts @@ -27,12 +27,6 @@ export const settings: SvgImageConfig = { viewBox: '0 0 22 22', }; -export const earn: SvgImageConfig = { - markup: - '', - viewBox: '0 0 32 32', -}; - export const chevronLeft: SvgImageConfig = { markup: '', diff --git a/client/src/views/AllocationView/AllocationView.module.scss b/client/src/views/AllocationView/AllocationView.module.scss deleted file mode 100644 index 23b033090..000000000 --- a/client/src/views/AllocationView/AllocationView.module.scss +++ /dev/null @@ -1,28 +0,0 @@ -.body.isWaitingForAllMultisigSignatures { - opacity: 0.5; -} - -.box { - &:not(:last-child) { - margin: 0 auto 1.6rem; - } -} - -.initialSignatureMessage { - color: $color-octant-orange; - display: block; - text-align: right; - margin-top: 0.6rem; - margin-bottom: -1rem; - - @media #{$desktop-up} { - margin-bottom: -1.8rem; - } - - .text { - font-weight: $font-weight-bold; - color: $color-octant-orange; - line-height: 1.4rem; - font-size: $font-size-10; - } -} diff --git a/client/src/components/Earn/EarnBoxGlmLock/index.tsx b/client/src/views/AllocationView/index.tsx similarity index 53% rename from client/src/components/Earn/EarnBoxGlmLock/index.tsx rename to client/src/views/AllocationView/index.tsx index ced474dc2..fcb4c2104 100644 --- a/client/src/components/Earn/EarnBoxGlmLock/index.tsx +++ b/client/src/views/AllocationView/index.tsx @@ -1,2 +1,2 @@ // eslint-disable-next-line no-restricted-exports -export { default } from './EarnBoxGlmLock'; +export { default } from './AllocationView'; diff --git a/client/src/views/AllocationView/types.ts b/client/src/views/AllocationView/types.ts deleted file mode 100644 index dc9a9db4e..000000000 --- a/client/src/views/AllocationView/types.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { UserAllocationElement } from 'hooks/queries/useUserAllocations'; - -export type UserAllocationElementString = Omit & { - value: string; -}; - -export type PercentageProportions = { - [key: string]: number; -}; - -export type AllocationValue = { - address: string; - value: string; -}; - -export type AllocationValues = AllocationValue[]; - -export type AllocationWithPositiveValueBigInt = { - projectAddress: string; - value: bigint; -}; diff --git a/client/src/views/AllocationView/utils.test.ts b/client/src/views/AllocationView/utils.test.ts deleted file mode 100644 index 906ee5ca7..000000000 --- a/client/src/views/AllocationView/utils.test.ts +++ /dev/null @@ -1,379 +0,0 @@ -/* eslint-disable @typescript-eslint/naming-convention */ - -import { formatUnitsBigInt } from 'utils/formatUnitsBigInt'; -import { parseUnitsBigInt } from 'utils/parseUnitsBigInt'; - -import { - getAllocationValuesInitialState, - getAllocationValuesAfterManualChange, - getAllocationValuesWithRewardsSplitted, -} from './utils'; - -describe('getAllocationValuesWithRewardsSplitted', () => { - it('properly distributes the difference when sum is lower than restToDistribute', () => { - expect( - getAllocationValuesWithRewardsSplitted({ - allocationValues: [ - { address: '0xA', value: '0.2' }, - { address: '0xB', value: '0.3' }, - { address: '0xC', value: '0.5' }, - ], - restToDistribute: parseUnitsBigInt('2'), - }), - ).toEqual([ - { address: '0xA', value: '0.2' }, - { address: '0xB', value: '0.3' }, - { address: '0xC', value: '1.5' }, - ]); - }); - - it('properly distributes the difference when sum is lower than restToDistribute and last element cant fill the difference', () => { - expect( - getAllocationValuesWithRewardsSplitted({ - allocationValues: [ - { address: '0xA', value: '0.2' }, - { address: '0xB', value: '0.3' }, - { address: '0xC', value: '0' }, - ], - restToDistribute: parseUnitsBigInt('2'), - }), - ).toEqual([ - { address: '0xA', value: '1.7' }, - { address: '0xB', value: '0.3' }, - { address: '0xC', value: '0' }, - ]); - }); - - it('properly distributes the difference when sum is bigger than restToDistribute and last element can fill the difference', () => { - expect( - getAllocationValuesWithRewardsSplitted({ - allocationValues: [ - { address: '0xA', value: '1.0' }, - { address: '0xB', value: '2.0' }, - { address: '0xC', value: '4.5' }, - ], - restToDistribute: parseUnitsBigInt('5'), - }), - ).toEqual([ - { address: '0xA', value: '1.0' }, - { address: '0xB', value: '2.0' }, - { address: '0xC', value: '2' }, - ]); - }); - - it('properly distributes the difference when sum is bigger than restToDistribute and last element cant fill the difference', () => { - expect( - getAllocationValuesWithRewardsSplitted({ - allocationValues: [ - { address: '0xA', value: '1.0' }, - { address: '0xB', value: '4.5' }, - { address: '0xC', value: '0.5' }, - ], - restToDistribute: parseUnitsBigInt('5'), - }), - ).toEqual([ - { address: '0xA', value: '1.0' }, - { address: '0xB', value: '3.5' }, - { address: '0xC', value: '0.5' }, - ]); - }); - - it('returns empty array when given empty array', () => { - expect( - getAllocationValuesWithRewardsSplitted({ - allocationValues: [], - restToDistribute: BigInt(500), - }), - ).toEqual([]); - }); - - it('returns initial values when restToDistribute is zero', () => { - expect( - getAllocationValuesWithRewardsSplitted({ - allocationValues: [ - { address: '0xA', value: formatUnitsBigInt(BigInt(100)) }, - { address: '0xB', value: formatUnitsBigInt(BigInt(200)) }, - { address: '0xC', value: formatUnitsBigInt(BigInt(450)) }, - ], - restToDistribute: BigInt(0), - }), - ).toEqual([ - { address: '0xA', value: formatUnitsBigInt(BigInt(100)) }, - { address: '0xB', value: formatUnitsBigInt(BigInt(200)) }, - { address: '0xC', value: formatUnitsBigInt(BigInt(450)) }, - ]); - }); -}); - -describe('getAllocationValuesInitialState', () => { - const propsCommon = { - allocationValues: [ - { address: '0xA', value: '0.2' }, - { address: '0xB', value: '0.3' }, - { address: '0xC', value: '0.5' }, - ], - allocations: ['0xA', '0xB', '0xC'], - isManualMode: false, - percentageProportions: {}, - rewardsForProjects: parseUnitsBigInt('1'), - shouldReset: false, - userAllocationsElements: [], - }; - - describe('Case A (shouldReset, userAllocations provided)', () => { - it('when allocations match userAllocationsElements', () => { - expect( - getAllocationValuesInitialState({ - ...propsCommon, - allocations: ['0xA', '0xB', '0xC'], - isManualMode: true, - rewardsForProjects: parseUnitsBigInt('0.6'), - shouldReset: true, - userAllocationsElements: [ - { address: '0xA', value: '0.3' }, - { address: '0xB', value: '0.2' }, - { address: '0xC', value: '0.1' }, - ], - }), - ).toEqual([ - { address: '0xA', value: '0.3' }, - { address: '0xB', value: '0.2' }, - { address: '0xC', value: '0.1' }, - ]); - }); - - it('when allocations do not match userAllocationsElements', () => { - expect( - getAllocationValuesInitialState({ - ...propsCommon, - allocations: ['0xA', '0xB', '0xC', '0xD'], - isManualMode: true, - rewardsForProjects: parseUnitsBigInt('0.6'), - shouldReset: true, - userAllocationsElements: [ - { address: '0xA', value: '0.3' }, - { address: '0xB', value: '0.2' }, - { address: '0xC', value: '0.1' }, - ], - }), - ).toEqual([ - { address: '0xA', value: '0.3' }, - { address: '0xB', value: '0.2' }, - { address: '0xC', value: '0.1' }, - { address: '0xD', value: '0' }, - ]); - }); - }); - - describe('Case B (shouldReset, userAllocations not provided)', () => { - it('default', () => { - expect( - getAllocationValuesInitialState({ - ...propsCommon, - allocationValues: [ - { address: '0xA', value: '0.3' }, - { address: '0xB', value: '0.2' }, - { address: '0xC', value: '0.1' }, - ], - isManualMode: false, - rewardsForProjects: parseUnitsBigInt('1'), - userAllocationsElements: [], - }), - ).toEqual([ - { address: '0xA', value: '0.333333333333333333' }, - { address: '0xB', value: '0.333333333333333333' }, - { address: '0xC', value: '0.333333333333333334' }, - ]); - }); - }); - - describe('Case C (!isManualMode) ', () => { - it('when !isManualMode', () => { - expect( - getAllocationValuesInitialState({ - ...propsCommon, - isManualMode: false, - userAllocationsElements: [], - }), - ).toEqual([ - { address: '0xA', value: '0.333333333333333333' }, - { address: '0xB', value: '0.333333333333333333' }, - { address: '0xC', value: '0.333333333333333334' }, - ]); - }); - }); - - describe('Case D (all the rest)', () => { - it('when isManualMode, userAllocationsElements & allocationValues', () => { - expect( - getAllocationValuesInitialState({ - ...propsCommon, - allocationValues: [ - { address: '0xA', value: '0.2' }, - { address: '0xB', value: '0.3' }, - { address: '0xC', value: '0.5' }, - ], - isManualMode: true, - userAllocationsElements: [ - { address: '0xA', value: '0.5' }, - { address: '0xB', value: '0.3' }, - { address: '0xC', value: '0.2' }, - ], - }), - ).toEqual([ - { address: '0xA', value: '0.2' }, - { address: '0xB', value: '0.3' }, - { address: '0xC', value: '0.5' }, - ]); - }); - - it('when isManualMode, userAllocationsElements & !allocationValues', () => { - expect( - getAllocationValuesInitialState({ - ...propsCommon, - allocationValues: [], - isManualMode: true, - userAllocationsElements: [ - { address: '0xA', value: '0.5' }, - { address: '0xB', value: '0.3' }, - { address: '0xC', value: '0.2' }, - ], - }), - ).toEqual([ - { address: '0xA', value: '0.5' }, - { address: '0xB', value: '0.3' }, - { address: '0xC', value: '0.2' }, - ]); - }); - - it('when isManualMode, userAllocationsElements, allocationValues & percentageProportions', () => { - expect( - getAllocationValuesInitialState({ - ...propsCommon, - allocationValues: [ - { address: '0xA', value: '0.2' }, - { address: '0xB', value: '0.3' }, - { address: '0xC', value: '0.5' }, - ], - isManualMode: true, - percentageProportions: { - '0xA': 60, - '0xB': 35, - '0xC': 5, - }, - userAllocationsElements: [ - { address: '0xA', value: '0.5' }, - { address: '0xB', value: '0.3' }, - { address: '0xC', value: '0.2' }, - ], - }), - ).toEqual([ - { address: '0xA', value: '0.6' }, - { address: '0xB', value: '0.35' }, - { address: '0xC', value: '0.05' }, - ]); - }); - }); -}); - -describe('getAllocationValuesAfterManualChange', () => { - const propsCommon = { - allocationValues: [ - { address: '0xA', value: '0.333333333333333333' }, - { address: '0xB', value: '0.333333333333333333' }, - { address: '0xC', value: '0.333333333333333334' }, - ], - allocations: ['0xA', '0xB', '0xC'], - individualReward: parseUnitsBigInt('2'), - isManualMode: false, - newAllocationValue: { - address: '0xA', - value: '0.05', - }, - rewardsForProjects: parseUnitsBigInt('1'), - setAddressesWithError: () => {}, - }; - - it('!individualReward', () => { - expect( - getAllocationValuesAfterManualChange({ ...propsCommon, individualReward: undefined }), - ).toEqual({ - allocationValuesArrayNew: [ - { address: '0xA', value: '0.333333333333333333' }, - { address: '0xB', value: '0.333333333333333333' }, - { address: '0xC', value: '0.333333333333333334' }, - ], - rewardsForProjectsNew: parseUnitsBigInt('1'), - }); - }); - - it('allocationValuesArrayNewSum>(individualReward)', () => { - expect( - getAllocationValuesAfterManualChange({ - ...propsCommon, - newAllocationValue: { - address: '0xA', - value: '100', - }, - }), - ).toEqual({ - allocationValuesArrayNew: [ - { address: '0xA', value: '0' }, - { address: '0xB', value: '0.333333333333333333' }, - { address: '0xC', value: '0.333333333333333334' }, - ], - rewardsForProjectsNew: parseUnitsBigInt('1'), - }); - }); - - it('correctly updates allocationValues when isManualMode', () => { - expect( - getAllocationValuesAfterManualChange({ - ...propsCommon, - isManualMode: true, - }), - ).toEqual({ - allocationValuesArrayNew: [ - { address: '0xA', value: '0.05' }, - { address: '0xB', value: '0.333333333333333333' }, - { address: '0xC', value: '0.333333333333333334' }, - ], - rewardsForProjectsNew: parseUnitsBigInt('0.716666666666666667'), - }); - }); - - it('correctly updates allocationValues when !isManualMode', () => { - expect(getAllocationValuesAfterManualChange(propsCommon)).toEqual({ - allocationValuesArrayNew: [ - { address: '0xA', value: '0.05' }, - { address: '0xB', value: '0.333333333333333333' }, - { address: '0xC', value: '0.616666666666666667' }, - ], - rewardsForProjectsNew: parseUnitsBigInt('1'), - }); - }); - - it('correctly updates allocationValues when !isManualMode, rewardsForProjectsNew is zero when all values are 0', () => { - expect( - getAllocationValuesAfterManualChange({ - ...propsCommon, - allocationValues: [ - { address: '0xA', value: '0.333333333333333333' }, - { address: '0xB', value: '0' }, - { address: '0xC', value: '0' }, - ], - newAllocationValue: { - address: '0xA', - value: '0', - }, - }), - ).toEqual({ - allocationValuesArrayNew: [ - { address: '0xA', value: '0' }, - { address: '0xB', value: '0' }, - { address: '0xC', value: '0' }, - ], - rewardsForProjectsNew: parseUnitsBigInt('0'), - }); - }); -}); diff --git a/client/src/views/AllocationView/utils.ts b/client/src/views/AllocationView/utils.ts deleted file mode 100644 index aaab36aab..000000000 --- a/client/src/views/AllocationView/utils.ts +++ /dev/null @@ -1,292 +0,0 @@ -import React from 'react'; - -import { AllocationItemWithAllocations } from 'components/Allocation/AllocationItem/types'; -import { ProjectIpfsWithRewards } from 'hooks/queries/useProjectsIpfsWithRewards'; -import { formatUnitsBigInt } from 'utils/formatUnitsBigInt'; -import getSortedElementsByTotalValueOfAllocationsAndAlphabetical from 'utils/getSortedElementsByTotalValueOfAllocationsAndAlphabetical'; -import { parseUnitsBigInt } from 'utils/parseUnitsBigInt'; - -import { - AllocationValue, - AllocationValues, - PercentageProportions, - UserAllocationElementString, -} from './types'; - -export function getAllocationValuesWithRewardsSplitted({ - allocationValues, - restToDistribute, -}: { - allocationValues: AllocationValues; - restToDistribute: bigint; -}): AllocationValues { - if (allocationValues.length === 0) { - return []; - } - const allocationValuesNew = [...allocationValues]; - const allocationValuesSum = allocationValuesNew.reduce((acc, { value }) => { - return acc + parseUnitsBigInt(value); - }, BigInt(0)); - - if (restToDistribute === 0n) { - return allocationValues; - } - - /** - * Since percentage calculated in getAllocationValuesInitialState is not perfect, - * chances are allocationValuesSum is lower than restToDistribute. - */ - if (allocationValuesSum < restToDistribute) { - const difference = restToDistribute - allocationValuesSum; - const lastElementValue = parseUnitsBigInt( - allocationValuesNew[allocationValuesNew.length - 1].value, - ); - - // We don't want to add value to element user chose to set as 0. - if (lastElementValue > 0n) { - allocationValuesNew[allocationValuesNew.length - 1].value = formatUnitsBigInt( - lastElementValue + difference, - ); - } else { - // Find first non-zero element. - const elementIndexToChange = allocationValuesNew.findIndex( - element => parseUnitsBigInt(element.value) > 0n, - ); - allocationValuesNew[elementIndexToChange].value = formatUnitsBigInt( - parseUnitsBigInt(allocationValuesNew[elementIndexToChange].value) + difference, - ); - } - } - /** - * Since percentage calculated in getAllocationValuesInitialState is not perfect, - * chances are allocationValuesSum is bigger than restToDistribute. - */ - if (allocationValuesSum > restToDistribute) { - const difference = allocationValuesSum - restToDistribute; - const lastElementValue = parseUnitsBigInt( - allocationValuesNew[allocationValuesNew.length - 1].value, - ); - - if (lastElementValue >= difference) { - allocationValuesNew[allocationValuesNew.length - 1].value = formatUnitsBigInt( - lastElementValue - difference, - ); - } else { - const elementIndexToChange = allocationValuesNew.findIndex( - element => parseUnitsBigInt(element.value) > difference, - ); - allocationValuesNew[elementIndexToChange].value = formatUnitsBigInt( - parseUnitsBigInt(allocationValuesNew[elementIndexToChange].value) - difference, - ); - } - } - - return allocationValuesNew; -} - -export function getAllocationValuesInitialState({ - allocationValues, - allocations, - isManualMode, - percentageProportions, - rewardsForProjects, - shouldReset, - userAllocationsElements, -}: { - allocationValues: AllocationValues; - allocations: string[]; - isManualMode: boolean; - percentageProportions: PercentageProportions; - rewardsForProjects: bigint; - shouldReset: boolean; - userAllocationsElements: UserAllocationElementString[]; -}): AllocationValues { - if (shouldReset) { - const allocationValuesNew = allocations.map(allocation => { - // Case A (see utils.test.ts). - if (userAllocationsElements.length > 0) { - const userAllocationValue = userAllocationsElements.find( - element => element.address === allocation, - )?.value; - const userAllocationValueFinal = userAllocationValue || '0'; - return { - address: allocation, - // @ts-expect-error TS method collision. - value: userAllocationValueFinal.toLocaleString('fullWide', { useGrouping: false }), - }; - } - // Case B (see utils.test.ts). - return { - address: allocation, - // @ts-expect-error TS method collision. - value: '0'.toLocaleString('fullWide', { useGrouping: false }), - }; - }); - - return getAllocationValuesWithRewardsSplitted({ - allocationValues: allocationValuesNew, - restToDistribute: BigInt(0), - }); - } - if (!isManualMode) { - // Case C (see utils.test.ts). - const allocationValuesNew = allocations.map(allocation => ({ - address: allocation, - value: formatUnitsBigInt(rewardsForProjects / BigInt(allocations.length)).toLocaleString( - // @ts-expect-error TS method collision. - 'fullWide', - { - useGrouping: false, - }, - ), - })); - - return getAllocationValuesWithRewardsSplitted({ - allocationValues: allocationValuesNew, - restToDistribute: rewardsForProjects, - }); - } - // Case D (see utils.test.ts). - - const allocationValuesNew = allocations.map(allocation => { - const percentageProportion = percentageProportions[allocation]; - const allocationValue = allocationValues.find(element => element.address === allocation)?.value; - const userAllocationValue = userAllocationsElements.find( - element => element.address === allocation, - )?.value; - const userValue = allocationValue || userAllocationValue || '0'; - // Value for the project set as valueUser multiplied by percentage. - const value = ( - percentageProportion === undefined - ? userValue - : formatUnitsBigInt((rewardsForProjects * BigInt(percentageProportion)) / 100n) - ) - // @ts-expect-error TS method collision. - .toLocaleString('fullWide', { useGrouping: false }); - return { - address: allocation, - value, - }; - }); - - return getAllocationValuesWithRewardsSplitted({ - allocationValues: allocationValuesNew, - restToDistribute: rewardsForProjects, - }); -} - -export function getAllocationsWithRewards({ - projectsIpfsWithRewards, - allocationValues, - areAllocationsAvailableOrAlreadyDone, - userAllocationsElements, -}: { - allocationValues: AllocationValues | undefined; - areAllocationsAvailableOrAlreadyDone: boolean; - projectsIpfsWithRewards: ProjectIpfsWithRewards[]; - userAllocationsElements: UserAllocationElementString[] | undefined; -}): AllocationItemWithAllocations[] { - const isDataDefined = - projectsIpfsWithRewards && - projectsIpfsWithRewards.length > 0 && - areAllocationsAvailableOrAlreadyDone; - let allocationsWithRewards = isDataDefined - ? allocationValues!.map(allocationValue => { - const projectIpfsWithRewards = projectsIpfsWithRewards.find( - ({ address }) => address === allocationValue.address, - )!; - const isAllocatedTo = !!userAllocationsElements?.find( - ({ address }) => address === allocationValue.address, - ); - - return { - isAllocatedTo, - ...allocationValue, - ...projectIpfsWithRewards, - }; - }) - : []; - - allocationsWithRewards.sort(({ value: valueA }, { value: valueB }) => { - const valueABigInt = parseUnitsBigInt(valueA || '0'); - const valueBBigInt = parseUnitsBigInt(valueB || '0'); - if (valueABigInt < valueBBigInt) { - return 1; - } - if (valueABigInt > valueBBigInt) { - return -1; - } - return 0; - }); - - allocationsWithRewards = getSortedElementsByTotalValueOfAllocationsAndAlphabetical( - allocationsWithRewards as AllocationItemWithAllocations[], - ) as AllocationItemWithAllocations[]; - - return allocationsWithRewards; -} - -export function getAllocationValuesAfterManualChange({ - newAllocationValue, - allocationValues, - rewardsForProjects, - individualReward, - isManualMode, - setAddressesWithError, -}: { - allocationValues: AllocationValues; - individualReward: bigint | undefined; - isManualMode: boolean; - newAllocationValue: AllocationValue; - rewardsForProjects: bigint; - setAddressesWithError: React.Dispatch>; -}): { allocationValuesArrayNew: AllocationValues; rewardsForProjectsNew: bigint } { - if (!individualReward) { - return { - allocationValuesArrayNew: allocationValues, - rewardsForProjectsNew: rewardsForProjects, - }; - } - - const allocationValuesArrayNew = allocationValues.map(element => ({ - ...element, - value: - element.address === newAllocationValue.address ? newAllocationValue.value : element.value, - })); - - const allocationValuesArrayNewSum = allocationValuesArrayNew.reduce( - (acc, { value }) => acc + parseUnitsBigInt(value || '0'), - BigInt(0), - ); - - if (allocationValuesArrayNewSum > individualReward) { - setAddressesWithError(prev => [...prev, newAllocationValue.address]); - return { - allocationValuesArrayNew: allocationValues.map(element => ({ - ...element, - value: element.address === newAllocationValue.address ? '0' : element.value, - })), - rewardsForProjectsNew: rewardsForProjects, - }; - } - - if (isManualMode) { - return { - allocationValuesArrayNew, - rewardsForProjectsNew: allocationValuesArrayNewSum, - }; - } - - const rewardsForProjectsNew = allocationValuesArrayNewSum === 0n ? BigInt(0) : rewardsForProjects; - - return { - allocationValuesArrayNew: - allocationValuesArrayNew.length === 1 - ? allocationValuesArrayNew - : getAllocationValuesWithRewardsSplitted({ - allocationValues: allocationValuesArrayNew, - restToDistribute: rewardsForProjectsNew, - }), - rewardsForProjectsNew, - }; -} diff --git a/client/src/views/EarnView/EarnView.module.scss b/client/src/views/EarnView/EarnView.module.scss deleted file mode 100644 index 7121dd9a6..000000000 --- a/client/src/views/EarnView/EarnView.module.scss +++ /dev/null @@ -1,38 +0,0 @@ -.box { - &:not(:first-child) { - margin: 1.6rem auto 0; - } -} - -.column { - &:not(:last-child) { - margin-bottom: 1.6rem; - } - - @media #{$desktop-up} { - @include flexBasisGutter(2, 1.6rem); - margin-bottom: 0; - } -} - -.boxesWrapper { - width: 100%; -} - -.wrapper { - display: flex; - width: 100%; - height: 100%; - flex-direction: column; - align-items: start; - min-height: 0; - - @media #{$desktop-up} { - flex-direction: row; - justify-content: space-between; - } -} - -.preLaunchTimer { - margin-top: 0.4rem; -} diff --git a/client/src/views/EarnView/EarnView.tsx b/client/src/views/EarnView/EarnView.tsx deleted file mode 100644 index 82fbf677d..000000000 --- a/client/src/views/EarnView/EarnView.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import cx from 'classnames'; -import React, { ReactElement, useState, useEffect } from 'react'; -import { useTranslation } from 'react-i18next'; - -import EarnBoxGlmLock from 'components/Earn/EarnBoxGlmLock'; -import EarnBoxPersonalAllocation from 'components/Earn/EarnBoxPersonalAllocation'; -import EarnHistory from 'components/Earn/EarnHistory'; -import EarnTipTiles from 'components/Earn/EarnTipTiles'; -import Layout from 'components/shared/Layout'; -import TimeCounter from 'components/shared/TimeCounter'; -import BoxRounded from 'components/ui/BoxRounded'; -import useIsProjectAdminMode from 'hooks/helpers/useIsProjectAdminMode'; -import useCurrentEpoch from 'hooks/queries/useCurrentEpoch'; -import getIsPreLaunch from 'utils/getIsPreLaunch'; - -import styles from './EarnView.module.scss'; - -const EarnView = (): ReactElement => { - const { t } = useTranslation('translation', { - keyPrefix: 'views.earn', - }); - const [isPollingForCurrentEpoch, setIsPollingForCurrentEpoch] = useState(false); - const { data: currentEpoch } = useCurrentEpoch({ - refetchInterval: isPollingForCurrentEpoch ? 5000 : false, - }); - - const isProjectAdminMode = useIsProjectAdminMode(); - - useEffect(() => { - // When Epoch 0 ends, we poll for Epoch 1 from the backend. - if (isPollingForCurrentEpoch && currentEpoch === 1) { - setIsPollingForCurrentEpoch(false); - } - }, [isPollingForCurrentEpoch, currentEpoch, setIsPollingForCurrentEpoch]); - - const isPreLaunch = getIsPreLaunch(currentEpoch); - - const preLaunchStartTimestamp = Date.UTC(2023, 7, 4, 10, 0, 0, 0); // 04.08.2023 12:00 CEST - const preLaunchEndTimestamp = Date.UTC(2023, 7, 8, 16, 0, 0, 0); // 08.08.2023 18:00 CEST - const duration = preLaunchEndTimestamp - preLaunchStartTimestamp; - - return ( - - -
-
- {isPreLaunch && ( - - setIsPollingForCurrentEpoch(true)} - timestamp={preLaunchEndTimestamp} - /> - - )} - {!isProjectAdminMode && } - -
- -
-
- ); -}; - -export default EarnView; diff --git a/client/src/components/Earn/EarnGlmLock/index.tsx b/client/src/views/HomeView/index.tsx similarity index 54% rename from client/src/components/Earn/EarnGlmLock/index.tsx rename to client/src/views/HomeView/index.tsx index 51932492b..9283ddcc8 100644 --- a/client/src/components/Earn/EarnGlmLock/index.tsx +++ b/client/src/views/HomeView/index.tsx @@ -1,2 +1,2 @@ // eslint-disable-next-line no-restricted-exports -export { default } from './EarnGlmLock'; +export { default } from './HomeView'; diff --git a/client/src/views/MetricsView/MetricsView.module.scss b/client/src/views/MetricsView/MetricsView.module.scss deleted file mode 100644 index c2023686c..000000000 --- a/client/src/views/MetricsView/MetricsView.module.scss +++ /dev/null @@ -1,22 +0,0 @@ -.header { - width: 100%; - display: flex; - align-items: center; - color: $color-octant-dark; - font-size: $font-size-24; - font-weight: $font-weight-bold; - height: 8.8rem; - - @media #{$tablet-up} { - height: 14.4rem; - font-size: $font-size-32; - } - - @media #{$desktop-up} { - font-size: $font-size-40; - } - - @media #{$large-desktop-up} { - font-size: $font-size-48; - } -} diff --git a/client/src/views/MetricsView/MetricsView.tsx b/client/src/views/MetricsView/MetricsView.tsx index 12606269f..3aa8e2d4a 100644 --- a/client/src/views/MetricsView/MetricsView.tsx +++ b/client/src/views/MetricsView/MetricsView.tsx @@ -3,11 +3,10 @@ import { useTranslation } from 'react-i18next'; import MetricsEpoch from 'components/Metrics/MetricsEpoch'; import MetricsGeneral from 'components/Metrics/MetricsGeneral/MetricsGeneral'; +import ViewTitle from 'components/shared/ViewTitle/ViewTitle'; import { MetricsEpochProvider } from 'hooks/helpers/useMetrcisEpoch'; import useCurrentEpoch from 'hooks/queries/useCurrentEpoch'; -import styles from './MetricsView.module.scss'; - const MetricsView = (): ReactElement => { const { t } = useTranslation('translation', { keyPrefix: 'views.metrics' }); const { data: currentEpoch } = useCurrentEpoch(); @@ -21,10 +20,10 @@ const MetricsView = (): ReactElement => { {/* Workaround for epoch 0 allocation window (no epoch 0 metrics) */} {/* useMetricsEpoch.tsx:19 -> const lastEpoch = currentEpoch! - 1; */} {currentEpoch === 1 ? ( - "It's Epoch 1, so there are no metrics for the past. It's just a placeholder, please come back in Epoch 2." + t('epoch1Info') ) : ( <> -
{t('exploreTheData')}
+ {t('exploreTheData')} diff --git a/client/src/components/Earn/EarnHistory/index.tsx b/client/src/views/MetricsView/index.tsx similarity index 54% rename from client/src/components/Earn/EarnHistory/index.tsx rename to client/src/views/MetricsView/index.tsx index fffff26b2..a3b62fd22 100644 --- a/client/src/components/Earn/EarnHistory/index.tsx +++ b/client/src/views/MetricsView/index.tsx @@ -1,2 +1,2 @@ // eslint-disable-next-line no-restricted-exports -export { default } from './EarnHistory'; +export { default } from './MetricsView'; diff --git a/client/src/views/PlaygroundView/index.tsx b/client/src/views/PlaygroundView/index.tsx new file mode 100644 index 000000000..d44bbd879 --- /dev/null +++ b/client/src/views/PlaygroundView/index.tsx @@ -0,0 +1,2 @@ +// eslint-disable-next-line no-restricted-exports +export { default } from './PlaygroundView'; diff --git a/client/src/components/Earn/EarnTipTiles/index.tsx b/client/src/views/ProjectView/index.tsx similarity index 54% rename from client/src/components/Earn/EarnTipTiles/index.tsx rename to client/src/views/ProjectView/index.tsx index 6211f7158..e6e39a9f5 100644 --- a/client/src/components/Earn/EarnTipTiles/index.tsx +++ b/client/src/views/ProjectView/index.tsx @@ -1,2 +1,2 @@ // eslint-disable-next-line no-restricted-exports -export { default } from './EarnTipTiles'; +export { default } from './ProjectView'; diff --git a/client/src/views/ProjectsView/index.tsx b/client/src/views/ProjectsView/index.tsx new file mode 100644 index 000000000..383261523 --- /dev/null +++ b/client/src/views/ProjectsView/index.tsx @@ -0,0 +1,2 @@ +// eslint-disable-next-line no-restricted-exports +export { default } from './ProjectsView'; diff --git a/client/src/views/SettingsView/index.tsx b/client/src/views/SettingsView/index.tsx new file mode 100644 index 000000000..41e634faf --- /dev/null +++ b/client/src/views/SettingsView/index.tsx @@ -0,0 +1,2 @@ +// eslint-disable-next-line no-restricted-exports +export { default } from './SettingsView'; diff --git a/client/src/views/SyncView/index.tsx b/client/src/views/SyncView/index.tsx new file mode 100644 index 000000000..8b285f46d --- /dev/null +++ b/client/src/views/SyncView/index.tsx @@ -0,0 +1,2 @@ +// eslint-disable-next-line no-restricted-exports +export { default } from './SyncView';