Commit 7f1ad8c0 authored by tom goriunov's avatar tom goriunov Committed by GitHub

Update SearchBar background color and hide miner field in block views (#1397)

* update SearchBar background color on home page

* add miner field to NEXT_PUBLIC_VIEWS_BLOCK_HIDDEN_FIELDS variable supported values
parent 4652c13f
...@@ -188,6 +188,7 @@ Settings for meta tags and OG tags ...@@ -188,6 +188,7 @@ Settings for meta tags and OG tags
| `burnt_fees` | Burnt fees | | `burnt_fees` | Burnt fees |
| `total_reward` | Total block reward | | `total_reward` | Total block reward |
| `nonce` | Block nonce | | `nonce` | Block nonce |
| `miner` | Address of block's miner or validator |
   
......
...@@ -4,6 +4,7 @@ export const BLOCK_FIELDS_IDS = [ ...@@ -4,6 +4,7 @@ export const BLOCK_FIELDS_IDS = [
'burnt_fees', 'burnt_fees',
'total_reward', 'total_reward',
'nonce', 'nonce',
'miner',
] as const; ] as const;
export type BlockFieldId = ArrayElement<typeof BLOCK_FIELDS_IDS>; export type BlockFieldId = ArrayElement<typeof BLOCK_FIELDS_IDS>;
...@@ -202,6 +202,7 @@ const BlockDetails = ({ query }: Props) => { ...@@ -202,6 +202,7 @@ const BlockDetails = ({ query }: Props) => {
</Skeleton> </Skeleton>
</DetailsInfoItem> </DetailsInfoItem>
) } ) }
{ !config.UI.views.block.hiddenFields?.miner && (
<DetailsInfoItem <DetailsInfoItem
title={ verificationTitle } title={ verificationTitle }
hint="A block producer who successfully included the block onto the blockchain" hint="A block producer who successfully included the block onto the blockchain"
...@@ -215,6 +216,7 @@ const BlockDetails = ({ query }: Props) => { ...@@ -215,6 +216,7 @@ const BlockDetails = ({ query }: Props) => {
{ /* api doesn't return the block processing time yet */ } { /* api doesn't return the block processing time yet */ }
{ /* <Text>{ dayjs.duration(block.minedIn, 'second').humanize(true) }</Text> */ } { /* <Text>{ dayjs.duration(block.minedIn, 'second').humanize(true) }</Text> */ }
</DetailsInfoItem> </DetailsInfoItem>
) }
{ !isRollup && !totalReward.isEqualTo(ZERO) && !config.UI.views.block.hiddenFields?.total_reward && ( { !isRollup && !totalReward.isEqualTo(ZERO) && !config.UI.views.block.hiddenFields?.total_reward && (
<DetailsInfoItem <DetailsInfoItem
title="Block reward" title="Block reward"
......
...@@ -57,6 +57,7 @@ const BlocksListItem = ({ data, isLoading, enableTimeIncrement }: Props) => { ...@@ -57,6 +57,7 @@ const BlocksListItem = ({ data, isLoading, enableTimeIncrement }: Props) => {
<span>{ data.size.toLocaleString() } bytes</span> <span>{ data.size.toLocaleString() } bytes</span>
</Skeleton> </Skeleton>
</Flex> </Flex>
{ !config.UI.views.block.hiddenFields?.miner && (
<Flex columnGap={ 2 } w="100%"> <Flex columnGap={ 2 } w="100%">
<Text fontWeight={ 500 }>{ capitalize(getNetworkValidatorTitle()) }</Text> <Text fontWeight={ 500 }>{ capitalize(getNetworkValidatorTitle()) }</Text>
<AddressEntity <AddressEntity
...@@ -64,6 +65,7 @@ const BlocksListItem = ({ data, isLoading, enableTimeIncrement }: Props) => { ...@@ -64,6 +65,7 @@ const BlocksListItem = ({ data, isLoading, enableTimeIncrement }: Props) => {
isLoading={ isLoading } isLoading={ isLoading }
/> />
</Flex> </Flex>
) }
<Flex columnGap={ 2 }> <Flex columnGap={ 2 }>
<Text fontWeight={ 500 }>Txn</Text> <Text fontWeight={ 500 }>Txn</Text>
{ data.tx_count > 0 ? ( { data.tx_count > 0 ? (
......
...@@ -42,7 +42,8 @@ const BlocksTable = ({ data, isLoading, top, page, showSocketInfo, socketInfoNum ...@@ -42,7 +42,8 @@ const BlocksTable = ({ data, isLoading, top, page, showSocketInfo, socketInfoNum
<Tr> <Tr>
<Th width="125px">Block</Th> <Th width="125px">Block</Th>
<Th width="120px">Size, bytes</Th> <Th width="120px">Size, bytes</Th>
<Th width={ `${ VALIDATOR_COL_WEIGHT / widthBase * 100 }%` } minW="160px">{ capitalize(getNetworkValidatorTitle()) }</Th> { !config.UI.views.block.hiddenFields?.miner &&
<Th width={ `${ VALIDATOR_COL_WEIGHT / widthBase * 100 }%` } minW="160px">{ capitalize(getNetworkValidatorTitle()) }</Th> }
<Th width="64px" isNumeric>Txn</Th> <Th width="64px" isNumeric>Txn</Th>
<Th width={ `${ GAS_COL_WEIGHT / widthBase * 100 }%` }>Gas used</Th> <Th width={ `${ GAS_COL_WEIGHT / widthBase * 100 }%` }>Gas used</Th>
{ !isRollup && !config.UI.views.block.hiddenFields?.total_reward && { !isRollup && !config.UI.views.block.hiddenFields?.total_reward &&
......
...@@ -66,12 +66,14 @@ const BlocksTableItem = ({ data, isLoading, enableTimeIncrement }: Props) => { ...@@ -66,12 +66,14 @@ const BlocksTableItem = ({ data, isLoading, enableTimeIncrement }: Props) => {
{ data.size.toLocaleString() } { data.size.toLocaleString() }
</Skeleton> </Skeleton>
</Td> </Td>
{ !config.UI.views.block.hiddenFields?.miner && (
<Td fontSize="sm"> <Td fontSize="sm">
<AddressEntity <AddressEntity
address={ data.miner } address={ data.miner }
isLoading={ isLoading } isLoading={ isLoading }
/> />
</Td> </Td>
) }
<Td isNumeric fontSize="sm"> <Td isNumeric fontSize="sm">
{ data.tx_count > 0 ? ( { data.tx_count > 0 ? (
<Skeleton isLoaded={ !isLoading } display="inline-block"> <Skeleton isLoaded={ !isLoading } display="inline-block">
......
...@@ -66,7 +66,7 @@ const LatestBlocksItem = ({ block, isLoading }: Props) => { ...@@ -66,7 +66,7 @@ const LatestBlocksItem = ({ block, isLoading }: Props) => {
</> </>
) } ) }
{ !config.features.optimisticRollup.isEnabled && ( { !config.features.optimisticRollup.isEnabled && !config.UI.views.block.hiddenFields?.miner && (
<> <>
<Skeleton isLoaded={ !isLoading } textTransform="capitalize">{ getNetworkValidatorTitle() }</Skeleton> <Skeleton isLoaded={ !isLoading } textTransform="capitalize">{ getNetworkValidatorTitle() }</Skeleton>
<AddressEntity <AddressEntity
......
...@@ -116,6 +116,7 @@ const BlockPageContent = () => { ...@@ -116,6 +116,7 @@ const BlockPageContent = () => {
const title = blockQuery.data?.type === 'reorg' ? `Reorged block #${ blockQuery.data?.height }` : `Block #${ blockQuery.data?.height }`; const title = blockQuery.data?.type === 'reorg' ? `Reorged block #${ blockQuery.data?.height }` : `Block #${ blockQuery.data?.height }`;
const titleSecondRow = ( const titleSecondRow = (
<> <>
{ !config.UI.views.block.hiddenFields?.miner && (
<Skeleton <Skeleton
isLoaded={ !blockQuery.isPlaceholderData } isLoaded={ !blockQuery.isPlaceholderData }
fontFamily="heading" fontFamily="heading"
...@@ -129,7 +130,8 @@ const BlockPageContent = () => { ...@@ -129,7 +130,8 @@ const BlockPageContent = () => {
</chakra.span> </chakra.span>
<AddressEntity address={ blockQuery.data?.miner }/> <AddressEntity address={ blockQuery.data?.miner }/>
</Skeleton> </Skeleton>
<NetworkExplorers type="block" pathParam={ heightOrHash } ml={{ base: 3, lg: 'auto' }}/> ) }
<NetworkExplorers type="block" pathParam={ heightOrHash } ml={{ base: config.UI.views.block.hiddenFields?.miner ? 0 : 3, lg: 'auto' }}/>
</> </>
); );
......
import { Box, Heading, Flex, LightMode } from '@chakra-ui/react'; import { Box, Heading, Flex } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import config from 'configs/app'; import config from 'configs/app';
...@@ -30,15 +30,13 @@ const Home = () => { ...@@ -30,15 +30,13 @@ const Home = () => {
fontWeight={ 600 } fontWeight={ 600 }
color={ config.UI.homepage.plate.textColor } color={ config.UI.homepage.plate.textColor }
> >
Welcome to { config.chain.name } explorer { config.chain.name } explorer
</Heading> </Heading>
<Box display={{ base: 'none', lg: 'block' }}> <Box display={{ base: 'none', lg: 'block' }}>
{ config.features.account.isEnabled && <ProfileMenuDesktop/> } { config.features.account.isEnabled && <ProfileMenuDesktop/> }
</Box> </Box>
</Flex> </Flex>
<LightMode>
<SearchBar isHomepage/> <SearchBar isHomepage/>
</LightMode>
</Box> </Box>
<Stats/> <Stats/>
<ChainIndicators/> <ChainIndicators/>
......
...@@ -68,7 +68,7 @@ const SearchBarInput = ({ onChange, onSubmit, isHomepage, onFocus, onBlur, onHid ...@@ -68,7 +68,7 @@ const SearchBarInput = ({ onChange, onSubmit, isHomepage, onFocus, onBlur, onHid
onBlur={ onBlur } onBlur={ onBlur }
onFocus={ onFocus } onFocus={ onFocus }
w="100%" w="100%"
backgroundColor={ isHomepage ? 'white' : bgColor } backgroundColor={ bgColor }
borderRadius={{ base: isHomepage ? 'base' : 'none', lg: 'base' }} borderRadius={{ base: isHomepage ? 'base' : 'none', lg: 'base' }}
position={{ base: isHomepage ? 'static' : 'fixed', lg: 'static' }} position={{ base: isHomepage ? 'static' : 'fixed', lg: 'static' }}
top={{ base: isHomepage ? 0 : 55, lg: 0 }} top={{ base: isHomepage ? 0 : 55, lg: 0 }}
......
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