Commit 42149143 authored by isstuev's avatar isstuev

fix

parent 69fb150d
...@@ -140,18 +140,6 @@ The app instance could be customized by passing following variables to NodeJS en ...@@ -140,18 +140,6 @@ The app instance could be customized by passing following variables to NodeJS en
| NEXT_PUBLIC_IS_L2_NETWORK | `boolean` *(optional)* | Set to true for L2 solutions (Optimism Bedrock based) | false | | NEXT_PUBLIC_IS_L2_NETWORK | `boolean` *(optional)* | Set to true for L2 solutions (Optimism Bedrock based) | false |
| NEXT_PUBLIC_L1_BASE_URL | `string` *(optional)* | Base Blockscout URL for L1 network | `'http://eth-goerli.blockscout.com'` | | NEXT_PUBLIC_L1_BASE_URL | `string` *(optional)* | Base Blockscout URL for L1 network | `'http://eth-goerli.blockscout.com'` |
### L2 configuration
| Variable | Type | Description | Default value
| --- | --- | --- | --- |
| NEXT_PUBLIC_IS_L2_NETWORK | `boolean` *(optional)* | Set to true for L2 solutions (Optimism Bedrock based) | false |
| NEXT_PUBLIC_L1_BASE_URL | `string` *(optional)* | Base Blockscout URL for L1 network | `'http://eth-goerli.blockscout.com'` |
### L2 configuration
| Variable | Type | Description | Default value
| --- | --- | --- | --- |
| NEXT_PUBLIC_IS_L2_NETWORK | `boolean` *(optional)* | Set to true for L2 solutions (Optimism Bedrock based) | false |
| NEXT_PUBLIC_L1_BASE_URL | `string` *(optional)* | Base Blockscout URL for L1 network | `'http://eth-goerli.blockscout.com'` |
### Marketplace app configuration properties ### Marketplace app configuration properties
| Property | Type | Description | Example value | Property | Type | Description | Example value
......
...@@ -5,7 +5,7 @@ import React from 'react'; ...@@ -5,7 +5,7 @@ import React from 'react';
import getNetworkTitle from 'lib/networks/getNetworkTitle'; import getNetworkTitle from 'lib/networks/getNetworkTitle';
import OutputRoots from 'ui/pages/OutputRoots'; import OutputRoots from 'ui/pages/OutputRoots';
const TokensPage: NextPage = () => { const OutputRootsPage: NextPage = () => {
const title = getNetworkTitle(); const title = getNetworkTitle();
return ( return (
<> <>
...@@ -17,6 +17,6 @@ const TokensPage: NextPage = () => { ...@@ -17,6 +17,6 @@ const TokensPage: NextPage = () => {
); );
}; };
export default TokensPage; export default OutputRootsPage;
export { getServerSideProps } from 'lib/next/getServerSidePropsL2'; export { getServerSideProps } from 'lib/next/getServerSidePropsL2';
/* eslint-disable @typescript-eslint/naming-convention */
import { Box, Flex, Text, HStack, Icon } from '@chakra-ui/react'; import { Box, Flex, Text, HStack, Icon } from '@chakra-ui/react';
import { route } from 'nextjs-routes'; import { route } from 'nextjs-routes';
import React from 'react'; import React from 'react';
...@@ -14,39 +13,38 @@ import LinkExternal from 'ui/shared/LinkExternal'; ...@@ -14,39 +13,38 @@ import LinkExternal from 'ui/shared/LinkExternal';
import LinkInternal from 'ui/shared/LinkInternal'; import LinkInternal from 'ui/shared/LinkInternal';
import ListItemMobile from 'ui/shared/ListItemMobile'; import ListItemMobile from 'ui/shared/ListItemMobile';
type Props = OutputRootsItem; type Props = { item: OutputRootsItem };
const OutputRootsListItem = ({ const OutputRootsListItem = ({ item }: Props) => {
l2_output_index, const timeAgo = useTimeAgoIncrement(item.l1_timestamp, false);
l1_timestamp,
l2_block_number,
l1_tx_hash,
output_root,
}: Props) => {
const timeAgo = useTimeAgoIncrement(l1_timestamp, false);
return ( return (
<ListItemMobile rowGap={ 3 }> <ListItemMobile rowGap={ 3 }>
<Flex alignItems="center" justifyContent="space-between" w="100%"> <Flex alignItems="center" justifyContent="space-between" w="100%">
#{ l2_output_index } #{ item.l2_output_index }
{ l1_timestamp && <Text variant="secondary" fontWeight="400" fontSize="sm">{ timeAgo }</Text> } { item.l1_timestamp && <Text variant="secondary" fontWeight="400" fontSize="sm">{ timeAgo }</Text> }
</Flex> </Flex>
<HStack spacing={ 3 }> <HStack spacing={ 3 }>
<Text fontSize="sm" fontWeight={ 500 }>L2 block</Text> <Text fontSize="sm" fontWeight={ 500 }>L2 block</Text>
<LinkInternal display="flex" alignItems="center" href={ route({ pathname: '/block/[height]', query: { height: l2_block_number.toString() } }) }> <LinkInternal
{ l2_block_number } display="flex"
width="fit-content"
alignItems="center"
href={ route({ pathname: '/block/[height]', query: { height: item.l2_block_number.toString() } }) }
>
{ item.l2_block_number }
</LinkInternal> </LinkInternal>
</HStack> </HStack>
<HStack spacing={ 3 } width="100%"> <HStack spacing={ 3 } width="100%">
<Text fontSize="sm" fontWeight={ 500 } whiteSpace="nowrap">Output root</Text> <Text fontSize="sm" fontWeight={ 500 } whiteSpace="nowrap">Output root</Text>
<Flex overflow="hidden" whiteSpace="nowrap" alignItems="center" w="100%"> <Flex overflow="hidden" whiteSpace="nowrap" alignItems="center" w="100%">
<Text variant="secondary" w="calc(100% - 36px)"><HashStringShortenDynamic hash={ output_root }/></Text> <Text variant="secondary" w="calc(100% - 36px)"><HashStringShortenDynamic hash={ item.output_root }/></Text>
<CopyToClipboard text={ output_root } ml={ 2 }/> <CopyToClipboard text={ item.output_root } ml={ 2 }/>
</Flex> </Flex>
</HStack> </HStack>
<LinkExternal w="100%" href={ appConfig.L2.L1BaseUrl + route({ pathname: '/tx/[hash]', query: { hash: l1_tx_hash } }) }> <LinkExternal w="100%" href={ appConfig.L2.L1BaseUrl + route({ pathname: '/tx/[hash]', query: { hash: item.l1_tx_hash } }) }>
<Icon as={ txIcon } boxSize={ 6 } mr={ 1 }/> <Icon as={ txIcon } boxSize={ 6 } mr={ 1 }/>
<Box w="calc(100% - 36px)" overflow="hidden" whiteSpace="nowrap"><HashStringShortenDynamic hash={ l1_tx_hash }/></Box> <Box w="calc(100% - 36px)" overflow="hidden" whiteSpace="nowrap"><HashStringShortenDynamic hash={ item.l1_tx_hash }/></Box>
</LinkExternal> </LinkExternal>
</ListItemMobile> </ListItemMobile>
); );
......
...@@ -26,7 +26,7 @@ const OutputRootsTable = ({ items, top }: Props) => { ...@@ -26,7 +26,7 @@ const OutputRootsTable = ({ items, top }: Props) => {
</Thead> </Thead>
<Tbody> <Tbody>
{ items.map((item) => ( { items.map((item) => (
<OutputRootsTableItem key={ item.l2_output_index } { ...item }/> <OutputRootsTableItem key={ item.l2_output_index } item={ item }/>
)) } )) }
</Tbody> </Tbody>
</Table> </Table>
......
/* eslint-disable @typescript-eslint/naming-convention */
import { Box, Flex, Td, Tr, Text, Icon } from '@chakra-ui/react'; import { Box, Flex, Td, Tr, Text, Icon } from '@chakra-ui/react';
import { route } from 'nextjs-routes'; import { route } from 'nextjs-routes';
import React from 'react'; import React from 'react';
...@@ -14,21 +13,15 @@ import HashStringShortenDynamic from 'ui/shared/HashStringShortenDynamic'; ...@@ -14,21 +13,15 @@ import HashStringShortenDynamic from 'ui/shared/HashStringShortenDynamic';
import LinkExternal from 'ui/shared/LinkExternal'; import LinkExternal from 'ui/shared/LinkExternal';
import LinkInternal from 'ui/shared/LinkInternal'; import LinkInternal from 'ui/shared/LinkInternal';
type Props = OutputRootsItem; type Props = { item: OutputRootsItem };
const OutputRootsTableItem = ({ const OutputRootsTableItem = ({ item }: Props) => {
l2_output_index, const timeAgo = useTimeAgoIncrement(item.l1_timestamp, false);
l1_timestamp,
l2_block_number,
l1_tx_hash,
output_root,
}: Props) => {
const timeAgo = useTimeAgoIncrement(l1_timestamp, false);
return ( return (
<Tr> <Tr>
<Td verticalAlign="middle"> <Td verticalAlign="middle">
<Text>{ l2_output_index }</Text> <Text>{ item.l2_output_index }</Text>
</Td> </Td>
<Td verticalAlign="middle"> <Td verticalAlign="middle">
<Text variant="secondary">{ timeAgo }</Text> <Text variant="secondary">{ timeAgo }</Text>
...@@ -37,25 +30,26 @@ const OutputRootsTableItem = ({ ...@@ -37,25 +30,26 @@ const OutputRootsTableItem = ({
<LinkInternal <LinkInternal
fontWeight={ 600 } fontWeight={ 600 }
display="flex" display="flex"
width="fit-content"
alignItems="center" alignItems="center"
href={ route({ pathname: '/block/[height]', query: { height: l2_block_number.toString() } }) } href={ route({ pathname: '/block/[height]', query: { height: item.l2_block_number.toString() } }) }
> >
<Icon as={ txBatchIcon } boxSize={ 6 } mr={ 1 }/> <Icon as={ txBatchIcon } boxSize={ 6 } mr={ 1 }/>
{ l2_block_number } { item.l2_block_number }
</LinkInternal> </LinkInternal>
</Td> </Td>
<Td verticalAlign="middle" pr={ 12 }> <Td verticalAlign="middle" pr={ 12 }>
<Flex> <Flex>
<LinkExternal w="100%" href={ appConfig.L2.L1BaseUrl + route({ pathname: '/tx/[hash]', query: { hash: l1_tx_hash } }) }> <LinkExternal w="100%" href={ appConfig.L2.L1BaseUrl + route({ pathname: '/tx/[hash]', query: { hash: item.l1_tx_hash } }) }>
<Icon as={ txIcon } boxSize={ 6 } mr={ 1 }/> <Icon as={ txIcon } boxSize={ 6 } mr={ 1 }/>
<Box w="calc(100% - 36px)" overflow="hidden" whiteSpace="nowrap"><HashStringShortenDynamic hash={ l1_tx_hash }/></Box> <Box w="calc(100% - 36px)" overflow="hidden" whiteSpace="nowrap"><HashStringShortenDynamic hash={ item.l1_tx_hash }/></Box>
</LinkExternal> </LinkExternal>
</Flex> </Flex>
</Td> </Td>
<Td verticalAlign="middle"> <Td verticalAlign="middle">
<Flex overflow="hidden" whiteSpace="nowrap" w="100%" alignItems="center"> <Flex overflow="hidden" whiteSpace="nowrap" w="100%" alignItems="center">
<Box w="calc(100% - 36px)"><HashStringShortenDynamic hash={ output_root }/></Box> <Box w="calc(100% - 36px)"><HashStringShortenDynamic hash={ item.output_root }/></Box>
<CopyToClipboard text={ output_root } ml={ 2 }/> <CopyToClipboard text={ item.output_root } ml={ 2 }/>
</Flex> </Flex>
</Td> </Td>
</Tr> </Tr>
......
...@@ -55,7 +55,7 @@ const OutputRoots = () => { ...@@ -55,7 +55,7 @@ const OutputRoots = () => {
</Flex> </Flex>
</ActionBar> </ActionBar>
) } ) }
<Show below="lg" ssr={ false }>{ data.items.map((item => <OutputRootsListItem key={ item.l2_output_index } { ...item }/>)) }</Show> <Show below="lg" ssr={ false }>{ data.items.map((item => <OutputRootsListItem key={ item.l2_output_index } item={ item }/>)) }</Show>
<Hide below="lg" ssr={ false }><OutputRootsTable items={ data.items } top={ isPaginationVisible ? 80 : 0 }/></Hide> <Hide below="lg" ssr={ false }><OutputRootsTable items={ data.items } top={ isPaginationVisible ? 80 : 0 }/></Hide>
</> </>
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment