Skip to content

Commit

Permalink
get live data to display values 'ago'
Browse files Browse the repository at this point in the history
  • Loading branch information
apburnie committed Jun 22, 2022
1 parent e38aad9 commit 2758e04
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion explorer/client/src/__tests__/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ describe('End-to-end Tests', () => {
});
describe('Transactions for ID', () => {
const txResults =
'TxIdAgeTxTypeStatusAddressesDa4vHc9IwbvO...+xnJ7Zx5E4=925days2hoursTransfer\u2714From:senderAddressTo:receiv...dressGHTP9gcFmF5K...KFhdqfpdK8=1min3secsTransfer\u2716From:senderAddressTo:receiv...dressXHTP9gcFmF5K...KFhdqfpdK8=<1secTransfer\u2714From:senderAddressTo:receiv...dressYHTP9gcFmF5K...KFhdqfpdK8=<1secTransfer✔From:senderAddressTo:receiv...dressZHTP9gcFmF5K...KFhdqfpdK8=<1secTransfer✔From:senderAddressTo:receiv...dressZITP9gcFmF5K...KFhdqfpdK8=<1secTransfer✔From:senderAddressTo:receiv...dressZJTP9gcFmF5K...KFhdqfpdK8=<1secTransfer✔From:senderAddressTo:receiv...dressZKTP9gcFmF5K...KFhdqfpdK8=<1secTransfer✔From:senderAddressTo:receiv...dressZLTP9gcFmF5K...KFhdqfpdK8=<1secTransfer✔From:senderAddressTo:receiv...dressZMTP9gcFmF5K...KFhdqfpdK8=<1secTransfer✔From:senderAddressTo:receiv...dressZNTP9gcFmF5K...KFhdqfpdK8=<1secTransfer✔From:senderAddressTo:receiv...dressZOTP9gcFmF5K...KFhdqfpdK8=<1secTransfer✔From:senderAddressTo:receiv...dress';
'TxIdAgeTxTypeStatusAddressesDa4vHc9IwbvO...+xnJ7Zx5E4=925days2hoursagoTransfer\u2714From:senderAddressTo:receiv...dressGHTP9gcFmF5K...KFhdqfpdK8=1min3secsagoTransfer\u2716From:senderAddressTo:receiv...dressXHTP9gcFmF5K...KFhdqfpdK8=<1secagoTransfer\u2714From:senderAddressTo:receiv...dressYHTP9gcFmF5K...KFhdqfpdK8=<1secagoTransfer✔From:senderAddressTo:receiv...dressZHTP9gcFmF5K...KFhdqfpdK8=<1secagoTransfer✔From:senderAddressTo:receiv...dressZITP9gcFmF5K...KFhdqfpdK8=<1secagoTransfer✔From:senderAddressTo:receiv...dressZJTP9gcFmF5K...KFhdqfpdK8=<1secagoTransfer✔From:senderAddressTo:receiv...dressZKTP9gcFmF5K...KFhdqfpdK8=<1secagoTransfer✔From:senderAddressTo:receiv...dressZLTP9gcFmF5K...KFhdqfpdK8=<1secagoTransfer✔From:senderAddressTo:receiv...dressZMTP9gcFmF5K...KFhdqfpdK8=<1secagoTransfer✔From:senderAddressTo:receiv...dressZNTP9gcFmF5K...KFhdqfpdK8=<1secagoTransfer✔From:senderAddressTo:receiv...dressZOTP9gcFmF5K...KFhdqfpdK8=<1secagoTransfer✔From:senderAddressTo:receiv...dress';

it('are displayed deduplicated from and to address', async () => {
const address = 'ownsAllAddress';
Expand Down
13 changes: 5 additions & 8 deletions explorer/client/src/components/transactions-for-id/TxForID.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ function TxForIDView({ showData }: { showData: TxnData[] | undefined }) {
<div id="tx" className={styles.txresults}>
<div className={styles.txheader}>
<div className={styles.txid}>TxId</div>
{showData[0].timestamp_ms && (
<div className={styles.txage}>Age</div>
)}
<div className={styles.txage}>Age</div>
<div className={styles.txtype}>TxType</div>
<div className={styles.txstatus}>Status</div>
<div className={styles.txadd}>Addresses</div>
Expand All @@ -78,11 +76,9 @@ function TxForIDView({ showData }: { showData: TxnData[] | undefined }) {
alttext={truncate(x.txId, 26, '...')}
/>
</div>
{showData[0].timestamp_ms && (
<div className={styles.txage}>
{timeAgo(x.timestamp_ms)}
</div>
)}
<div className={styles.txage}>
{`${timeAgo(x.timestamp_ms)} ago`}
</div>
<div className={styles.txtype}>{x.kind}</div>
<div
className={cl(
Expand Down Expand Up @@ -157,6 +153,7 @@ function TxForIDAPI({ id, category }: { id: string; category: categoryType }) {
kind: el!.kind,
From: el!.From,
To: el!.To,
timestamp_ms: el!.timestamp_ms,
}));
setData({
data: subData,
Expand Down
1 change: 1 addition & 0 deletions explorer/client/src/utils/api/DefaultRpcClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export const getDataOnTxDigests = (
txGas: getTotalGasUsed(txEff),
kind: txKind,
From: res.data.sender,
timestamp_ms: txEff.timestamp_ms,
...(recipient
? {
To: recipient,
Expand Down

0 comments on commit 2758e04

Please sign in to comment.