diff --git a/client/public/images/funds_swept.webp b/client/public/images/funds_swept.webp deleted file mode 100644 index f7b3fc1c11..0000000000 Binary files a/client/public/images/funds_swept.webp and /dev/null differ diff --git a/client/public/images/lock-glm-desktop.webp b/client/public/images/lock-glm-desktop.webp deleted file mode 100644 index 3aeb02a0b6..0000000000 Binary files a/client/public/images/lock-glm-desktop.webp and /dev/null differ diff --git a/client/public/images/lock-glm-mobile.webp b/client/public/images/lock-glm-mobile.webp deleted file mode 100644 index da185519a1..0000000000 Binary files a/client/public/images/lock-glm-mobile.webp and /dev/null differ diff --git a/client/public/images/modalEffectiveLockedBalance.webp b/client/public/images/modalEffectiveLockedBalance.webp deleted file mode 100644 index 746d0205c3..0000000000 Binary files a/client/public/images/modalEffectiveLockedBalance.webp and /dev/null differ diff --git a/client/public/images/tip-connect-wallet.webp b/client/public/images/tip-connect-wallet.webp deleted file mode 100644 index 963b70f33d..0000000000 Binary files a/client/public/images/tip-connect-wallet.webp and /dev/null differ diff --git a/client/public/images/tip-withdraw.webp b/client/public/images/tip-withdraw.webp deleted file mode 100644 index e0ce55c116..0000000000 Binary files a/client/public/images/tip-withdraw.webp and /dev/null differ diff --git a/client/src/components/Allocation/AllocationItem/types.ts b/client/src/components/Allocation/AllocationItem/types.ts index 5811ffcc8e..783ad16b40 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 59f1e962e6..abfc9a584f 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 c2b5d5569a..e369bf39a7 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 2708f078c1..0000000000 --- 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 c3801b49af..0000000000 --- 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 10b646c2a4..0000000000 --- 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 7130b1e153..0000000000 --- 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 c2dfb6ee78..0000000000 --- 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 dedc208a26..0000000000 --- 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 c73db828a2..0000000000 --- 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 2f5b7fd1fa..0000000000 --- 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 3a966b3735..0000000000 --- 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 2b4bc5cd05..0000000000 --- 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 2dc3545210..0000000000 --- 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 5a45b6c2e0..0000000000 --- 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 4be2791aed..0000000000 --- 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 8762572265..0000000000 --- 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 37733eaf77..0000000000 --- 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 07c38db419..0000000000 --- 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 74d224f84c..0000000000 --- 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 8c77ef5984..0000000000 --- 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 e32df3f928..0000000000 --- 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 6f753d1088..0000000000 --- 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 44c72a0b37..0000000000 --- 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 e2c30eb9dd..0000000000 --- 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 002295c96d..0000000000 --- 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 5eee7e952c..0000000000 --- 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 067a9b9fbe..0000000000 --- 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 02b418d638..0000000000 --- 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 0939f1d9b8..0000000000 --- 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 e332c4c258..0000000000 --- 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 2f8e833155..0000000000 --- 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 252540a7ba..0000000000 --- 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 a282b96bad..0000000000 --- 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 f73dec9c84..0000000000 --- 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 aa83945606..0000000000 --- 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 975cda7194..0000000000 --- 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 04220a105c..0000000000 --- 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 1004f04d8d..0000000000 --- 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 1744f844c5..0000000000 --- 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 a455783d0b..0000000000 --- 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 694b2eab23..25f58f1579 100644 --- a/client/src/components/Home/HomeGridCurrentGlmLock/HomeGridCurrentGlmLock.tsx +++ b/client/src/components/Home/HomeGridCurrentGlmLock/HomeGridCurrentGlmLock.tsx @@ -77,12 +77,11 @@ 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', text: t('tooltipText'), - tooltipClassName: styles.effectiveTooltip, }, }, ]} diff --git a/client/src/components/Home/HomeGridCurrentGlmLock/ModalLockGlm/LockGlmBudgetBox/LockGlmBudgetBox.module.scss b/client/src/components/Home/HomeGridCurrentGlmLock/ModalLockGlm/LockGlmBudgetBox/LockGlmBudgetBox.module.scss index 8762572265..aafbfc59d3 100644 --- a/client/src/components/Home/HomeGridCurrentGlmLock/ModalLockGlm/LockGlmBudgetBox/LockGlmBudgetBox.module.scss +++ b/client/src/components/Home/HomeGridCurrentGlmLock/ModalLockGlm/LockGlmBudgetBox/LockGlmBudgetBox.module.scss @@ -1,29 +1,3 @@ -.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; @@ -50,7 +24,6 @@ width: 10rem; } - .budgetLabel { color: $color-octant-grey5; } diff --git a/client/src/components/Home/HomeGridCurrentGlmLock/ModalLockGlm/LockGlmNotification/LockGlmNotification.tsx b/client/src/components/Home/HomeGridCurrentGlmLock/ModalLockGlm/LockGlmNotification/LockGlmNotification.tsx index 1d2a362a29..4e857801d6 100644 --- a/client/src/components/Home/HomeGridCurrentGlmLock/ModalLockGlm/LockGlmNotification/LockGlmNotification.tsx +++ b/client/src/components/Home/HomeGridCurrentGlmLock/ModalLockGlm/LockGlmNotification/LockGlmNotification.tsx @@ -53,11 +53,7 @@ const LockGlmNotification: FC = ({ isVertical >
- +
{label &&
{label}
} {text && ( diff --git a/client/src/components/Home/HomeGridDonations/DonationsListSkeletonItem/DonationsListSkeletonItem.module.scss b/client/src/components/Home/HomeGridDonations/DonationsListSkeletonItem/DonationsListSkeletonItem.module.scss index b11934a8e5..be193215bf 100644 --- a/client/src/components/Home/HomeGridDonations/DonationsListSkeletonItem/DonationsListSkeletonItem.module.scss +++ b/client/src/components/Home/HomeGridDonations/DonationsListSkeletonItem/DonationsListSkeletonItem.module.scss @@ -26,9 +26,6 @@ @include skeleton(); height: 1.5rem; width: 4rem; - } - - .value { margin-left: auto; } } diff --git a/client/src/components/Home/HomeGridDonations/HomeGridDonations.module.scss b/client/src/components/Home/HomeGridDonations/HomeGridDonations.module.scss index 3ce8ff6bfd..7a26d25787 100644 --- a/client/src/components/Home/HomeGridDonations/HomeGridDonations.module.scss +++ b/client/src/components/Home/HomeGridDonations/HomeGridDonations.module.scss @@ -1,18 +1,6 @@ .root { padding: 0rem 2.4rem 2.4rem; overflow: auto; - - .divider { - margin-top: 2rem; - width: 100%; - height: 0.1rem; - background-color: $color-octant-grey1; - } - - .withdrawEthButton { - margin-top: 2.4rem; - width: 100%; - } } .titleWrapper { diff --git a/client/src/components/Home/HomeGridDonations/HomeGridDonations.tsx b/client/src/components/Home/HomeGridDonations/HomeGridDonations.tsx index 6dcf091507..93b09933b6 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 1f44449640..000e7ab95b 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 && (
); diff --git a/client/src/components/shared/ButtonAddToAllocate/ButtonAddToAllocate.tsx b/client/src/components/shared/ButtonAddToAllocate/ButtonAddToAllocate.tsx index a4ca3ab154..4d39874288 100644 --- a/client/src/components/shared/ButtonAddToAllocate/ButtonAddToAllocate.tsx +++ b/client/src/components/shared/ButtonAddToAllocate/ButtonAddToAllocate.tsx @@ -20,7 +20,7 @@ const ButtonAddToAllocate: FC = ({ isAllocatedTo, isArchivedProject, }) => { - const { t } = useTranslation('translation', { + const { i18n, t } = useTranslation('translation', { keyPrefix: 'components.dedicated.buttonAddToAllocate', }); const [scope, animate] = useAnimate(); @@ -29,7 +29,7 @@ const ButtonAddToAllocate: FC = ({ const [isTooltipVisible, setIsTooltipVisible] = useState(false); const tooltipText = useMemo(() => { if (isArchivedProject && isAllocatedTo) { - return t('donated'); + return i18n.t('common.donated'); } if (isAddedToAllocate && isTooltipClicked) { return t('saved'); diff --git a/client/src/components/shared/Layout/Layout.module.scss b/client/src/components/shared/Layout/Layout.module.scss index eeb76acd1c..66677363cc 100644 --- a/client/src/components/shared/Layout/Layout.module.scss +++ b/client/src/components/shared/Layout/Layout.module.scss @@ -52,122 +52,6 @@ } } -.logo { - position: relative; - height: 4rem; - cursor: pointer; - display: flex; - align-items: center; - justify-content: center; -} - -.testnetIndicatorWrapper { - display: flex; - align-items: center; - justify-content: center; - position: absolute; - top: -1rem; - right: -0.2rem; - transform: translate(75%, 0); - background: $color-white; - height: 1.6rem; - box-sizing: content-box; - border-radius: 1.2rem; - padding: 0.4rem 0.5rem; -} - -.testnetIndicator { - display: flex; - align-items: center; - font-size: $font-size-10; - font-weight: $font-weight-bold; - text-transform: uppercase; - color: $color-white; - letter-spacing: 0.1rem; - background: $color-octant-orange; - border-radius: 0.8rem; - height: 1.6rem; - padding: 0 0.8rem; - user-select: none; -} - -.buttons { - display: flex; - align-items: center; -} - -.buttonWallet { - margin-left: 1.6rem; - cursor: pointer; - - &.isWalletModalOpen { - transform: rotate(180deg); - } -} - -.profileInfo { - display: flex; - align-items: center; - font-size: $font-size-14; - cursor: pointer; - padding: $layoutMarginHorizontal; - margin: (-$layoutMarginHorizontal); -} - -.walletInfo { - display: flex; - flex-direction: column; - align-items: flex-end; -} - -.addressWrapper { - display: flex; - - .badge { - display: flex; - align-items: center; - justify-content: center; - font-size: $font-size-10; - text-transform: uppercase; - letter-spacing: 0.05rem; - font-weight: $font-weight-bold; - color: $color-white; - border-radius: $border-radius-04; - height: 1.6rem; - margin-right: 0.8rem; - background: $color-octant-purple; - width: 5.6rem; - - &.isProjectAdminMode { - background: $color-octant-green; - width: 4.4rem; - } - } -} - -.address { - @include ethereumAddress(); - font-weight: $font-weight-bold; - - &.isProjectAdminMode { - color: $color-octant-green; - } - - &.isPatronMode { - color: $color-octant-purple; - } -} - -.budget, -.allocationPeriod { - font-size: $font-size-14; -} - -.highlighted { - color: $color-octant-orange; - font-weight: $font-weight-bold; -} - .body { display: flex; flex-direction: column; diff --git a/client/src/components/shared/Layout/Layout.tsx b/client/src/components/shared/Layout/Layout.tsx index 268d617406..deab256c89 100644 --- a/client/src/components/shared/Layout/Layout.tsx +++ b/client/src/components/shared/Layout/Layout.tsx @@ -1,19 +1,5 @@ import cx from 'classnames'; -import React, { - FC, - // useState, - Fragment, - useEffect, - useRef, - // useMemo, - // useEffect -} from 'react'; -// import { useTranslation } from 'react-i18next'; -// import { -// useLocation, -// useMatch, useNavigate -// } from 'react-router-dom'; -// import { useAccount } from 'wagmi'; +import React, { FC, Fragment, useEffect, useRef } from 'react'; import LayoutFooter from 'components/shared/Layout/LayoutFooter'; import LayoutNavbar from 'components/shared/Layout/LayoutNavbar'; @@ -22,27 +8,11 @@ import ModalLayoutConnectWallet from 'components/shared/Layout/ModalLayoutConnec import ModalLayoutWallet from 'components/shared/Layout/ModalLayoutWallet'; import Loader from 'components/ui/Loader'; import { LAYOUT_BODY_ID } from 'constants/domElementsIds'; -// import useEpochAndAllocationTimestamps from 'hooks/helpers/useEpochAndAllocationTimestamps'; -// import useGetValuesToDisplay from 'hooks/helpers/useGetValuesToDisplay'; -// import useIsProjectAdminMode from 'hooks/helpers/useIsProjectAdminMode'; import useIsProjectAdminMode from 'hooks/helpers/useIsProjectAdminMode'; import useMediaQuery from 'hooks/helpers/useMediaQuery'; -// import useCurrentEpoch from 'hooks/queries/useCurrentEpoch'; -// import useIndividualReward from 'hooks/queries/useIndividualReward'; -// import useIsDecisionWindowOpen from 'hooks/queries/useIsDecisionWindowOpen'; -// import useIsPatronMode from 'hooks/queries/useIsPatronMode'; -// import useUserTOS from 'hooks/queries/useUserTOS'; -// import { ROOT_ROUTES } from 'routes/RootRoutes/routes'; import useIsPatronMode from 'hooks/queries/useIsPatronMode'; import useLayoutStore from 'store/layout/store'; -import SyncView from 'views/SyncView/SyncView'; - -// import useSettingsStore from 'store/settings/store'; -// import { chevronLeft } from 'svg/navigation'; -// import getDifferenceInWeeks from 'utils/getDifferenceInWeeks'; -// import getIsPreLaunch from 'utils/getIsPreLaunch'; -// import getTimeDistance from 'utils/getTimeDistance'; -// import truncateEthAddress from 'utils/truncateEthAddress'; +import SyncView from 'views/SyncView'; import styles from './Layout.module.scss'; import LayoutProps from './types'; @@ -51,13 +21,10 @@ const Layout: FC = ({ children, dataTest, navigationBottomSuffix, - // isHeaderVisible = true, isLoading, isNavigationVisible = true, classNameBody, isSyncingInProgress, - // isAbsoluteHeaderPosition = false, - // showHeaderBlur = true, }) => { const { isMobile, isDesktop } = useMediaQuery(); const isProjectAdminMode = useIsProjectAdminMode(); @@ -67,23 +34,6 @@ const Layout: FC = ({ const topBarWrapperRef = useRef(null); const scrollRef = useRef(window.scrollY); const lastScrollYUpRef = useRef(0); - // const { data: isPatronMode } = useIsPatronMode(); - // const { i18n, t } = useTranslation('translation', { keyPrefix: 'layout.main' }); - // const { address, isConnected } = useAccount(); - // const { data: individualReward } = useIndividualReward(); - // const { data: currentEpoch } = useCurrentEpoch(); - // const { timeCurrentAllocationEnd, timeCurrentEpochEnd } = useEpochAndAllocationTimestamps(); - // const { data: isDecisionWindowOpen } = useIsDecisionWindowOpen(); - // const { pathname } = useLocation(); - // const navigate = useNavigate(); - // const { data: isUserTOSAccepted } = useUserTOS(); - // const { - // data: { isCryptoMainValueDisplay }, - // } = useSettingsStore(({ data }) => ({ - // data: { - // isCryptoMainValueDisplay: data.isCryptoMainValueDisplay, - // }, - // })); const { setIsWalletModalOpen, @@ -98,65 +48,6 @@ const Layout: FC = ({ setIsWalletModalOpen: state.setIsWalletModalOpen, })); - // const isPreLaunch = getIsPreLaunch(currentEpoch); - // const isAllocationRoot = !!useMatch(ROOT_ROUTES.allocation.absolute); - // const isUseMatchProject = !!useMatch(ROOT_ROUTES.projectWithAddress.absolute); - // const isUseMatchProjectWithAddress = !!useMatch(ROOT_ROUTES.projectWithAddress.absolute); - // const isProjectRoot = isUseMatchProject || isUseMatchProjectWithAddress; - // const isProjectsRoot = !!useMatch(ROOT_ROUTES.projects.absolute); - // const getValuesToDisplay = useGetValuesToDisplay(); - - // const showAllocationPeriod = isAllocationRoot || isProjectRoot || isProjectsRoot; - - // const getCurrentPeriod = () => { - // if (isDecisionWindowOpen && timeCurrentAllocationEnd) { - // return getTimeDistance(Date.now(), new Date(timeCurrentAllocationEnd).getTime()); - // } - // if (!isDecisionWindowOpen && timeCurrentEpochEnd) { - // return getTimeDistance(Date.now(), new Date(timeCurrentEpochEnd).getTime()); - // } - // return ''; - // }; - // const [currentPeriod, setCurrentPeriod] = useState(() => getCurrentPeriod()); - - // const truncatedEthAddress = useMemo(() => address && truncateEthAddress(address), [address]); - - // const isAllocationPeriodIsHighlighted = useMemo(() => { - // if (isDecisionWindowOpen && timeCurrentAllocationEnd) { - // return getDifferenceInWeeks(Date.now(), new Date(timeCurrentAllocationEnd).getTime()) < 1; - // } - // if (!isDecisionWindowOpen && timeCurrentEpochEnd) { - // return getDifferenceInWeeks(Date.now(), new Date(timeCurrentEpochEnd).getTime()) < 1; - // } - // return false; - // }, [isDecisionWindowOpen, timeCurrentAllocationEnd, timeCurrentEpochEnd]); - - // const individualRewardText = useMemo(() => { - // if (currentEpoch === 1 || individualReward === 0n || !isDecisionWindowOpen) { - // return i18n.t('layout.main.noRewardsYet'); - // } - // if (currentEpoch === undefined || individualReward === undefined) { - // return i18n.t('layout.main.loadingRewardBudget'); - // } - // return i18n.t('common.rewards', { - // rewards: getValuesToDisplay({ - // cryptoCurrency: 'ethereum', - // showCryptoSuffix: true, - // valueCrypto: individualReward, - // }).primary, - // }); - // // eslint-disable-next-line react-hooks/exhaustive-deps - // }, [individualReward, currentEpoch, isDecisionWindowOpen, isCryptoMainValueDisplay]); - - // useEffect(() => { - // const intervalId = setInterval(() => { - // setCurrentPeriod(getCurrentPeriod()); - // }, 1000); - - // return () => clearInterval(intervalId); - // // eslint-disable-next-line react-hooks/exhaustive-deps - // }, [isDecisionWindowOpen, timeCurrentAllocationEnd, timeCurrentEpochEnd]); - // Logic that hides TopBar when scrolling down and shows when scrolling up (only on mobile devices) useEffect(() => { if (!topBarWrapperRef?.current) { @@ -219,106 +110,6 @@ const Layout: FC = ({ >
- {/* {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 bbd81d94d9..27a8b07c07 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/Layout/LayoutWallet/LayoutWallet.module.scss b/client/src/components/shared/Layout/LayoutWallet/LayoutWallet.module.scss index 2b74ca846a..7df1d0c47e 100644 --- a/client/src/components/shared/Layout/LayoutWallet/LayoutWallet.module.scss +++ b/client/src/components/shared/Layout/LayoutWallet/LayoutWallet.module.scss @@ -14,24 +14,6 @@ } } -.walletCurrency { - display: flex; - align-items: center; - justify-content: space-between; - color: $color-octant-dark; - font-size: $font-size-14; - height: 7.2rem; - width: 100%; - - &:not(:last-child) { - border-bottom: 0.1rem solid $color-white; - } - - &:last-child { - padding-bottom: 0; - } -} - .button { width: 100%; height: 4.8rem; diff --git a/client/src/components/shared/Layout/LayoutWalletPersonalAllocation/LayoutWalletPersonalAllocation.module.scss b/client/src/components/shared/Layout/LayoutWalletPersonalAllocation/LayoutWalletPersonalAllocation.module.scss index 4a358196db..d740fcafe5 100644 --- a/client/src/components/shared/Layout/LayoutWalletPersonalAllocation/LayoutWalletPersonalAllocation.module.scss +++ b/client/src/components/shared/Layout/LayoutWalletPersonalAllocation/LayoutWalletPersonalAllocation.module.scss @@ -2,26 +2,6 @@ width: 100%; } -.reward { - display: flex; - align-items: center; - justify-content: space-between; - height: 7.2rem; - width: 100%; - - &:not(:last-child) { - border-bottom: 0.1rem solid $color-white; - } - - &:last-child { - padding-bottom: 0; - } - - .label { - font-size: $font-size-14; - } -} - .isDisabled * { color: $color-octant-grey2; pointer-events: none; diff --git a/client/src/components/shared/Layout/ModalLayoutConnectWallet/ModalLayoutConnectWallet.tsx b/client/src/components/shared/Layout/ModalLayoutConnectWallet/ModalLayoutConnectWallet.tsx index 79e15dbd57..c5734497f7 100644 --- a/client/src/components/shared/Layout/ModalLayoutConnectWallet/ModalLayoutConnectWallet.tsx +++ b/client/src/components/shared/Layout/ModalLayoutConnectWallet/ModalLayoutConnectWallet.tsx @@ -22,7 +22,7 @@ const ModalLayoutConnectWallet: FC = ({ modalProp return ( import('services/websocketService'); diff --git a/client/src/hooks/helpers/useNavigationTabs.tsx b/client/src/hooks/helpers/useNavigationTabs.tsx index 75be2ab61e..2ba1a58530 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 0922389fa0..f906021714 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 dbe8cc5282..06761e9792 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 86be90a9ad..ef1f375955 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 1d8c822d26..aaff0a0af9 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 4c6955281d..a8bddb7dc8 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 6503bef4d9..06a5c5b735 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 bb7033dad9..b9c2cbefc0 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 a61a651e06..c938bc584a 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 a4ab6efb84..0000000000 --- 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 db7b9a3227..d38c29a854 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 aa945853cd..efe5b6ec9e 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 23b0330906..0000000000 --- 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 ced474dc20..fcb4c21044 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 dc9a9db4e7..0000000000 --- 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 906ee5ca70..0000000000 --- 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 aaab36aabd..0000000000 --- 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 7121dd9a61..0000000000 --- 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 82fbf677d5..0000000000 --- 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 51932492ba..9283ddcc87 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 c2023686c9..0000000000 --- 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 12606269f3..3aa8e2d4ae 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 fffff26b2a..a3b62fd22a 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 0000000000..d44bbd8796 --- /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 6211f7158a..e6e39a9f52 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 0000000000..383261523a --- /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 0000000000..41e634faf3 --- /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 0000000000..8b285f46d0 --- /dev/null +++ b/client/src/views/SyncView/index.tsx @@ -0,0 +1,2 @@ +// eslint-disable-next-line no-restricted-exports +export { default } from './SyncView';