Commit 23091fa0 authored by POA's avatar POA

Partially fix lint:tsc errors

parent 4c79cd83
...@@ -14,7 +14,9 @@ const StringShorten = ({ title, maxLength }: Props) => { ...@@ -14,7 +14,9 @@ const StringShorten = ({ title, maxLength }: Props) => {
</Tooltip> </Tooltip>
); );
} else { } else {
return title; return (
<span>{ title }</span>
);
} }
}; };
......
...@@ -14,23 +14,26 @@ const uniswapIconUrl = 'https://raw.githubusercontent.com/trustwallet/assets/mas ...@@ -14,23 +14,26 @@ const uniswapIconUrl = 'https://raw.githubusercontent.com/trustwallet/assets/mas
type Props = TTxAction; type Props = TTxAction;
function actionName(actionType: string) {
switch (actionType) {
case 'mint': return [ 'Add', 'Liquidity To' ];
case 'burn': return [ 'Remove', 'Liquidity From' ];
case 'collect': return [ 'Collect', 'From' ];
case 'swap': return [ 'Swap', 'On' ];
default: return [ '', '' ];
}
}
const TxDetailsAction = ({ protocol, type, data, isLast }: Props) => { const TxDetailsAction = ({ protocol, type, data, isLast }: Props) => {
if (protocol === 'uniswap_v3') { if (protocol === 'uniswap_v3') {
if ([ 'mint', 'burn', 'collect', 'swap' ].includes(type)) { if ([ 'mint', 'burn', 'collect', 'swap' ].includes(type)) {
const amount0 = BigNumber(data.amount0).toFormat(); const amount0 = BigNumber(data.amount0).toFormat();
const amount1 = BigNumber(data.amount1).toFormat(); const amount1 = BigNumber(data.amount1).toFormat();
const actionName = {
mint: [ 'Add', 'Liquidity To' ],
burn: [ 'Remove', 'Liquidity From' ],
collect: [ 'Collect', 'From' ],
swap: [ 'Swap', 'On' ],
};
return ( return (
<Flex flexWrap="wrap" columnGap={ 1 } rowGap={ 2 } className={ isLast ? 'lastItem' : '' } marginBottom={ isLast ? 5 : 0 }> <Flex flexWrap="wrap" columnGap={ 1 } rowGap={ 2 } className={ isLast ? 'lastItem' : '' } marginBottom={ isLast ? 5 : 0 }>
<Text color="gray.500" as="span"> <Text color="gray.500" as="span">
{ actionName[type][0] } { actionName(type)[0] }
</Text> </Text>
<Flex columnGap={ 1 }> <Flex columnGap={ 1 }>
...@@ -48,11 +51,11 @@ const TxDetailsAction = ({ protocol, type, data, isLast }: Props) => { ...@@ -48,11 +51,11 @@ const TxDetailsAction = ({ protocol, type, data, isLast }: Props) => {
</Flex> </Flex>
<Text color="gray.500" as="span"> <Text color="gray.500" as="span">
{ actionName[type][1] } { actionName(type)[1] }
</Text> </Text>
<Flex columnGap={ 1 }> <Flex columnGap={ 1 }>
<Image src={ uniswapIconUrl } boxSize={ 5 } fallback=" " alt=""/> <Image src={ uniswapIconUrl } boxSize={ 5 } fallback={ <Text as="span"/> } alt=""/>
<Text color="gray.500" as="span"> <Text color="gray.500" as="span">
Uniswap V3 Uniswap V3
</Text> </Text>
...@@ -66,7 +69,7 @@ const TxDetailsAction = ({ protocol, type, data, isLast }: Props) => { ...@@ -66,7 +69,7 @@ const TxDetailsAction = ({ protocol, type, data, isLast }: Props) => {
<Flex flexWrap="wrap" columnGap={ 1 } rowGap={ 2 }> <Flex flexWrap="wrap" columnGap={ 1 } rowGap={ 2 }>
<Flex columnGap={ 1 }> <Flex columnGap={ 1 }>
<Text as="span">Mint of</Text> <Text as="span">Mint of</Text>
<Image src={ uniswapIconUrl } boxSize={ 5 } fallback=" " alt=""/> <Image src={ uniswapIconUrl } boxSize={ 5 } fallback={ <Text as="span"/> } alt=""/>
<Link href={ tokenUrl } target="_blank" overflow="hidden" whiteSpace="nowrap"> <Link href={ tokenUrl } target="_blank" overflow="hidden" whiteSpace="nowrap">
<StringShorten title={ data.name } maxLength={ 12 }/> <StringShorten title={ data.name } maxLength={ 12 }/>
{ space } { space }
......
...@@ -10,16 +10,23 @@ interface Props { ...@@ -10,16 +10,23 @@ interface Props {
actions: array; actions: array;
} }
declare global {
interface JQuery {
mCustomScrollbar(options: object): void;
}
}
const TxDetailsActions = ({ actions }: Props) => { const TxDetailsActions = ({ actions }: Props) => {
function onScrollbarLoad() { function onScrollbarLoad() {
$('.mCustomScrollbar').mCustomScrollbar({ callbacks: { const customScrollBar = $('.mCustomScrollbar');
customScrollBar.mCustomScrollbar({ callbacks: {
onOverflowY: () => { onOverflowY: () => {
$('#txActionsTitle .note').css('display', 'block'); $('#txActionsTitle .note').css('display', 'block');
$('.mCustomScrollbar').removeClass('mCS_no_scrollbar_y'); customScrollBar.removeClass('mCS_no_scrollbar_y');
}, },
onOverflowYNone: () => { onOverflowYNone: () => {
$('#txActionsTitle .note').css('display', 'none'); $('#txActionsTitle .note').css('display', 'none');
$('.mCustomScrollbar').addClass('mCS_no_scrollbar_y'); customScrollBar.addClass('mCS_no_scrollbar_y');
}, },
}, },
theme: 'dark', theme: 'dark',
......
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