Files
explore/ui/pages/BlockCountdownIndex.tsx
edc54514f1 OP Superchain explorer: aggregated views (#3040)
* refactor widgets on home page

* coming soon placeholder component

* top accounts page

* contract data

* address ERC-20 tokens list

* chain filter for address ERC-20 tokens

* token select for address detailed view

* address details fields

* tokens table

* stats widgets on home page

* chain indicators graph on the home page

* quick search

* search results all tab

* tabs and chain select on search results page

* search results mobile view

* add contract info to search and address details

* add text filter for tokens and search improvements

* load all results inside tab on search results page

* token balance info

* add support for domains in the full search

* Multichain explorer

Resolves #2989

* add envs validator for multichain

* add some tests

* fix search bar on search results page on mobile

* home stats fixes

* fix ts

* optimize amount of queries on address page

* add more contract info on address page

* add enter key hint to search input

* fix tests

* fix test

* update bg.primary css-variable on color theme change

* sitemap for multichain

* txs page: render first tab if blob tab is not available on the chain

* filter out in active chains from chain select on address page and user ops page

* add chain icon to advanced filter table

* fix tooltip on entity with shield

* fix ts

* show contract implementations

* fixes

* add chain icon to all lists

* refactor zetachain chains config type

* use chain id as primary option instead of chain slug

* refactor chain config type for multichain and essential dapps

* refactor chain icon and chain select

* rename chain-slug in chain_slug

* change default radius of chain icon and update screenshots for multichain tests

* change conditions for "isContract" and "isVerified"

* test fixes

* make shield optional for external chain entities

* add chain icon to approvals lists

* add stats page for multichain

* add chain postfix to chart .png and .csv assets name

* fix tests

* sync verified contracts language filter and fix loading state in the search results page

* fix sol2uml diagram and csv export

* regcred from helmfile for review

* link fixes

* fix state for unknown address

* fix incorrect chain in the context during spa transition to the same route on different chain

* add links to stats widgets

* add mixpanel to L2 demo values

* show message of on-demand contract verification

* fix screenshots

---------

Co-authored-by: Nick Zenchik <[email protected]>
2025-11-18 09:44:22 +01:00

76 lines
2.4 KiB
TypeScript

import { chakra, Box, Center } from '@chakra-ui/react';
import { useRouter } from 'next/router';
import React from 'react';
import { routeParams } from 'nextjs/routes';
import { useMultichainContext } from 'lib/contexts/multichain';
import { Heading } from 'toolkit/chakra/heading';
import { FilterInput } from 'toolkit/components/filters/FilterInput';
import ChainIcon from 'ui/shared/externalChains/ChainIcon';
import IconSvg from 'ui/shared/IconSvg';
const BlockCountdownIndex = () => {
const router = useRouter();
const multichainContext = useMultichainContext();
const handleFormSubmit = React.useCallback((event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
const formData = new FormData(event.target as HTMLFormElement);
const searchTerm = formData.get('search_term');
if (typeof searchTerm === 'string' && searchTerm) {
const url = routeParams({ pathname: '/block/countdown/[height]', query: { height: searchTerm } }, multichainContext);
router.push(url, undefined, { shallow: true });
}
}, [ router, multichainContext ]);
return (
<Center h="100%" justifyContent={{ base: 'flex-start', lg: 'center' }} flexDir="column" textAlign="center" pt={{ base: 8, lg: 0 }}>
<Box position="relative">
<IconSvg
name="block_countdown"
color={{ _light: 'gray.300', _dark: 'gray.600' }}
w={{ base: '160px', lg: '240px' }}
h={{ base: '123px', lg: '184px' }}
/>
{ multichainContext?.chain && (
<ChainIcon
data={ multichainContext.chain }
position="absolute"
bottom={{ base: '15px', lg: '22px' }}
left={{ base: '105px', lg: '150px' }}
boxSize={{ lg: '60px' }}
bgColor="bg.primary"
borderRadius="full"
/>
) }
</Box>
<Heading
level="1"
mt={{ base: 3, lg: 6 }}
>
Block countdown
</Heading>
<Box mt={ 2 }>
The estimated time for a block to be created and added to the blockchain.
</Box>
<chakra.form
noValidate
onSubmit={ handleFormSubmit }
w={{ base: '100%', lg: '360px' }}
mt={{ base: 3, lg: 6 }}
>
<FilterInput
placeholder="Search by block number"
size="sm"
type="number"
name="search_term"
/>
</chakra.form>
</Center>
);
};
export default React.memo(BlockCountdownIndex);