11import cx from 'classnames' ;
22import React , { ReactElement , useState , useEffect } from 'react' ;
33import { useTranslation } from 'react-i18next' ;
4+ import { useAccount } from 'wagmi' ;
45
56import EarnBoxGlmLock from 'components/Earn/EarnBoxGlmLock' ;
67import EarnBoxPersonalAllocation from 'components/Earn/EarnBoxPersonalAllocation' ;
@@ -9,6 +10,7 @@ import EarnTipTiles from 'components/Earn/EarnTipTiles';
910import Layout from 'components/shared/Layout' ;
1011import TimeCounter from 'components/shared/TimeCounter' ;
1112import BoxRounded from 'components/ui/BoxRounded' ;
13+ import { PROJECT_ADMINS_ALLOWED_TO_LOCK_UNLOCK_GLMS } from 'constants/projectAdmins' ;
1214import useIsProjectAdminMode from 'hooks/helpers/useIsProjectAdminMode' ;
1315import useCurrentEpoch from 'hooks/queries/useCurrentEpoch' ;
1416import getIsPreLaunch from 'utils/getIsPreLaunch' ;
@@ -19,6 +21,7 @@ const EarnView = (): ReactElement => {
1921 const { t } = useTranslation ( 'translation' , {
2022 keyPrefix : 'views.earn' ,
2123 } ) ;
24+ const { address } = useAccount ( ) ;
2225 const [ isPollingForCurrentEpoch , setIsPollingForCurrentEpoch ] = useState < boolean > ( false ) ;
2326 const { data : currentEpoch } = useCurrentEpoch ( {
2427 refetchInterval : isPollingForCurrentEpoch ? 5000 : false ,
@@ -39,6 +42,9 @@ const EarnView = (): ReactElement => {
3942 const preLaunchEndTimestamp = Date . UTC ( 2023 , 7 , 8 , 16 , 0 , 0 , 0 ) ; // 08.08.2023 18:00 CEST
4043 const duration = preLaunchEndTimestamp - preLaunchStartTimestamp ;
4144
45+ const isProjectAdminAllowedToLockUnlock =
46+ address && PROJECT_ADMINS_ALLOWED_TO_LOCK_UNLOCK_GLMS . includes ( address ) ;
47+
4248 return (
4349 < Layout dataTest = "EarnView" >
4450 < EarnTipTiles />
@@ -54,7 +60,9 @@ const EarnView = (): ReactElement => {
5460 />
5561 </ BoxRounded >
5662 ) }
57- { ! isProjectAdminMode && < EarnBoxGlmLock classNameBox = { styles . box } /> }
63+ { ( ! isProjectAdminMode || isProjectAdminAllowedToLockUnlock ) && (
64+ < EarnBoxGlmLock classNameBox = { styles . box } />
65+ ) }
5866 < EarnBoxPersonalAllocation className = { styles . box } />
5967 </ div >
6068 < EarnHistory className = { styles . column } />
0 commit comments