Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scroll and responsive #27

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 34 additions & 40 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,40 @@ import Info from './Pages/Info';
class WitnetExplorer extends React.Component{
render(){
return(
<div>
<div className="row">
<div className="col-md-12">
<BrowserRouter>
<Navbar className="navbar-color" variant="dark" expand="lg" sticky="top">
<Navbar.Brand href="/">
<img src="/explorer_logo.png" width="30" alt="" style={{"marginLeft": "0.5rem", "marginRight": "0.5rem"}}/>
<span>Witnet Explorer</span>
</Navbar.Brand>
<Navbar.Toggle aria-controls="basic-navbar-nav" />
<Navbar.Collapse id="basic-navbar-nav">
<Nav className="mr-auto">
<Nav.Link href="/search">Search</Nav.Link>
<Nav.Link href="/blockchain">Blockchain</Nav.Link>
<Nav.Link href="/mempool">Mempool</Nav.Link>
<Nav.Link href="/network">Network</Nav.Link>
<Nav.Link href="/reputation">Reputation</Nav.Link>
<Nav.Link href="/balances">Balances</Nav.Link>
<Nav.Link href="/tapi">TAPI</Nav.Link>
<Nav.Link href="/info">Info</Nav.Link>
</Nav>
</Navbar.Collapse>
</Navbar>
<br />
<Switch>
<Route exact path="/" component={Home}/>
<Route exact path="/search" component={Search}/>
<Route exact path="/search/:hash" component={Search}/>
<Route path="/blockchain" component={Blockchain}/>
<Route path="/mempool" component={Mempool}/>
<Route path="/network" component={Network}/>
<Route path="/reputation" component={Reputation}/>
<Route path="/balances" component={Balances}/>
<Route path="/tapi" component={TAPI}/>
<Route path="/info" component={Info}/>
</Switch>
</BrowserRouter>
</div>
</div>
</div>
<BrowserRouter>
<Navbar className="navbar-color" variant="dark" expand="lg" sticky="top">
<Navbar.Brand href="/">
<img src="/explorer_logo.png" width="30" alt="" style={{"marginLeft": "0.5rem", "marginRight": "0.5rem"}}/>
<span>Witnet Explorer</span>
</Navbar.Brand>
<Navbar.Toggle aria-controls="basic-navbar-nav" />
<Navbar.Collapse id="basic-navbar-nav">
<Nav className="mr-auto">
<Nav.Link href="/search">Search</Nav.Link>
<Nav.Link href="/blockchain">Blockchain</Nav.Link>
<Nav.Link href="/mempool">Mempool</Nav.Link>
<Nav.Link href="/network">Network</Nav.Link>
<Nav.Link href="/reputation">Reputation</Nav.Link>
<Nav.Link href="/balances">Balances</Nav.Link>
<Nav.Link href="/tapi">TAPI</Nav.Link>
<Nav.Link href="/info">Info</Nav.Link>
</Nav>
</Navbar.Collapse>
</Navbar>
<br />
<Switch>
<Route exact path="/" component={Home}/>
<Route exact path="/search" component={Search}/>
<Route exact path="/search/:hash" component={Search}/>
<Route path="/blockchain" component={Blockchain}/>
<Route path="/mempool" component={Mempool}/>
<Route path="/network" component={Network}/>
<Route path="/reputation" component={Reputation}/>
<Route path="/balances" component={Balances}/>
<Route path="/tapi" component={TAPI}/>
<Route path="/info" component={Info}/>
</Switch>
</BrowserRouter>
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Paginator.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Paginator extends Component {
}

return (
<Pagination size="sm" style={{float: "right", marginBottom: "0rem"}}>
<Pagination size="sm" style={{ marginBottom: "0rem"}}>
<Pagination.Item id={"first"} onClick={() => this.setPage(1)} disabled={paginator.current_page === 1}>
{"<<"}
</Pagination.Item>
Expand Down
124 changes: 60 additions & 64 deletions src/Pages/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default class Home extends Component{
];

return (
<Table responsive>
<Table responsive className="home-table">
<tbody>
{
table_rows.map(function(table_row) {
Expand All @@ -87,11 +87,12 @@ export default class Home extends Component{
var value = table_row[2];

return (
<tr style={{"line-height": "20px"}}>
<td class="cell-fit" style={{"border": "none"}}>
<FontAwesomeIcon icon={icon} size="sm" style={{"marginRight": "0.25rem"}} fixedWidth/>{label}
<tr key={label}>
<td className="custom-td">
<FontAwesomeIcon icon={icon} size="sm" />
</td>
<td class="cell-fit-no-padding" style={{"border": "none", "textAlign": "right"}}>
<td className="custom-td">{label}</td>
<td className="custom-td">
{Formatter.formatValue(value)}
</td>
</tr>
Expand All @@ -113,7 +114,7 @@ export default class Home extends Component{
];

return (
<Table responsive style={{"marginBottom": "0rem"}}>
<Table responsive className="home-table">
<tbody>
{
table_rows.map(function(table_row) {
Expand All @@ -122,11 +123,14 @@ export default class Home extends Component{
var value = table_row[2];

return (
<tr style={{"line-height": "20px"}}>
<td class="cell-fit" style={{"border": "none"}}>
<FontAwesomeIcon icon={icon} size="sm" style={{"marginRight": "0.25rem"}} fixedWidth/>{label}
<tr key={label}>
<td className="custom-td">
<FontAwesomeIcon icon={icon} size="sm"/>
</td>
<td class="cell-fit-no-padding" style={{"border": "none", "textAlign": "right"}}>
<td className="custom-td">
{label}
</td>
<td className="custom-td">
{Formatter.formatValueSuffix(value, 2)}
</td>
</tr>
Expand All @@ -140,27 +144,27 @@ export default class Home extends Component{

generateLatestBlocks(blocks) {
return (
<Table responsive style={{"marginBottom": "0px"}}>
<Table responsive className="home-table">
<tbody>
{
blocks.slice(0, this.state.rows_per_card).map(function(block) {
var block_link = "/search/" + block.hash;

return (
<tr style={{"line-height": "20px"}}>
<td class="cell-fit cell-truncate" style={{"border": "none", "width": "100%"}}>
<FontAwesomeIcon icon={["fas", "cubes"]} size="sm" style={{"marginRight": "0.25rem"}}/>
<tr key={block.hash}>
<td className="custom-td col-md-10 cell-truncate" style={{"min-width": "100px"}}>
<FontAwesomeIcon icon={["fas", "cubes"]} size="sm" style={{"marginRight": "0.5rem"}} />
<Link to={block_link}>{block.hash}</Link>
</td>
<td class="cell-fit" style={{"border": "none"}}>
<FontAwesomeIcon icon={["fas", "align-justify"]} size="sm" style={{"marginRight": "0.25rem"}}/>
<td className="custom-td">
<FontAwesomeIcon icon={["fas", "align-justify"]} size="sm" style={{"marginRight": "0.5rem"}}/>
{block.data_request}
</td>
<td class="cell-fit" style={{"border": "none"}}>
<FontAwesomeIcon icon={["fas", "coins"]} size="sm" style={{"marginRight": "0.25rem"}}/>
<td className="custom-td">
<FontAwesomeIcon icon={["fas", "coins"]} size="sm" style={{"marginRight": "0.5rem"}}/>
{block.value_transfer}
</td>
<td class="cell-fit-no-padding" style={{"border": "none"}}>
<td className="custom-td">
{TimeConverter.convertUnixTimestamp(block.timestamp, "hour")}
</td>
</tr>
Expand All @@ -174,22 +178,22 @@ export default class Home extends Component{

generateTransactionCard(transactions, icon) {
return (
<Table responsive style={{"marginBottom": "0px"}}>
<Table responsive className="home-table">
<tbody>
{
transactions.slice(0, this.state.rows_per_card).map(function(transaction) {
var hash_link = "/search/" + transaction.hash;

return (
<tr style={{"line-height": "20px"}}>
<td class="cell-fit cell-truncate" style={{"border": "none", "width": "100%"}}>
<FontAwesomeIcon icon={icon} size="sm" style={{"marginRight": "0.25rem"}}/>
<tr style={{"lineHeight": "20px"}} key={transaction.hash}>
<td className="custom-td col-md-10 cell-truncate" style={{"min-width": "100px"}}>
<FontAwesomeIcon icon={icon} size="sm" style={{"marginRight": "0.5rem"}} />
<Link to={hash_link}>{transaction.hash}</Link>
</td>
<td class="cell-fit" style={{"border": "none"}}>
<td className="custom-td">
{TimeConverter.convertUnixTimestamp(transaction.timestamp, "hour")}
</td>
<td class="cell-fit-no-padding" style={{"border": "none"}}>
<td className="custom-td">
{
transaction.confirmed
? <FontAwesomeIcon icon={["fas", "lock"]} size="sm"/>
Expand All @@ -213,84 +217,76 @@ export default class Home extends Component{
<HistoryTypeahead/>
<Row xs={1} md={2} lg={4}>
<Col>
<Card className="shadow pt-3 pb-2 pl-4 pr-4 mb-4 bg-white rounded">
<Card.Body style={{height: "50vh", padding: "0.75rem"}}>
<Card.Title style={{"marginBottom": "0.5rem"}}>
<h5 style={{"marginBottom": "0.5rem"}}>
Network stats
</h5>
</Card.Title>
<Card.Text style={{"marginBottom": "0px"}}>
<Card className="home-card shadow bg-white mb-4 rounded">
<Card.Body>
<div class="card-body">
<Card.Title>
<h5 style={{"marginBottom": "0.5rem"}}>
Network stats
</h5>
</Card.Title>
{this.network_stats_card}
</Card.Text>
<Card.Title style={{"marginBottom": "0.5rem"}}>
<h5 style={{"marginBottom": "0.5rem"}}>
Supply info
</h5>
</Card.Title>
<Card.Text style={{"marginBottom": "0px"}}>
<Card.Title className="card-section-spacer">
<h5 style={{"marginBottom": "0.5rem"}}>
Supply info
</h5>
</Card.Title>
{this.supply_stats_card}
</Card.Text>
</div>
</Card.Body>
<Card.Text>
<small className="text-muted" style={{"marginLeft": "0.75rem"}}>
<Card.Text className="card-bottom-info">
<small>
Last updated: {update_timestamp}
</small>
</Card.Text>
</Card>
</Col>
<Col>
<Card className="shadow pt-3 pb-2 pl-4 pr-4 mb-4 bg-white rounded">
<Card.Body style={{height: "50vh", padding: "0.75rem"}}>
<Card className="home-card shadow bg-white mb-4 rounded">
<Card.Body>
<Card.Title style={{"marginBottom": "0.5rem"}}>
<h5 style={{"marginBottom": "0.5rem"}}>
Blocks
</h5>
</Card.Title>
<Card.Text>
{this.latest_blocks_card}
</Card.Text>
{this.latest_blocks_card}
</Card.Body>
<Card.Text>
<small className="text-muted" style={{"marginLeft": "0.75rem"}}>
<Card.Text className="card-bottom-info">
<small>
Last updated: {update_timestamp}
</small>
</Card.Text>
</Card>
</Col>
<Col>
<Card className="shadow pt-3 pb-2 pl-4 pr-4 mb-4 bg-white rounded">
<Card.Body style={{height: "50vh", padding: "0.75rem"}}>
<Card className="home-card shadow bg-white mb-4 rounded">
<Card.Body>
<Card.Title style={{"marginBottom": "0.5rem"}}>
<h5 style={{"marginBottom": "0.5rem"}}>
Data requests
</h5>
</Card.Title>
<Card.Text>
{this.latest_data_requests_card}
</Card.Text>
{this.latest_data_requests_card}
</Card.Body>
<Card.Text>
<small className="text-muted" style={{"marginLeft": "0.75rem"}}>
<Card.Text className="card-bottom-info">
<small>
Last updated: {update_timestamp}
</small>
</Card.Text>
</Card>
</Col>
<Col>
<Card className="shadow pt-3 pb-2 pl-4 pr-4 mb-4 bg-white rounded">
<Card.Body style={{height: "50vh", padding: "0.75rem"}}>
<Card className="home-card shadow bg-white mb-4 rounded">
<Card.Body>
<Card.Title style={{"marginBottom": "0.5rem"}}>
<h5 style={{"marginBottom": "0.5rem"}}>
Value transfers
</h5>
</Card.Title>
<Card.Text>
{this.latest_value_transfers_card}
</Card.Text>
{this.latest_value_transfers_card}
</Card.Body>
<Card.Text>
<small className="text-muted" style={{"marginLeft": "0.75rem"}}>
<Card.Text className="card-bottom-info">
<small>
Last updated: {update_timestamp}
</small>
</Card.Text>
Expand Down
Loading