-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add banner to page when visiting a url that has a unsupported network #…
- Loading branch information
1 parent
fb781a1
commit 48061d7
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
explorer/src/components/common/UnsupportedNetworkBanner.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,44 @@ | ||
import { Routes } from '@/constants/routes' | ||
import { NetworkId, NetworkName } from '@autonomys/auto-utils' | ||
import useIndexers from 'hooks/useIndexers' | ||
import Link from 'next/link' | ||
import { usePathname } from 'next/navigation' | ||
import React, { FC } from 'react' | ||
|
||
export const UnsupportedNetworkBanner: FC = () => { | ||
const { network } = useIndexers() | ||
const pathName = usePathname() | ||
|
||
return ( | ||
!pathName.includes(network) && ( | ||
<div className='container mx-auto mb-4 flex grow justify-center px-5 md:px-[25px] 2xl:px-0'> | ||
<div className='sticky top-0 z-10 w-full'> | ||
<div className='w-full rounded-[20px] bg-[#DDEFF1] p-5 shadow dark:border-none dark:bg-boxDark'> | ||
<div className='flex flex-col gap-4'> | ||
<div className='text-[20px] font-bold text-[#282929] dark:text-white'> | ||
Unsupported Network | ||
</div> | ||
<div className='text-[15px] text-[#282929] dark:text-white'> | ||
The current network selected is not supported, please select one of the supported | ||
networks from the network selector. | ||
</div> | ||
<div> | ||
<Link href={`/${NetworkId.MAINNET}/${Routes.consensus}`}> | ||
<button className='self-start rounded-[20px] bg-white px-[33px] py-[13px] text-sm font-medium text-gray-800 hover:bg-gray-200 dark:bg-[#1E254E] dark:text-white'> | ||
Visit {NetworkName.MAINNET} | ||
</button> | ||
</Link> | ||
|
||
<Link className='ml-4' href={`/${NetworkId.TAURUS}/${Routes.consensus}`}> | ||
<button className='self-start rounded-[20px] bg-white px-[33px] py-[13px] text-sm font-medium text-gray-800 hover:bg-gray-200 dark:bg-[#1E254E] dark:text-white'> | ||
Visit {NetworkName.TAURUS} | ||
</button> | ||
</Link> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
) | ||
} |
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