Commit 0b0eedbb authored by tom's avatar tom

adapt to mobile view

parent c2879a56
import { Grid, GridItem, Text, Icon, Link, Stat, StatArrow, Tooltip } from '@chakra-ui/react'; import { Grid, GridItem, Text, Icon, Link, Stat, StatArrow, Box, Tooltip } from '@chakra-ui/react';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import React from 'react'; import React from 'react';
import { scroller, Element } from 'react-scroll'; import { scroller, Element } from 'react-scroll';
...@@ -35,7 +35,7 @@ const BlockDetails = () => { ...@@ -35,7 +35,7 @@ const BlockDetails = () => {
const sectionGap = <GridItem colSpan={{ base: undefined, lg: 2 }} mt={{ base: 1, lg: 4 }}/>; const sectionGap = <GridItem colSpan={{ base: undefined, lg: 2 }} mt={{ base: 1, lg: 4 }}/>;
return ( return (
<Grid columnGap={ 8 } rowGap={{ base: 3, lg: 3 }} templateColumns={{ base: 'minmax(0, 1fr)', lg: 'auto minmax(0, 1fr)' }}> <Grid columnGap={ 8 } rowGap={{ base: 3, lg: 3 }} templateColumns={{ base: 'minmax(0, 1fr)', lg: 'auto minmax(0, 1fr)' }} overflow="hidden">
<DetailsInfoItem <DetailsInfoItem
title="Block height" title="Block height"
hint="The block height of a particular block is defined as the number of blocks preceding it in the blockchain." hint="The block height of a particular block is defined as the number of blocks preceding it in the blockchain."
...@@ -81,7 +81,7 @@ const BlockDetails = () => { ...@@ -81,7 +81,7 @@ const BlockDetails = () => {
columnGap={ 1 } columnGap={ 1 }
> >
<Text>{ block.reward.static + block.reward.tx_fee - block.burnt_fees }</Text> <Text>{ block.reward.static + block.reward.tx_fee - block.burnt_fees }</Text>
<Text variant="secondary" whiteSpace="pre">( <Text variant="secondary" whiteSpace="break-spaces">(
<Tooltip label="Static block reward"> <Tooltip label="Static block reward">
<span>{ block.reward.static }</span> <span>{ block.reward.static }</span>
</Tooltip> </Tooltip>
...@@ -103,8 +103,8 @@ const BlockDetails = () => { ...@@ -103,8 +103,8 @@ const BlockDetails = () => {
hint="The total gas amount used in the block and its percentage of gas filled in the block." hint="The total gas amount used in the block and its percentage of gas filled in the block."
> >
<Text>{ block.gas_used.toLocaleString('en') }</Text> <Text>{ block.gas_used.toLocaleString('en') }</Text>
<Utilization ml={ 4 } colorScheme="gray" value={ block.gas_used / block.gas_limit }/> <Utilization ml={ 4 } mr={ 5 } colorScheme="gray" value={ block.gas_used / block.gas_limit }/>
<Stat ml={ 5 }> <Stat>
<StatArrow ml={ 1 } type={ gasUsedPercentage >= 0 ? 'increase' : 'decrease' }/> <StatArrow ml={ 1 } type={ gasUsedPercentage >= 0 ? 'increase' : 'decrease' }/>
<Text as="span" color={ gasUsedPercentage >= 0 ? 'green.500' : 'red.500' } fontWeight={ 600 }>{ Math.abs(gasUsedPercentage) } % Gas Target</Text> <Text as="span" color={ gasUsedPercentage >= 0 ? 'green.500' : 'red.500' } fontWeight={ 600 }>{ Math.abs(gasUsedPercentage) } % Gas Target</Text>
</Stat> </Stat>
...@@ -133,8 +133,8 @@ const BlockDetails = () => { ...@@ -133,8 +133,8 @@ const BlockDetails = () => {
title="Extra data" title="Extra data"
hint="Any data that can be included by the miner in the block." hint="Any data that can be included by the miner in the block."
> >
<Text>{ block.data.utf }</Text> <Text whiteSpace="pre">{ block.data.utf } </Text>
<Text variant="secondary" whiteSpace="pre"> (Hex: { block.data.hex })</Text> <Text variant="secondary">(Hex: { block.data.hex })</Text>
</DetailsInfoItem> </DetailsInfoItem>
{ /* CUT */ } { /* CUT */ }
...@@ -176,13 +176,17 @@ const BlockDetails = () => { ...@@ -176,13 +176,17 @@ const BlockDetails = () => {
<DetailsInfoItem <DetailsInfoItem
title="Hash" title="Hash"
hint="The SHA256 hash of the block." hint="The SHA256 hash of the block."
flexWrap="nowrap"
> >
<HashStringShortenDynamic hash={ block.hash }/> <Box overflow="hidden">
<HashStringShortenDynamic hash={ block.hash }/>
</Box>
<CopyToClipboard text={ block.hash }/> <CopyToClipboard text={ block.hash }/>
</DetailsInfoItem> </DetailsInfoItem>
<DetailsInfoItem <DetailsInfoItem
title="Parent hash" title="Parent hash"
hint="The hash of the block from which this block was generated." hint="The hash of the block from which this block was generated."
flexWrap="nowrap"
> >
<AddressLink hash={ block.parent_hash } type="block" id={ String(block.parent_height) }/> <AddressLink hash={ block.parent_hash } type="block" id={ String(block.parent_height) }/>
<CopyToClipboard text={ block.hash }/> <CopyToClipboard text={ block.hash }/>
...@@ -191,7 +195,7 @@ const BlockDetails = () => { ...@@ -191,7 +195,7 @@ const BlockDetails = () => {
title="State root" title="State root"
hint="The root of the state trie." hint="The root of the state trie."
> >
{ block.state_root } <Text wordBreak="break-all" whiteSpace="break-spaces">{ block.state_root }</Text>
</DetailsInfoItem> </DetailsInfoItem>
<DetailsInfoItem <DetailsInfoItem
title="Nonce" title="Nonce"
......
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