Commit 9c9634fc authored by tom's avatar tom

update mobile view

parent 63ab38a1
import { Grid, Text, chakra } from '@chakra-ui/react'; import { Grid, chakra, GridItem } from '@chakra-ui/react';
import { motion } from 'framer-motion'; import { motion } from 'framer-motion';
import React from 'react'; import React from 'react';
...@@ -22,10 +22,11 @@ const ListItemMobileGrid = ({ isAnimated, items, className }: Props) => { ...@@ -22,10 +22,11 @@ const ListItemMobileGrid = ({ isAnimated, items, className }: Props) => {
animate={{ opacity: 1, scale: 1 }} animate={{ opacity: 1, scale: 1 }}
transitionDuration="normal" transitionDuration="normal"
transitionTimingFunction="linear" transitionTimingFunction="linear"
rowGap={ 4 } rowGap={ 2 }
columnGap={ 2 } columnGap={ 2 }
gridTemplateColumns="max-content auto" gridTemplateColumns="86px auto"
paddingY={ 6 } gridTemplateRows="minmax(30px, max-content)"
paddingY={ 4 }
borderColor="divider" borderColor="divider"
borderTopWidth="1px" borderTopWidth="1px"
_last={{ _last={{
...@@ -36,8 +37,10 @@ const ListItemMobileGrid = ({ isAnimated, items, className }: Props) => { ...@@ -36,8 +37,10 @@ const ListItemMobileGrid = ({ isAnimated, items, className }: Props) => {
> >
{ items.map(item => Boolean(item.value) && ( { items.map(item => Boolean(item.value) && (
<> <>
<Text >{ item.name }</Text> <GridItem fontWeight={ 500 } lineHeight="30px">{ item.name }</GridItem>
{ typeof item.value === 'string' ? <Text variant="secondary">{ item.value }</Text> : item.value } <GridItem alignSelf="center">
{ typeof item.value === 'string' ? <chakra.span color="text_secondary">{ item.value }</chakra.span> : item.value }
</GridItem>
</> </>
)) } )) }
</Grid> </Grid>
......
import { Grid, GridItem } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { TxStateChange } from 'types/api/txStateChanges'; import type { TxStateChange } from 'types/api/txStateChanges';
...@@ -6,7 +5,7 @@ import type { TxStateChange } from 'types/api/txStateChanges'; ...@@ -6,7 +5,7 @@ import type { TxStateChange } from 'types/api/txStateChanges';
import Address from 'ui/shared/address/Address'; import Address from 'ui/shared/address/Address';
import AddressIcon from 'ui/shared/address/AddressIcon'; import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink'; import AddressLink from 'ui/shared/address/AddressLink';
import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile'; import ListItemMobileGrid from 'ui/shared/ListItemMobile/ListItemMobileGrid';
import { getStateElements } from './utils'; import { getStateElements } from './utils';
...@@ -18,37 +17,21 @@ const TxStateListItem = ({ data }: Props) => { ...@@ -18,37 +17,21 @@ const TxStateListItem = ({ data }: Props) => {
const { before, after, change, hint, tokenId } = getStateElements(data); const { before, after, change, hint, tokenId } = getStateElements(data);
return ( const items = [
<ListItemMobile> { name: 'Address', value: (
<Address flexGrow={ 1 } w="100%"> <Address flexGrow={ 1 } w="100%">
<AddressIcon address={ data.address }/> <AddressIcon address={ data.address }/>
<AddressLink type="address" hash={ data.address.hash } ml={ 2 } truncation="constant" mr="auto"/> <AddressLink type="address" hash={ data.address.hash } ml={ 2 } truncation="constant" mr="auto"/>
{ hint } { hint }
</Address> </Address>
<Grid gridTemplateColumns="90px 1fr" columnGap={ 3 } rowGap={ 2 }> ) },
{ before && ( { name: 'Before', value: before },
<> { name: 'After', value: after },
<GridItem fontWeight={ 500 }>Before</GridItem> { name: 'Change', value: change },
<GridItem>{ before }</GridItem> { name: 'Token ID', value: tokenId },
</> ];
) }
{ after && ( return <ListItemMobileGrid items={ items }/>;
<>
<GridItem fontWeight={ 500 }>After</GridItem>
<GridItem>{ after }</GridItem>
</>
) }
<GridItem fontWeight={ 500 }>Change</GridItem>
<GridItem>{ change }</GridItem>
{ tokenId && (
<>
<GridItem fontWeight={ 500 }>Token ID</GridItem>
<GridItem>{ tokenId }</GridItem>
</>
) }
</Grid>
</ListItemMobile>
);
}; };
export default TxStateListItem; export default TxStateListItem;
...@@ -22,9 +22,9 @@ const TxStateTokenIdList = ({ items, tokenAddress }: Props) => { ...@@ -22,9 +22,9 @@ const TxStateTokenIdList = ({ items, tokenAddress }: Props) => {
id={ item.total.token_id } id={ item.total.token_id }
w="auto" w="auto"
truncation="constant" truncation="constant"
my={{ base: '-3px', lg: 0 }}
/> />
)) } )) }
{ items.length > 3 && (
<Link <Link
fontWeight={ 400 } fontWeight={ 400 }
textDecoration="underline dashed" textDecoration="underline dashed"
...@@ -33,6 +33,7 @@ const TxStateTokenIdList = ({ items, tokenAddress }: Props) => { ...@@ -33,6 +33,7 @@ const TxStateTokenIdList = ({ items, tokenAddress }: Props) => {
> >
View { isCut ? 'more' : 'less' } View { isCut ? 'more' : 'less' }
</Link> </Link>
) }
</Flex> </Flex>
); );
}; };
......
...@@ -19,7 +19,7 @@ export function getStateElements(data: TxStateChange) { ...@@ -19,7 +19,7 @@ export function getStateElements(data: TxStateChange) {
const hint = (() => { const hint = (() => {
if (data.is_miner) { if (data.is_miner) {
return ( return (
<Flex align="center" columnGap={ 1 }> <Flex align="center" columnGap={ 1 } flexDir={{ base: 'row-reverse', lg: 'row' }}>
<Hint label="A block producer who successfully included the block into the blockchain"/> <Hint label="A block producer who successfully included the block into the blockchain"/>
<Box color="text_secondary" textTransform="capitalize">{ getNetworkValidatorTitle() }</Box> <Box color="text_secondary" textTransform="capitalize">{ getNetworkValidatorTitle() }</Box>
</Flex> </Flex>
...@@ -31,7 +31,7 @@ export function getStateElements(data: TxStateChange) { ...@@ -31,7 +31,7 @@ export function getStateElements(data: TxStateChange) {
if (changeDirection) { if (changeDirection) {
const text = changeDirection === 'from' ? 'Mint' : 'Burn'; const text = changeDirection === 'from' ? 'Mint' : 'Burn';
return ( return (
<Flex align="center" columnGap={ 1 }> <Flex align="center" columnGap={ 1 } flexDir={{ base: 'row-reverse', lg: 'row' }}>
<Hint label="Address used in tokens mintings and burnings"/> <Hint label="Address used in tokens mintings and burnings"/>
<Box color="text_secondary" whiteSpace="nowrap">{ text } address</Box> <Box color="text_secondary" whiteSpace="nowrap">{ text } address</Box>
</Flex> </Flex>
......
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