Skip to content

Commit

Permalink
Merge pull request #52 from lAmeR1/dev
Browse files Browse the repository at this point in the history
Dev to main
  • Loading branch information
lAmeR1 authored Sep 2, 2024
2 parents 181ea91 + fca09fa commit 85c7047
Show file tree
Hide file tree
Showing 29 changed files with 1,161 additions and 1,065 deletions.
4 changes: 2 additions & 2 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"short_name": "KAS Explorer",
"name": "Kaspa Explorer",
"icons": [
{
"src": "favicon.ico",
Expand Down
403 changes: 208 additions & 195 deletions src/App.js

Large diffs are not rendered by default.

41 changes: 17 additions & 24 deletions src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ $color5: #181D30;
$superdark: $color5;

$theme-colors: (
"primary": $color2,
"info": #181d30,
"success": #4ea969,
"warning": #cb9931,
"danger": #f44336,
"dark": $color5,
"light": $color1,
"secondary": $color3
"primary": $color2,
"info": #181d30,
"success": #4ea969,
"warning": #cb9931,
"danger": #f44336,
"dark": $color5,
"light": $color1,
"secondary": $color3
);

$border-radius: 0.8rem;
Expand All @@ -34,8 +34,8 @@ $nav-link-color: $color1;
body {
margin: 0;
font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background-color: $superdark;
Expand Down Expand Up @@ -134,7 +134,6 @@ body {
}



.searchButton {
height: 100%;
background-color: $color5;
Expand All @@ -147,7 +146,7 @@ body {


.bigfont {
color: $color1 !important;
color: $color1 !important;
font-family: 'Righteous', sans-serif;
// font: bold 80px/0.9em;
font-weight: normal;
Expand Down Expand Up @@ -206,7 +205,7 @@ body {
width: 0;
height: 0;
display: none;

}
}

Expand Down Expand Up @@ -298,13 +297,13 @@ body {
text-decoration: none;
}

.navbar-brand-text>a {
.navbar-brand-text > a {
text-decoration: none;
font-style: none;

}

.colsize>div {
.colsize > div {
max-width: 1300px;
}

Expand Down Expand Up @@ -352,7 +351,6 @@ body {
}



.cardText {
font-size: 2em;
font: bold 20px/1.2em;
Expand Down Expand Up @@ -472,7 +470,7 @@ body {
font-size: x-small;
padding: 0.7rem 0.5rem;
}


.styled-table thead th {
font-size: x-small;
Expand All @@ -484,7 +482,7 @@ body {
.styled-table td {
font-size: medium;
}


.styled-table thead th {
font-size: medium;
Expand Down Expand Up @@ -517,13 +515,11 @@ body {

.blockinfo-content {
display: flex;
flex-direction: column;
;
flex-direction: column;;
justify-content: center;
}



.blockinfo-row:nth-of-type(even) {
background-color: rgba($superdark, 0.4)
}
Expand All @@ -537,7 +533,6 @@ body {
}



.cardBox {
color: #f3eef1;
margin: 2rem;
Expand Down Expand Up @@ -566,7 +561,6 @@ body {
}



.cardBoxElement {
font-family: 'Rubik';
padding-right: 1rem;
Expand All @@ -575,7 +569,6 @@ body {
}



.blockDagVis {
display: flex;
justify-content: space-around;
Expand Down
184 changes: 93 additions & 91 deletions src/Dashboard.js
Original file line number Diff line number Diff line change
@@ -1,128 +1,130 @@
import 'bootstrap/dist/css/bootstrap.min.css';
import 'font-awesome/css/font-awesome.min.css';
import { useState } from 'react';
import { Button, Col, Container, Form, InputGroup, Modal, Row, Spinner } from 'react-bootstrap';
import { useNavigate } from 'react-router';
import {useState} from 'react';
import {Button, Col, Container, Form, InputGroup, Modal, Row, Spinner} from 'react-bootstrap';
import {useNavigate} from 'react-router';
import './App.scss';
import BalanceModal from './components/BalanceModal';
import BlockDAGBox from './components/BlockDAG';
import BlockOverview from './components/BlockOverview';
import CoinsupplyBox from './components/CoinsupplyBox';
import KaspadInfoBox from './components/KaspadInfoBox';
import MarketDataBox from './components/MarketDataBox';
import TxOverview from './components/TxOverview';
import { getBlock } from './kaspa-api-client';


import {getBlock} from './kaspa-api-client';


function Dashboard() {

const [show, setShow] = useState(false);
const navigate = useNavigate()
const [show, setShow] = useState(false);
const navigate = useNavigate()

const handleClose = () => setShow(false);
const handleShow = () => setShow(true);
const handleClose = () => setShow(false);
const handleShow = () => setShow(true);

const [showLoadingModal, setShowLoadingModal] = useState(false)
const [showLoadingModal, setShowLoadingModal] = useState(false)

const [balance, setBalance] = useState(0);
const [address, setAddress] = useState("kaspa:");
const [balance, setBalance] = useState(0);
const [address, setAddress] = useState("kaspa:");

const search = (e) => {
e.preventDefault();
const v = e.target.searchInput.value
const search = (e) => {
e.preventDefault();
const v = e.target.searchInput.value

setShowLoadingModal(true);
setShowLoadingModal(true);

if (v.length == 64) {
getBlock(v).then(
data => {
if (data.detail == "Block not found") {
navigate(`/txs/${v}`)
}
else {
navigate(`/blocks/${v}`)
}
if (v.length == 64) {
getBlock(v).then(
data => {
if (data.detail == "Block not found") {
navigate(`/txs/${v}`)
} else {
navigate(`/blocks/${v}`)
}
}
).catch((err) => {
})
}
).catch((err) => {
console.log("hier")
})
}

if (v.startsWith("kaspa:")) {
navigate(`/addresses/${v}`)
}
if (v.startsWith("kaspa:")) {
navigate(`/addresses/${v}`)
}

setShowLoadingModal(false);
setShowLoadingModal(false);

}
}


//<Button variant="primary">Go!</Button>
return (
<div>
<Modal show={showLoadingModal} animation={false} centered>
<Modal.Body className="d-flex flex-row justify-content-center" style={{backgroundColor: "#181D30"}}>
<Spinner animation="border" variant="primary" size="xl" /></Modal.Body>
</Modal>
<div className="row1">
<Container className="firstRow webpage" fluid>
<Row>
<Col md={12} className='d-flex flex-row justify-content-start text-light d-xs-none align-items-center'>
<img className="big-kaspa-icon" src="/k-icon-glow.png" />
<div className="bigfont kas-badge">
KASPA<br />EXPLORER
</div>
</Col>
</Row>
<Row>
<Col xs={11}>
<Form onSubmit={search}>
<InputGroup className="ms-md-5 mt-5 me-5 dashboard-search-box">
<Form.Control className="bg-light text-dark shadow-none" name="searchInput" type="text" placeholder="Search for kaspa:address or block" />
<Button type="submit" className="shadow-none searchButton" variant="dark" ><i className='fa fa-search' /></Button>
</InputGroup>
</Form>
</Col>
</Row>
</Container>

</div>
<div className="row2">
<Container className="secondRow webpage" fluid>
<Row>
<Col sm={12} md={6} xl={3}><div className="infoBox">
<CoinsupplyBox />
</div></Col>
<Col sm={12} md={6} xl={3}><div className="infoBox"><BlockDAGBox /></div></Col>
<Col sm={12} md={6} xl={3}><div className="infoBox"><KaspadInfoBox /></div></Col>
<Col sm={12} md={6} xl={3}><div className="infoBox"><MarketDataBox /></div></Col>
</Row>
</Container>
</div>
{/* <div className="row3">
//<Button variant="primary">Go!</Button>
return (
<div>
<Modal show={showLoadingModal} animation={false} centered>
<Modal.Body className="d-flex flex-row justify-content-center" style={{backgroundColor: "#181D30"}}>
<Spinner animation="border" variant="primary" size="xl"/></Modal.Body>
</Modal>
<div className="row1">
<Container className="firstRow webpage" fluid>
<Row>
<Col md={12}
className='d-flex flex-row justify-content-start text-light d-xs-none align-items-center'>
<img className="big-kaspa-icon" src="/k-icon-glow.png"/>
<div className="bigfont kas-badge">
KASPA<br/>EXPLORER
</div>
</Col>
</Row>
<Row>
<Col xs={11}>
<Form onSubmit={search}>
<InputGroup className="ms-md-5 mt-5 me-5 dashboard-search-box">
<Form.Control className="bg-light text-dark shadow-none" name="searchInput"
type="text" placeholder="Search for kaspa:address or block"/>
<Button type="submit" className="shadow-none searchButton" variant="dark"><i
className='fa fa-search'/></Button>
</InputGroup>
</Form>
</Col>
</Row>
</Container>

</div>
<div className="row2">
<Container className="secondRow webpage" fluid>
<Row>
<Col sm={12} md={6} xl={4}>
<div className="infoBox">
<CoinsupplyBox/>
</div>
</Col>
<Col sm={12} md={6} xl={4}>
<div className="infoBox"><BlockDAGBox/></div>
</Col>
<Col sm={12} md={6} xl={4}>
<div className="infoBox"><MarketDataBox/></div>
</Col>
</Row>
</Container>
</div>
{/* <div className="row3">
<Container className="thirdRow webpage" fluid>
<Row>
<Col xs={12}><BlockDagVisualization /></Col>
</Row>
</Container>
</div> */}
<div className="row4">
<Container className="fourthRow webpage" fluid>
<Row>
<Col className="" xs={12} lg={6}><BlockOverview lines={12} small/></Col>
<Col className="mt-5 mt-lg-0" xs={12} lg={6}><TxOverview lines={12} /></Col>
</Row>
</Container>
</div>
<BalanceModal handleClose={handleClose} show={show} address={address} balance={balance} />

<div className="row4">
<Container className="fourthRow webpage" fluid>
<Row>
<Col className="" xs={12} lg={6}><BlockOverview lines={12} small/></Col>
<Col className="mt-5 mt-lg-0" xs={12} lg={6}><TxOverview lines={12}/></Col>
</Row>
</Container>
</div>
<BalanceModal handleClose={handleClose} show={show} address={address} balance={balance}/>


</div>
</div>

);
);
}

export default Dashboard;
Loading

0 comments on commit 85c7047

Please sign in to comment.