@@ -23,7 +23,7 @@ import {
2323import { useAppKit } from '@reown/appkit/react'
2424import { QueryParams } from '@usedapp/core'
2525import { noop } from 'lodash'
26- // import { useFeatureFlagWithPayload } from 'posthog-react-native'
26+ import { useFeatureFlagWithPayload } from 'posthog-react-native'
2727import moment from 'moment'
2828
2929import { getEnv } from 'utils/env'
@@ -39,8 +39,7 @@ import BillyGrin from 'assets/images/claim/billygrin.png'
3939import BillyConfused from 'assets/images/claim/billyconfused.png'
4040
4141import { useIsSimpleApp } from 'state/simpleapp/simpleapp'
42-
43- // import { useDisabledClaimingModal } from './useDisabledClaimModal'
42+ import { useDisabledClaimingModal } from './useDisabledClaimModal'
4443import { useGoodDappFeatures } from 'hooks/useFeaturesEnabled'
4544
4645const OldClaim = memo ( ( ) => {
@@ -57,9 +56,10 @@ const OldClaim = memo(() => {
5756 const { open } = useAppKit ( )
5857 const network = SupportedV2Networks [ chainId ]
5958 const sendData = useSendAnalyticsData ( )
60- // todo: fix UI for displaying claiming disabled modal
61- // const [, payload] = useFeatureFlagWithPayload('claim-feature')
62- // const { enabled: claimEnabled = true, disabledMessage = '' } = (payload as any) || {}
59+
60+ const [ , payload ] = useFeatureFlagWithPayload ( 'claim-feature' )
61+ const { enabled : claimEnabled = true , disabledMessage = '' } = ( payload as any ) || { }
62+
6363 const { activeNetworksByFeature, activeChainFeatures } = useGoodDappFeatures ( )
6464 const supportedChains = activeNetworksByFeature [ 'claimEnabled' ] || [ ]
6565 const isProd = getEnv ( ) === 'production'
@@ -69,7 +69,14 @@ const OldClaim = memo(() => {
6969 const isHoliday = holiday >= '12-24' || holiday <= '01-01'
7070
7171 const isSimpleApp = useIsSimpleApp ( )
72- // const { Dialog, showModal } = useDisabledClaimingModal(disabledMessage)
72+
73+ const { Dialog, showModal } = useDisabledClaimingModal ( disabledMessage )
74+
75+ useEffect ( ( ) => {
76+ if ( ! claimEnabled ) {
77+ showModal ( )
78+ }
79+ } , [ claimEnabled , showModal ] )
7380
7481 const isMinipay = isMiniPay ( )
7582
@@ -143,6 +150,12 @@ const OldClaim = memo(() => {
143150
144151 const handleClaim = useCallback ( async ( ) => {
145152 setRefreshRate ( 'everyBlock' )
153+
154+ if ( ! claimEnabled ) {
155+ showModal ( )
156+ return false
157+ }
158+
146159 if ( activeChainFeatures [ 'claimEnabled' ] || ! isProd || isMinipay ) {
147160 // minipay doesnt handle gasPrice correctly, so we let it decide
148161 const claim = await send ( isMinipay ? { gasPrice : undefined } : { } )
@@ -164,12 +177,12 @@ const OldClaim = memo(() => {
164177 sendData ( { event : 'claim' , action : 'claim_success' , network } )
165178 return true
166179 } else {
167- // showModal()
180+ showModal ( )
168181 }
169182
170183 return false
171184 // eslint-disable-next-line react-hooks/exhaustive-deps
172- } , [ send , network , sendData , activeChainFeatures , isSimpleApp ] )
185+ } , [ send , network , sendData , activeChainFeatures , isSimpleApp , claimEnabled , showModal ] )
173186
174187 const handleConnect = useCallback ( async ( ) => {
175188 if ( ! address ) {
@@ -192,7 +205,7 @@ const OldClaim = memo(() => {
192205 } ,
193206 lg : {
194207 flexDirection : 'row' ,
195- justifyContent : 'justify -evenly' ,
208+ justifyContent : 'space -evenly' ,
196209 } ,
197210 } )
198211
@@ -294,9 +307,7 @@ const OldClaim = memo(() => {
294307 content : [
295308 {
296309 description : {
297- text : `After claiming your G$, use it to support your community, buy products and services, support causes you care about, vote in the GoodDAO, and more.
298-
299- Learn how here` ,
310+ text : `After claiming your G$, use it to support your community, buy products and services, support causes you care about, vote in the GoodDAO, and more. \n\nLearn how here` ,
300311 color : 'white' ,
301312 } ,
302313 ...( isSmallTabletView && { imgSrc : BillyHappy } ) ,
@@ -333,10 +344,11 @@ Learn how here`,
333344 return (
334345 < >
335346 < Box w = "100%" mb = "8" style = { mainView } >
336- { /* <Dialog /> */ }
337347 < CentreBox style = { claimView } >
338348 < div className = "flex flex-col items-center text-center lg:w-1/2" >
339- < Box style = { balanceContainer } >
349+ < Box style = { balanceContainer } position = "relative" borderRadius = "2xl" overflow = "hidden" >
350+ < Dialog />
351+
340352 { claimed ? (
341353 < Box justifyContent = "center" display = "flex" alignItems = "center" textAlign = "center" >
342354 < ClaimBalance refresh = { refreshRate } />
0 commit comments