Commit b4c80404 authored by POA's avatar POA

Improve 'Scroll to see more' text note for tx actions

parent 0235f01e
...@@ -17,3 +17,15 @@ ...@@ -17,3 +17,15 @@
.mCustomScrollbar.mCS_no_scrollbar .lastItem { .mCustomScrollbar.mCS_no_scrollbar .lastItem {
margin-bottom: 0!important; margin-bottom: 0!important;
} }
.mCSB_scrollTools .mCSB_draggerRail {
display: none;
}
.mCSB_scrollTools .mCSB_draggerContainer {
bottom: 1.3rem;
}
.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar {
background-color: #cbd5e0!important;
}
...@@ -10,11 +10,11 @@ interface Props extends Omit<HTMLChakraProps<'div'>, 'title'> { ...@@ -10,11 +10,11 @@ interface Props extends Omit<HTMLChakraProps<'div'>, 'title'> {
children: React.ReactNode; children: React.ReactNode;
} }
const DetailsInfoItem = ({ title, hint, children, ...styles }: Props) => { const DetailsInfoItem = ({ title, hint, note, noteDisplay, children, ...styles }: Props) => {
return ( return (
<> <>
<GridItem py={{ base: 1, lg: 2 }} lineHeight={ 5 } { ...styles } whiteSpace="nowrap" _notFirst={{ mt: { base: 3, lg: 0 } }}> <GridItem py={{ base: 1, lg: 2 }} lineHeight={ 5 } { ...styles } whiteSpace="nowrap" _notFirst={{ mt: { base: 3, lg: 0 } }}>
<Flex columnGap={ 2 } alignItems="center"> <Flex columnGap={ 2 } alignItems="flex-start">
<Tooltip <Tooltip
label={ hint } label={ hint }
placement="top" placement="top"
...@@ -24,7 +24,10 @@ const DetailsInfoItem = ({ title, hint, children, ...styles }: Props) => { ...@@ -24,7 +24,10 @@ const DetailsInfoItem = ({ title, hint, children, ...styles }: Props) => {
<Icon as={ infoIcon } boxSize={ 5 }/> <Icon as={ infoIcon } boxSize={ 5 }/>
</Box> </Box>
</Tooltip> </Tooltip>
<Text fontWeight={{ base: 700, lg: 500 }}>{ title }</Text> <Text fontWeight={{ base: 700, lg: 500 }}>
{ title }
{ note && <Text fontWeight={ 500 } color="gray.500" fontSize="xs" className="note" display={ noteDisplay } align="right">{ note }</Text> }
</Text>
</Flex> </Flex>
</GridItem> </GridItem>
<GridItem <GridItem
......
import { Grid, GridItem, Text, Box, Icon, Link, Spinner, Tag, Flex, Tooltip, chakra } from '@chakra-ui/react'; import { Grid, GridItem, Text, Box, Icon, Link, Spinner, Tag, Flex, Tooltip, Divider, chakra } from '@chakra-ui/react';
import BigNumber from 'bignumber.js'; import BigNumber from 'bignumber.js';
import React from 'react'; import React from 'react';
import { scroller, Element } from 'react-scroll'; import { scroller, Element } from 'react-scroll';
...@@ -126,9 +126,10 @@ const TxDetails = () => { ...@@ -126,9 +126,10 @@ const TxDetails = () => {
<Text variant="secondary">{ getConfirmationDuration(data.confirmation_duration) }</Text> <Text variant="secondary">{ getConfirmationDuration(data.confirmation_duration) }</Text>
</DetailsInfoItem> </DetailsInfoItem>
) } ) }
{ data.actions && <GridItem colSpan={{ base: undefined, lg: 2 }} mt={{ base: 3, lg: 8 }}/> } { data.actions && <GridItem colSpan={{ base: undefined, lg: 2 }} mt={{ base: 3, lg: 3 }}><Divider /></GridItem> }
{ data.actions && <TxDetailsActions actions={ data.actions }/> } { data.actions && <TxDetailsActions actions={ data.actions }/> }
<GridItem colSpan={{ base: undefined, lg: 2 }} mt={{ base: 3, lg: 8 }}/> { data.actions && <GridItem colSpan={{ base: undefined, lg: 2 }} mb={{ base: 0, lg: 3 }}><Divider /></GridItem> }
{ !data.actions && <GridItem colSpan={{ base: undefined, lg: 2 }} mt={{ base: 3, lg: 8 }}/> }
<DetailsInfoItem <DetailsInfoItem
title="From" title="From"
hint="Address (external or contract) sending the transaction." hint="Address (external or contract) sending the transaction."
......
import { Box, Flex, Text } from '@chakra-ui/react'; import { Box, Flex, Text } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import { space } from 'lib/html-entities'; import Script from 'next/script'
import DetailsInfoItem from 'ui/shared/DetailsInfoItem'; import DetailsInfoItem from 'ui/shared/DetailsInfoItem';
...@@ -11,26 +11,36 @@ const TxDetailsActions = ({ actions }) => { ...@@ -11,26 +11,36 @@ const TxDetailsActions = ({ actions }) => {
<DetailsInfoItem <DetailsInfoItem
title="Transaction Action" title="Transaction Action"
hint="Highlighted events of the transaction" hint="Highlighted events of the transaction"
note="Scroll to see more"
noteDisplay="none"
position="relative" position="relative"
id="txActionsTitle"
> >
<Box w="100%"> <Box className="mCustomScrollbar" maxH={ 36 } w="90%">
<Box className="mCustomScrollbar" data-mcs-theme="minimal-dark" maxH={ 36 }> <Flex
<Flex flexDirection="column"
flexDirection="column" alignItems="flex-start"
alignItems="flex-start" rowGap={ 5 }
rowGap={ 5 } w="100%"
w="100%" fontWeight={ 500 }
fontWeight={ 500 } >
> { actions.map((action, index) => <TxDetailsAction key={ index } { ...action } isLast={ index === actions.length-1 }/>) }
{ actions.map((action, index) => <TxDetailsAction key={ index } { ...action } isLast={ index === actions.length-1 }/>) } </Flex>
</Flex>
</Box>
<Text fontWeight={ 500 } color="gray.500" fontSize="sm" id="txActionsScrollForMore" display="none" marginTop={ 5 }>
Scroll for more
{ space }
<Text color="gray.500" transform="rotate(90deg)" display="inline-block" as="span">&raquo;</Text>
</Text>
</Box> </Box>
<Script src="/static/js/jquery.mCustomScrollbar.concat.min.js" strategy="afterInteractive" onLoad={() => {
$(".mCustomScrollbar").mCustomScrollbar({callbacks:{
onOverflowY: () => {
$("#txActionsTitle .note").css("display", "block");
},
onOverflowYNone: () => {
$("#txActionsTitle .note").css("display", "none");
}
},
theme: "dark",
autoHideScrollbar: true,
scrollButtons: {enable: false},
scrollbarPosition: "outside"});
}} />
</DetailsInfoItem> </DetailsInfoItem>
); );
}; };
......
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