Skip to content

Commit e1ba9af

Browse files
committed
frontend: style failed transactions
ETH transactions can sometimes fail, in that case the entry in the transaction list should be styled differently to clearly distinguish it from other completed transactions. This commit changes the transaction icon to warning symbol and removes the color on the failed amount to be just gray instead of green or red.
1 parent 26fa14c commit e1ba9af

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

frontends/web/src/components/transactions/transaction.module.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@
7979
color: var(--color-success);
8080
}
8181

82+
.failed {
83+
color: var(--color-secondary);
84+
}
85+
8286
.currency {
8387
font-variant: tabular-nums;
8488
}

frontends/web/src/components/transactions/transaction.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Copyright 2018 Shift Devices AG
3-
* Copyright 2021 Shift Crypto AG
3+
* Copyright 2021-2024 Shift Crypto AG
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@ import { translate, TranslateProps } from '../../decorators/translate';
2121
import { A } from '../anchor/anchor';
2222
import { Dialog } from '../dialog/dialog';
2323
import { CopyableInput } from '../copy/Copy';
24-
import { ExpandIcon } from '../icon/icon';
24+
import { Warning, ExpandIcon } from '../icon/icon';
2525
import { ProgressRing } from '../progressRing/progressRing';
2626
import { FiatConversion } from '../rates/rates';
2727
import { Amount } from '../../components/amount/amount';
@@ -94,15 +94,17 @@ class Transaction extends Component<Props, State> {
9494
transactionDialog,
9595
transactionInfo,
9696
} = this.state;
97-
const arrow = type === 'receive' ? (
97+
const arrow = status === 'failed' ? (
98+
<Warning style={{ maxWidth: '18px' }} />
99+
) : type === 'receive' ? (
98100
<ArrowIn />
99101
) : type === 'send' ? (
100102
<ArrowOut />
101103
) : (
102104
<ArrowSelf />
103105
);
104106
const sign = ((type === 'send') && '−') || ((type === 'receive') && '+') || '';
105-
const typeClassName = (type === 'send' && style.send) || (type === 'receive' && style.receive) || '';
107+
const typeClassName = (status === 'failed' && style.failed) || (type === 'send' && style.send) || (type === 'receive' && style.receive) || '';
106108
const sDate = time ? this.parseTimeShort(time) : '---';
107109
const statusText = {
108110
complete: t('transaction.status.complete'),

0 commit comments

Comments
 (0)