@@ -46,17 +81,42 @@ export const MaintenanceBanner = () => {
)
}
-export const MaintenanceWarningMessage = () => {
+const MaintenanceWarningMessages = () => {
+ return (
+ <>
+ {PAUSED_CHAINS.map((event) => {
+ ;
- Bridging is paused until maintenance is complete. -
- > - } + bannerContents={bannerMessage} startDate={startDate} endDate={endDate} /> @@ -60,10 +56,12 @@ export const MaintenanceWarningMessage = ({ startDate, endDate, pausedChains, + warningMessage, }: { startDate: Date endDate: Date pausedChains: number[] + warningMessage: any }) => { const { fromChainId, toChainId } = useBridgeState() @@ -83,15 +81,7 @@ export const MaintenanceWarningMessage = ({ if (isComplete) return null if (isWarningChain) { - return ( -Bridging is paused until maintenance is complete.
- > - } - /> - ) + returnOptimism bridging is paused until maintenance is complete.
+ ), + bannerMessage: ( +Optimism bridging is paused until maintenance is complete.
+ ), + progressBarMessage:Optimism maintenance in progress
, }, { id: 'base-chain-pause', @@ -163,6 +174,13 @@ const PAUSED_CHAINS = [ endTime: new Date(Date.UTC(2024, 2, 21, 17, 30, 0)), bannerStartTime: new Date(Date.UTC(2024, 2, 21, 17, 0, 0)), bannerEndTime: new Date(Date.UTC(2024, 2, 21, 18, 0, 0)), + warningMessage: ( +Base bridging is paused until maintenance is complete.
+ ), + bannerMessage: ( +Base bridging is paused until maintenance is complete.
+ ), + progressBarMessage:Base maintenance in progress
, }, ] @@ -173,6 +191,7 @@ export const MaintenanceBanners = () => { return (Optimism bridging is paused until maintenance is complete.
), @@ -168,12 +168,12 @@ const PAUSED_CHAINS: ChainPause[] = [ progressBarMessage:Optimism maintenance in progress
, }, { - id: 'base-chain-pause', + id: 'optimism-chain-pause-2', pausedChains: [BASE.id], - startTime: new Date(Date.UTC(2024, 2, 21, 17, 0, 0)), - endTime: new Date(Date.UTC(2024, 2, 21, 17, 30, 0)), - bannerStartTime: new Date(Date.UTC(2024, 2, 21, 17, 0, 0)), - bannerEndTime: new Date(Date.UTC(2024, 2, 21, 18, 0, 0)), + startTime: new Date(Date.UTC(2024, 2, 21, 17, 41, 0)), + endTime: new Date(Date.UTC(2024, 2, 21, 17, 42, 0)), + bannerStartTime: new Date(Date.UTC(2024, 2, 21, 17, 40, 0)), + bannerEndTime: new Date(Date.UTC(2024, 2, 21, 17, 43, 0)), warningMessage: (Base bridging is paused until maintenance is complete.
), From 8a346cc954523992ac8511961b14d8599a3dfba4 Mon Sep 17 00:00:00 2001 From: bigboydiamonds <57741810+bigboydiamonds@users.noreply.github.com> Date: Thu, 21 Mar 2024 10:47:59 -0700 Subject: [PATCH 07/58] Add dev comments to MaintenanceBanner; refactor --- .../Maintenance/MaintenanceBanner.tsx | 36 ++++++++++++++++++ .../template => }/MaintenanceEvent.tsx | 37 ++----------------- packages/synapse-interface/pages/index.tsx | 6 +-- .../pages/state-managed-bridge/index.tsx | 2 +- 4 files changed, 42 insertions(+), 39 deletions(-) create mode 100644 packages/synapse-interface/components/Maintenance/MaintenanceBanner.tsx rename packages/synapse-interface/components/Maintenance/{Events/template => }/MaintenanceEvent.tsx (87%) diff --git a/packages/synapse-interface/components/Maintenance/MaintenanceBanner.tsx b/packages/synapse-interface/components/Maintenance/MaintenanceBanner.tsx new file mode 100644 index 0000000000..e151a24ab8 --- /dev/null +++ b/packages/synapse-interface/components/Maintenance/MaintenanceBanner.tsx @@ -0,0 +1,36 @@ +import { useIntervalTimer } from '@/utils/hooks/useIntervalTimer' +import { getCountdownTimeStatus } from './EventCountdownProgressBar' +import { AnnouncementBanner } from './AnnouncementBanner' + +/** + * Creates an automatic Annoucement Banner based on start/end times. + * + * @param {string} id - Unique id that determines instance of banner to track in browser + * @param {Date} startDate - Date that automatically triggers displaying banner + * @param {Date} endDate - Date that automatically triggers removing banner + * @param {any} bannerMessage - Allow for flexibility when constructing banner message + */ +export const MaintenanceBanner = ({ + id, + startDate, + endDate, + bannerMessage, +}: { + id: string + startDate: Date + endDate: Date + bannerMessage: any +}) => { + const { isComplete } = getCountdownTimeStatus(startDate, endDate) + + useIntervalTimer(60000, isComplete) + + return ( +