Skip to content

Commit

Permalink
fix(frontend/ez-transactions): hide Voucher to Issue text on zero v…
Browse files Browse the repository at this point in the history
…alue (#598)
  • Loading branch information
nikitayutanov authored Feb 12, 2025
1 parent 3fd332a commit a0a931e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function CreateSessionModal({
onFinally,
pair: pairToSave,
});
} catch (err) {
} catch (_err) {
alert.error('Error when fetching gasless voucher');
onFinally();
}
Expand All @@ -160,7 +160,8 @@ function CreateSessionModal({
},
{
heading: 'Voucher to issue:',
value: `${formattedIssueVoucherValue.value} ${formattedIssueVoucherValue.unit}`,
value:
issueVoucherValue > 0 ? `${formattedIssueVoucherValue.value} ${formattedIssueVoucherValue.unit}` : '',
},
]}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function EnableSignlessSession(props: Props) {
setIsLoading(false);
};

const handleDeleteSession = async () => {
const handleDeleteSession = () => {
if (!session) throw new Error('Signless session not found');
if (!pair) throw new Error('Signless pair not found');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ type Props = {
};

function SignlessParams({ params }: Props) {
return (
<ul className={styles.summary}>
{params.map((param) => (
<li className={styles.summaryItem} key={param.heading}>
<h4 className={styles.heading}>{param.heading}</h4>
<div className={styles.separator} />
<p className={styles.value}>{param.value}</p>
</li>
))}
</ul>
);
const renderParams = () =>
params.map(
({ heading, value }) =>
value && (
<li className={styles.summaryItem} key={heading}>
<h4 className={styles.heading}>{heading}</h4>
<div className={styles.separator} />
<p className={styles.value}>{value}</p>
</li>
),
);

return <ul className={styles.summary}>{renderParams()}</ul>;
}

export { SignlessParams };
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function SignlessTransactions({
}
};

const handleRevokeVoucherFromStoragePair = async () => {
const handleRevokeVoucherFromStoragePair = () => {
if (!pair) throw new Error('Signless pair not found');

const decodedAddress = decodeAddress(pair.address);
Expand Down

0 comments on commit a0a931e

Please sign in to comment.