Skip to content

Commit

Permalink
Merge pull request #2492 from synapsecns/fe/paused-chains-json
Browse files Browse the repository at this point in the history
Fe/paused chains json
  • Loading branch information
bigboydiamonds authored Apr 12, 2024
2 parents 688f780 + 3bde6ec commit 91a63ca
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 60 deletions.
130 changes: 72 additions & 58 deletions packages/synapse-interface/components/Maintenance/Maintenance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { MaintenanceBanner } from './components/MaintenanceBanner'
import { MaintenanceWarningMessage } from './components/MaintenanceWarningMessage'
import { useMaintenanceCountdownProgress } from './components/useMaintenanceCountdownProgress'

/** Import chain pause public constant */
import pausedChains from '@/public/pausedChains.json'

interface ChainPause {
id: string
pausedFromChains: number[]
Expand All @@ -11,69 +14,80 @@ interface ChainPause {
endTime: Date | null // Indefinite if null
bannerStartTime: Date
bannerEndTime: Date | null // Indefinite if null
warningMessage: any
bannerMessage: any
progressBarMessage: any
warningMessage: JSX.Element
bannerMessage: JSX.Element
progressBarMessage: JSX.Element
disableBanner?: boolean
disableWarning?: boolean
disableCountdown?: boolean
}

const PAUSED_CHAINS: ChainPause[] = [
{
id: 'optimism-chain-pause',
pausedFromChains: [OPTIMISM.id],
pausedToChains: [],
startTime: new Date(Date.UTC(2024, 2, 21, 18, 0, 0)),
endTime: new Date(Date.UTC(2024, 2, 21, 19, 40, 0)),
bannerStartTime: new Date(Date.UTC(2024, 2, 21, 18, 0, 0)),
bannerEndTime: new Date(Date.UTC(2024, 2, 21, 19, 40, 0)),
warningMessage: (
<p> Optimism bridging is paused until maintenance is complete. </p>
),
bannerMessage: (
<p> Optimism bridging is paused until maintenance is complete. </p>
),
progressBarMessage: <p> Optimism maintenance in progress </p>,
},
{
id: 'base-chain-pause',
pausedFromChains: [BASE.id],
pausedToChains: [BASE.id],
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: (
<p> Base bridging is paused until maintenance is complete. </p>
),
bannerMessage: (
<p> Base bridging is paused until maintenance is complete. </p>
),
progressBarMessage: <p> Base maintenance in progress </p>,
},
{
id: 'base-chain-pause',
pausedFromChains: [BASE.id],
pausedToChains: [BASE.id],
startTime: new Date(Date.UTC(2024, 2, 21, 17, 41, 0)),
endTime: null,
bannerStartTime: new Date(Date.UTC(2024, 2, 27, 4, 40, 0)),
bannerEndTime: null,
warningMessage: (
<p> Base bridging is paused until maintenance is complete. </p>
),
bannerMessage: (
<p className="m-auto">
Base bridging is paused until maintenance is complete.
</p>
),
progressBarMessage: <p> Base maintenance in progress </p>,
disableBanner: false,
disableWarning: false,
disableCountdown: false,
},
]
const PAUSED_CHAINS: ChainPause[] = pausedChains.map((pause) => ({
...pause,
startTime: new Date(pause.startTime),
endTime: pause.endTime ? new Date(pause.endTime) : null,
bannerStartTime: new Date(pause.bannerStartTime),
bannerEndTime: pause.bannerEndTime ? new Date(pause.bannerEndTime) : null,
warningMessage: <p>{pause.warningMessage}</p>,
bannerMessage: <p>{pause.bannerMessage}</p>,
progressBarMessage: <p>{pause.progressBarMessage}</p>,
}))

// const PAUSED_CHAINS: ChainPause[] = [
// {
// id: 'optimism-chain-pause',
// pausedFromChains: [OPTIMISM.id],
// pausedToChains: [],
// startTime: new Date(Date.UTC(2024, 2, 21, 18, 0, 0)),
// endTime: new Date(Date.UTC(2024, 2, 21, 19, 40, 0)),
// bannerStartTime: new Date(Date.UTC(2024, 2, 21, 18, 0, 0)),
// bannerEndTime: new Date(Date.UTC(2024, 2, 21, 19, 40, 0)),
// warningMessage: (
// <p> Optimism bridging is paused until maintenance is complete. </p>
// ),
// bannerMessage: (
// <p> Optimism bridging is paused until maintenance is complete. </p>
// ),
// progressBarMessage: <p> Optimism maintenance in progress </p>,
// },
// {
// id: 'base-chain-pause',
// pausedFromChains: [BASE.id],
// pausedToChains: [BASE.id],
// 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: (
// <p> Base bridging is paused until maintenance is complete. </p>
// ),
// bannerMessage: (
// <p> Base bridging is paused until maintenance is complete. </p>
// ),
// progressBarMessage: <p> Base maintenance in progress </p>,
// },
// {
// id: 'base-chain-pause',
// pausedFromChains: [BASE.id],
// pausedToChains: [BASE.id],
// startTime: new Date(Date.UTC(2024, 2, 21, 17, 41, 0)),
// endTime: null,
// bannerStartTime: new Date(Date.UTC(2024, 2, 27, 4, 40, 0)),
// bannerEndTime: null,
// warningMessage: (
// <p> Base bridging is paused until maintenance is complete. </p>
// ),
// bannerMessage: (
// <p className="m-auto">
// Base bridging is paused until maintenance is complete.
// </p>
// ),
// progressBarMessage: <p> Base maintenance in progress </p>,
// disableBanner: false,
// disableWarning: false,
// disableCountdown: false,
// },
// ]

export const MaintenanceBanners = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const EventCountdownProgressBar = ({
return (
<div
className={`
flex flex-col bg-bgLighter mb-3
flex flex-col bg-bgLighter
border border-surface rounded-md
text-primary text-xs md:text-base
`}
Expand Down
2 changes: 1 addition & 1 deletion packages/synapse-interface/components/Warning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const WarningMessage = ({
}) => {
return (
<div
className={`flex flex-col bg-[#353038] text-white text-sm p-3 rounded-md mt-4 ${twClassName}`}
className={`flex flex-col bg-[#353038] text-white text-sm p-3 rounded-md ${twClassName}`}
>
{header && <div className="mb-2 font-bold">{header}</div>}
{message && <div>{message}</div>}
Expand Down
17 changes: 17 additions & 0 deletions packages/synapse-interface/public/pausedChains.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[
{
"id": "base-chain-pause",
"pausedFromChains": [8453],
"pausedToChains": [8453],
"startTime": "2024-04-12T17:41:00Z",
"endTime": null,
"bannerStartTime": "2024-04-12T04:40:00Z",
"bannerEndTime": null,
"warningMessage": "Base bridging is paused until maintenance is complete.",
"bannerMessage": "Base bridging is paused until maintenance is complete.",
"progressBarMessage": "Base maintenance in progress",
"disableBanner": false,
"disableWarning": false,
"disableCountdown": false
}
]

0 comments on commit 91a63ca

Please sign in to comment.