Skip to content

Commit

Permalink
Create Event example for annoucements + progress bar, add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bigboydiamonds committed Mar 14, 2024
1 parent ab109ce commit 6ade432
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 95 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import { LinearAnimatedProgressBar } from './LinearAnimatedProgressBar'
import { useIntervalTimer } from '@/utils/hooks/useIntervalTimer'

/**
* Automated Event Countdown Progress bar that displays
* time remaining for event target end date to be reached.
* Displays a visual progress bar with percentage completion.
*
* @param eventLabel text to display in progress bar
* @param startDate starting date for progress bar to activate
* @param endDate ending date for progress bar to disappear
*/
export const useEventCountdownProgressBar = (
eventLabel: string,
startDate: Date,
Expand All @@ -10,11 +19,11 @@ export const useEventCountdownProgressBar = (
isComplete: boolean
EventCountdownProgressBar: JSX.Element
} => {
useIntervalTimer(60000)

const { totalTimeRemainingInMinutes, hoursRemaining, isComplete, isPending } =
getCountdownTimeStatus(startDate, endDate)

useIntervalTimer(60000, isComplete)

const timeRemaining: string =
totalTimeRemainingInMinutes > 90
? `${hoursRemaining}h`
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { AnnouncementBanner } from '../AnnouncementBanner'
import { WarningMessage } from '../../Warning'
import { AnnouncementBanner } from '../../AnnouncementBanner'
import { WarningMessage } from '../../../Warning'
import { useBridgeState } from '@/slices/bridge/hooks'
import { OPTIMISM, BASE } from '@/constants/chains/master'
import {
useEventCountdownProgressBar,
getCountdownTimeStatus,
} from '../EventCountdownProgressBar'
} from '../../EventCountdownProgressBar'
import { useIntervalTimer } from '@/utils/hooks/useIntervalTimer'

/**
* Leaving this file to serve as an example for how to create
* automated annoucement banners and event countdown timer bars
* with the ability to pause Bridge by selected chain ids
*/

/**
* Start: 25 min prior to Ecotone Fork Upgrade Time @ (March 14, 00:00 UTC)
* End: 25 min after start of Ecotone Fork Upgrade Time
Expand Down

0 comments on commit 6ade432

Please sign in to comment.