Skip to content

Commit

Permalink
useEcotoneForkEventCountdownProgress to determine when to display pro…
Browse files Browse the repository at this point in the history
…gress
  • Loading branch information
bigboydiamonds committed Mar 13, 2024
1 parent a0fa1da commit 2f871fe
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { AnnouncementBanner } from '../AnnouncementBanner'
import { WarningMessage } from '../../Warning'
import { useBridgeState } from '@/slices/bridge/hooks'
import { OPTIMISM, BASE } from '@/constants/chains/master'
import { useEventCountdownProgressBar } from '../EventCountdownProgressBar'

/**
* Start: 10 min prior to Ecotone Fork Upgrade Time @ (March 14, 00:00 UTC)
Expand Down Expand Up @@ -55,3 +56,25 @@ export const EcotoneForkWarningMessage = () => {
)
} else return null
}

export const useEcotoneForkEventCountdownProgress = () => {
const { fromChainId, toChainId } = useBridgeState()

const isChainOptimism = [fromChainId, toChainId].includes(OPTIMISM.id)
const isChainBase = [fromChainId, toChainId].includes(BASE.id)

const {
isPending: isEcotoneForkUpgradePending,
EventCountdownProgressBar: EcotoneForkCountdownProgressBar,
} = useEventCountdownProgressBar(
'Ecotone Fork upgrade in progress',
ECOTONE_FORK_START_DATE,
ECOTONE_FORK_END_DATE
)

return {
isEcotoneForkUpgradePending,
EcotoneForkCountdownProgressBar:
isChainOptimism || isChainBase ? EcotoneForkCountdownProgressBar : null,
}
}
20 changes: 12 additions & 8 deletions packages/synapse-interface/pages/state-managed-bridge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ import {
ECOTONE_FORK_START_DATE,
ECOTONE_FORK_END_DATE,
EcotoneForkWarningMessage,
useEcotoneForkEventCountdownProgress,
} from '@/components/Maintenance/Events/EcotoneForkUpgrade'

import { OPTIMISM, BASE, METIS } from '@/constants/chains/master'
Expand Down Expand Up @@ -533,14 +534,17 @@ const StateManagedBridge = () => {
'-mt-4 fixed z-50 w-full h-full bg-opacity-50 bg-[#343036]'

/* Remove after upgrades */
const {
isPending: isEcotoneForkUpgradePending,
EventCountdownProgressBar: EcotoneForkCountdownProgressBar,
} = useEventCountdownProgressBar(
'Ecotone Fork upgrade in progress',
ECOTONE_FORK_START_DATE,
ECOTONE_FORK_END_DATE
)
// const {
// isPending: isEcotoneForkUpgradePending,
// EventCountdownProgressBar: EcotoneForkCountdownProgressBar,
// } = useEventCountdownProgressBar(
// 'Ecotone Fork upgrade in progress',
// ECOTONE_FORK_START_DATE,
// ECOTONE_FORK_END_DATE
// )

const { isEcotoneForkUpgradePending, EcotoneForkCountdownProgressBar } =
useEcotoneForkEventCountdownProgress()

const {
isPending: isMetisUpgradePending,
Expand Down

0 comments on commit 2f871fe

Please sign in to comment.