Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(unlock-app): add testnet deprecation warning for Mumbai and Goer…
…li (#13450)
- Loading branch information
Showing
4 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
unlock-app/src/components/interface/locks/Create/elements/NetworkWarning.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React from 'react' | ||
import { useConfig } from '~/utils/withConfig' | ||
import { WarningBar } from './BalanceWarning' | ||
|
||
interface NetworkWarningProps { | ||
additionalText?: string | ||
date: Date | ||
} | ||
|
||
const NETWORK_MAPPING_MAPPING: Record<number, NetworkWarningProps> = { | ||
5: { | ||
date: new Date('30 Apr 2024'), | ||
}, | ||
80001: { | ||
date: new Date('30 Apr 2024'), | ||
}, | ||
} | ||
|
||
export const NetworkWarning = ({ | ||
network, | ||
}: { | ||
network: number | undefined | ||
}) => { | ||
const config = useConfig() | ||
if (!network) return null | ||
console.log(network) | ||
if (!NETWORK_MAPPING_MAPPING[network!]) return | ||
const { date } = NETWORK_MAPPING_MAPPING[network!] | ||
console.log(date) | ||
const networkName = config.networks[network!].name | ||
|
||
return ( | ||
<WarningBar> | ||
<span> | ||
{networkName} is getting deprecated on{' '} | ||
{date.toLocaleString(undefined, { | ||
year: 'numeric', | ||
month: 'long', | ||
day: 'numeric', | ||
})} | ||
. | ||
</span> | ||
</WarningBar> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters