Skip to content

Commit

Permalink
Merge branch 'feature/oct-1584-allow-unlock-for-admin'
Browse files Browse the repository at this point in the history
  • Loading branch information
aziolek committed Apr 23, 2024
2 parents a6204e1 + b5e0225 commit 74a24af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions client/src/constants/projectAdmins.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const PROJECT_ADMINS_ALLOWED_TO_LOCK_UNLOCK_GLMS = [
'0x0194325BF525Be0D4fBB0856894cEd74Da3B8356',
];
10 changes: 9 additions & 1 deletion client/src/views/EarnView/EarnView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import cx from 'classnames';
import React, { ReactElement, useState, useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { useAccount } from 'wagmi';

import EarnBoxGlmLock from 'components/Earn/EarnBoxGlmLock';
import EarnBoxPersonalAllocation from 'components/Earn/EarnBoxPersonalAllocation';
Expand All @@ -9,6 +10,7 @@ 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 { PROJECT_ADMINS_ALLOWED_TO_LOCK_UNLOCK_GLMS } from 'constants/projectAdmins';
import useIsProjectAdminMode from 'hooks/helpers/useIsProjectAdminMode';
import useCurrentEpoch from 'hooks/queries/useCurrentEpoch';
import getIsPreLaunch from 'utils/getIsPreLaunch';
Expand All @@ -19,6 +21,7 @@ const EarnView = (): ReactElement => {
const { t } = useTranslation('translation', {
keyPrefix: 'views.earn',
});
const { address } = useAccount();
const [isPollingForCurrentEpoch, setIsPollingForCurrentEpoch] = useState<boolean>(false);
const { data: currentEpoch } = useCurrentEpoch({
refetchInterval: isPollingForCurrentEpoch ? 5000 : false,
Expand All @@ -39,6 +42,9 @@ const EarnView = (): ReactElement => {
const preLaunchEndTimestamp = Date.UTC(2023, 7, 8, 16, 0, 0, 0); // 08.08.2023 18:00 CEST
const duration = preLaunchEndTimestamp - preLaunchStartTimestamp;

const isProjectAdminAllowedToLockUnlock =
address && PROJECT_ADMINS_ALLOWED_TO_LOCK_UNLOCK_GLMS.includes(address);

return (
<Layout dataTest="EarnView">
<EarnTipTiles />
Expand All @@ -54,7 +60,9 @@ const EarnView = (): ReactElement => {
/>
</BoxRounded>
)}
{!isProjectAdminMode && <EarnBoxGlmLock classNameBox={styles.box} />}
{(!isProjectAdminMode || isProjectAdminAllowedToLockUnlock) && (
<EarnBoxGlmLock classNameBox={styles.box} />
)}
<EarnBoxPersonalAllocation className={styles.box} />
</div>
<EarnHistory className={styles.column} />
Expand Down

0 comments on commit 74a24af

Please sign in to comment.