Skip to content

Commit dbc15f0

Browse files
authored
fix: displaying locked amount button (#1626)
* fix: displaying locked amount btn * fix: confilict
1 parent 0fd9de8 commit dbc15f0

File tree

1 file changed

+35
-34
lines changed

1 file changed

+35
-34
lines changed

packages/extension-polkagate/src/fullscreen/governance/delegate/partial/AmountWithOptionsAndLockAmount.tsx

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -40,40 +40,41 @@ interface AlreadyLockedTooltipTextProps {
4040
const AlreadyLockedTooltipText = ({ accountLocks, currentBlock, decimal, token }: AlreadyLockedTooltipTextProps) => {
4141
const { t } = useTranslation();
4242

43-
return (<Grid container item sx={{ maxHeight: '400px', overflow: 'hidden', overflowY: 'scroll' }}>
44-
<Typography variant='body2'>
45-
<Grid container spacing={2}>
46-
<Grid item xs={2.5}>
47-
{t('Ref.')}
48-
</Grid>
49-
<Grid item xs={3.6}>
50-
{t('Amount')}
51-
</Grid>
52-
<Grid item xs={2.9}>
53-
{t('Multiplier')}
54-
</Grid>
55-
<Grid item xs={3}>
56-
{t('Expires')}
43+
return (
44+
<Grid container item sx={{ maxHeight: '400px', overflow: 'hidden', overflowY: 'scroll' }}>
45+
<Typography variant='body2'>
46+
<Grid container spacing={2}>
47+
<Grid item xs={2.5}>
48+
{t('Ref.')}
49+
</Grid>
50+
<Grid item xs={3.6}>
51+
{t('Amount')}
52+
</Grid>
53+
<Grid item xs={2.9}>
54+
{t('Multiplier')}
55+
</Grid>
56+
<Grid item xs={3}>
57+
{t('Expires')}
58+
</Grid>
59+
{accountLocks.map((l, index) =>
60+
<React.Fragment key={index}>
61+
<Grid item xs={2.5}>
62+
{isBn(l.refId) ? l.refId.toNumber() : 'N/A'}
63+
</Grid>
64+
<Grid item xs={3.6}>
65+
{amountToHuman(l.total, decimal)} {token}
66+
</Grid>
67+
<Grid item xs={2.9}>
68+
{l.locked === 'None' ? 'N/A' : l.locked.replace('Locked', '')}
69+
</Grid>
70+
<Grid item xs={3}>
71+
{getLockedUntil(l.endBlock, currentBlock)}
72+
</Grid>
73+
</React.Fragment>
74+
)}
5775
</Grid>
58-
{accountLocks.map((l, index) =>
59-
<React.Fragment key={index}>
60-
<Grid item xs={2.5}>
61-
{isBn(l.refId) ? l.refId.toNumber() : 'N/A'}
62-
</Grid>
63-
<Grid item xs={3.6}>
64-
{amountToHuman(l.total, decimal)} {token}
65-
</Grid>
66-
<Grid item xs={2.9}>
67-
{l.locked === 'None' ? 'N/A' : l.locked.replace('Locked', '')}
68-
</Grid>
69-
<Grid item xs={3}>
70-
{getLockedUntil(l.endBlock, currentBlock)}
71-
</Grid>
72-
</React.Fragment>
73-
)}
74-
</Grid>
75-
</Typography>
76-
</Grid>
76+
</Typography>
77+
</Grid>
7778
);
7879
};
7980

@@ -132,7 +133,7 @@ export default function AmountWithOptionsAndLockAmount ({ accountLocks, amount,
132133
label={t('Amount ({{token}})', { replace: { token } })}
133134
onChangeAmount={onValueChange}
134135
onPrimary={onMaxAmount}
135-
onSecondary={onLockedAmount}
136+
onSecondary={lockedAmount && !lockedAmount?.isZero() ? onLockedAmount : undefined}
136137
primaryBtnText={t('Max amount')}
137138
secondaryBtnText={t('Locked amount')}
138139
style={{

0 commit comments

Comments
 (0)