-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from protofire/develop
Fix extrinsic URL and added empty data component.
- Loading branch information
Showing
12 changed files
with
156 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# Changelog | ||
|
||
## 1.0.1 | ||
Published by **[jarcodallo](https://github.com/jarcodallo)** on **2021/01/26** | ||
- [#13](https://github.com/protofire/polkadot-mempool-explorer/pull/14) Fix extrinsic URL and added empty data component. | ||
|
||
## 1.0.0 | ||
Published by **[jarcodallo](https://github.com/jarcodallo)** on **2021/01/19** | ||
- [#13](https://github.com/protofire/polkadot-mempool-explorer/pull/13) Release v1.0.0 | ||
- [#13](https://github.com/protofire/polkadot-mempool-explorer/pull/13) Release v1.0.0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "api", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"engines": { | ||
"node": ">= 14.0.0" | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "web", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"engines": { | ||
"node": ">= 14.0.0" | ||
}, | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React from 'react' | ||
|
||
import { ItemPlaceholder } from 'components/common/ItemPlaceholder' | ||
import { Transaction } from 'components/common/Transaction' | ||
import { BaseCard } from 'components/pureStyledComponents/BaseCard' | ||
import { CardText } from 'components/pureStyledComponents/CardText' | ||
import useMempoolExplorer from 'hooks/useMempoolExplorer' | ||
|
||
interface Props { | ||
searchBy: string | ||
searchValue: string | ||
transactionState: string | ||
} | ||
|
||
export const Transactions: React.FC<Props> = (props) => { | ||
const { searchBy, searchValue, transactionState } = props | ||
const { isLoadingTransactions, transactions } = useMempoolExplorer() | ||
let filterTransactions = transactions | ||
|
||
if (searchValue !== '') { | ||
filterTransactions = filterTransactions.filter((transaction) => { | ||
switch (searchBy) { | ||
case 'tx': | ||
return transaction.hash === searchValue | ||
case 'block': | ||
return transaction.block_number === searchValue | ||
case 'from': | ||
return transaction.from === searchValue | ||
case 'to': | ||
return transaction.to === searchValue | ||
default: | ||
return [ | ||
transaction.hash, | ||
transaction.block_number, | ||
transaction.from, | ||
transaction.to, | ||
].includes(searchValue) | ||
} | ||
}) | ||
} | ||
|
||
if (transactionState !== 'all') { | ||
filterTransactions = filterTransactions.filter((transaction) => { | ||
if (transactionState === 'inMempool' && transaction.isFinalized) { | ||
return false | ||
} else if (transactionState === 'inMempool' && !transaction.isFinalized) { | ||
return true | ||
} else if (transactionState === 'justRemoved' && transaction.isFinalized) { | ||
return true | ||
} else if (transactionState === 'justRemoved' && !transaction.isFinalized) { | ||
return false | ||
} else { | ||
return true | ||
} | ||
}) | ||
} | ||
|
||
if (!isLoadingTransactions && filterTransactions.length === 0) { | ||
return ( | ||
<BaseCard> | ||
<CardText>No pending extrinsics in the pool.</CardText> | ||
</BaseCard> | ||
) | ||
} | ||
|
||
return ( | ||
<> | ||
{isLoadingTransactions && filterTransactions.length < 1 | ||
? Array.from({ length: 10 }, (_, i) => i).map((index) => ( | ||
<ItemPlaceholder key={index} opacity={(1 - index * 0.15).toString()} /> | ||
)) | ||
: filterTransactions.map((item, index) => { | ||
return <Transaction data={item} key={index} /> | ||
})} | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters