Skip to content

Commit

Permalink
feat: show deposits and reclaims when present in transaction
Browse files Browse the repository at this point in the history
Shows Deposit or Deposit Reclaim in the TransactionInfo when present in
transaction

Closes #353
  • Loading branch information
rhyslbw committed Sep 18, 2020
1 parent 622701d commit c609280
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions source/features/i18n/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
"transaction": {
"block": "Block",
"confirmations": "Konfirmationen",
"deposit": "Anzahlung",
"depositReclaim": "Einzahlungsrückforderung",
"epoch": "Epoche",
"fee": "Transaktionsgebühr",
"from": "Input-Adressen",
Expand Down
2 changes: 2 additions & 0 deletions source/features/i18n/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@
"transaction": {
"block": "Block",
"confirmations": "Confirmations",
"deposit": "Deposit",
"depositReclaim": "Deposit Reclaim",
"epoch": "Epoch",
"fee": "Transaction Fee",
"from": "From addresses",
Expand Down
2 changes: 2 additions & 0 deletions source/features/i18n/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
"transaction": {
"block": "ブロック",
"confirmations": "確認",
"deposit": "預り金",
"depositReclaim": "預金の回収",
"epoch": "エポック",
"fee": "トランザクション手数料",
"from": "送信元",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ fragment TransactionDetails on Transaction {
number,
slotNo,
}
deposit,
fee,
hash,
includedAt,
Expand Down
1 change: 1 addition & 0 deletions source/features/transactions/api/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const transactionDetailsTransformer = (
id: tx.block?.hash,
number: tx.block?.number,
},
deposit: Currency.Util.lovelacesToAda(tx.deposit),
fee: Currency.Util.lovelacesToAda(tx.fee),
id: tx.hash,
includedAt: new Date(tx.includedAt),
Expand Down
12 changes: 11 additions & 1 deletion source/features/transactions/components/TransactionInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const TransactionInfo = (props: ITransactionInfoProps) => {
});
};
const epoch = props.block.epoch === '-' ? 0 : props.block.epoch;

const depositLabel = parseInt(props.deposit) >= 0 ? 'transaction.deposit' : 'transaction.depositReclaim'
return (
<div className={styles.root}>
{props.title && (
Expand Down Expand Up @@ -227,6 +227,16 @@ const TransactionInfo = (props: ITransactionInfoProps) => {
</div>
</div>

{/* ===== DEPOSIT ===== */}
{props.deposit !== '0' && (
<div className={styles.row}>
<div className={styles.label}>
{translate(depositLabel)}
</div>
<div className={styles.value}>{props.deposit} ADA</div>
</div>
)}

{/* ===== TOTAL OUTPUT ===== */}

<div className={styles.row}>
Expand Down
1 change: 1 addition & 0 deletions source/features/transactions/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface ITransactionDetails {
number?: number | null;
slot?: number | null;
};
deposit: string;
fee: string;
id: string;
includedAt: Date;
Expand Down

0 comments on commit c609280

Please sign in to comment.