Skip to content

Commit ae3a263

Browse files
Adding Epoch Search.
Fixing TransactionItem scss. Fix fragment definition on FullBlockInfo
1 parent 55cfba2 commit ae3a263

File tree

7 files changed

+21
-20
lines changed

7 files changed

+21
-20
lines changed

examples/explorer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"private": true,
1515
"dependencies": {
1616
"@reach/router": "1.2.1",
17-
"big.js": "^5.2.2",
17+
"big.js": "5.2.2",
1818
"bootstrap": "4.3.1",
1919
"graphql": "14.5.8",
2020
"node-sass": "4.12.0",

examples/explorer/src/components/Blocks/EpochBlockTable/EpochBlockTable.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import { blocksFromBlockConnection } from '../../../helpers/blockHelper';
1111
// TODO: Think on some way of extract shared code between EpochBlockTable and BlockPagedTable
1212
const EpochBlockTable = ({ epoch, relay }) => {
1313
const [start, setStart] = useState(1);
14+
if (!epoch.blocks) {
15+
return null;
16+
}
17+
1418
const blocks = blocksFromBlockConnection(epoch.blocks);
1519
const { pageInfo } = epoch.blocks;
1620

examples/explorer/src/components/Blocks/FullBlockInfo/FullBlockInfo.jsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,7 @@ const FullBlockInfo = ({ block }) => {
2525
export default createFragmentContainer(FullBlockInfo, {
2626
block: graphql`
2727
fragment FullBlockInfo_block on Block {
28-
id
29-
date {
30-
epoch {
31-
id
32-
}
33-
slot
34-
}
35-
chainLength
36-
previousBlock {
37-
id
38-
}
28+
...BlockInfo_block
3929
transactions {
4030
...TransactionTable_transactions
4131
}

examples/explorer/src/components/Epochs/EpochInfo/EpochInfo.jsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const EpochInfo = ({ epoch }) => {
1313
if (!epoch) {
1414
return <EmptyResult {...{ entityName: 'Epoch' }} />;
1515
}
16-
const { blocks } = epoch;
16+
const { blocks, firstBlock, lastBlock } = epoch;
1717

1818
return (
1919
<div className="epochInfo">
@@ -30,15 +30,11 @@ const EpochInfo = ({ epoch }) => {
3030
</tr>
3131
<tr>
3232
<td>First Block:</td>
33-
<td>
34-
<BlockLink id={epoch.firstBlock.id} />
35-
</td>
33+
<td>{firstBlock && <BlockLink id={firstBlock.id} />}</td>
3634
</tr>
3735
<tr>
3836
<td>Last Block:</td>
39-
<td>
40-
<BlockLink id={epoch.lastBlock.id} />
41-
</td>
37+
<td>{lastBlock && <BlockLink id={lastBlock.id} />}</td>
4238
</tr>
4339
<tr>
4440
<td>Blocks count:</td>

examples/explorer/src/components/Epochs/FullEpochInfo/FullEpochInfo.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const FullEpochInfo = ({ epoch }) => {
1717
return (
1818
<div className="fullEpochInfo">
1919
<EpochInfo {...{ epoch }} />
20-
<h3>Blocks</h3>
2120
<EpochBlockTable {...{ epoch }} />
2221
</div>
2322
);

examples/explorer/src/components/Search/SearchBar/SearchBar.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ import Button from 'react-bootstrap/Button';
88
import './searchBar.scss';
99
import { isBlockNumber } from '../../../helpers/blockHelper';
1010

11+
const onEpochSearchClick = searchValue => {
12+
const baseUrl = 'epoch';
13+
14+
navigate(`/${baseUrl}/${searchValue}`);
15+
};
16+
1117
const onBlockSearchClick = searchValue => {
1218
let baseUrl = 'block';
1319

@@ -42,6 +48,9 @@ const Search = () => {
4248
placeholder="Search by block hash, chain length and transaction hash..."
4349
/>
4450
<ButtonGroup>
51+
<Button variant="primary" onClick={() => onEpochSearchClick(searchValue)}>
52+
Epoch
53+
</Button>
4554
<Button variant="primary" onClick={() => onBlockSearchClick(searchValue)}>
4655
Block
4756
</Button>

examples/explorer/src/components/Transactions/TransactionItem/transactionItem.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
flex-direction: row;
88
justify-content: space-between;
99
padding: 1%;
10+
div {
11+
padding: 1% 0%;
12+
}
1013
box-shadow: 0 0 4px 0px grey;
1114
}

0 commit comments

Comments
 (0)