feat: initial Proof of Concept UI (#1)

* initial dashboard layout

* add node status card

* add accounting section, pull peer data

* add file functionality with bee-js,  first iteration of accounts page

* Add balances and chequebook table

* add blockie / identicon for addresses

* add basic settlements table

* implement theme overrides

* cleanup logging

* Add troubleshooting block

* add initial dark theme support, add copy to clipboard, QR code support

* show active element on sidebar

* remove duplicate status page and make status page index

* Update package.json

Co-authored-by: Vojtech Simetka <vojtech@simetka.cz>

* Update public/index.html

Co-authored-by: Vojtech Simetka <vojtech@simetka.cz>

* Update src/pages/accounting/AccountCard.tsx

Co-authored-by: Vojtech Simetka <vojtech@simetka.cz>

* change bee api client to use beeJS library

* add initial setup workflow

* breakout ethereum address component, define initial setup workflow

* add types to responses, add additional node troubleshooting info to workflow

* make setup steps nonlinear and interactive

* make host endpoint dynamic on setup

* split out api calls into custom hooks, add component loading indicators

* add depost / withdrawl functionality, show transactions in BZZ

* add multiOS code support troubleshooting, check for balance in chequebook on setup

* add ability to change apis in settings page

* show file loading status

* Style active sidebar item

* reload on theme change

* modify troubleshooting verbage, add cashout functionality and details,

* facilitate file upload with beeJS

* update readme to show UI samples

* remove nnPeersWatermark from peers page

* split node steps into separate components, make status page visible at anytime

* minor UI/UX enhancements

* format accounting page

* remove WIP wallet connection code

* Update src/components/CashoutModal.tsx

Co-authored-by: Vojtech Simetka <vojtech@simetka.cz>

* use bigint for deposits/withdrawls

* revise status card

* clean up unused imports and variables

* add api status to sidebar

* obfuscate pages with troubleshooting component when apis not connected

* add localhost OS detection for troubleshooting code

* cleanup extra logos

* monospace BZZ in tables

* hide troubleshooting page while loading API status

* Remove ability to remove peers

* add null types to API responses

Co-authored-by: Vojtech Simetka <vojtech@simetka.cz>
This commit is contained in:
matmertz25
2021-03-12 12:01:56 -05:00
committed by GitHub
parent f4ce271479
commit 34d2dfda5a
60 changed files with 6155 additions and 364 deletions
+112
View File
@@ -0,0 +1,112 @@
import React from 'react'
import { Theme, createStyles, makeStyles } from '@material-ui/core/styles';
import { Card, CardContent, Typography, Grid } from '@material-ui/core/';
import { Skeleton } from '@material-ui/lab';
import WithdrawlModal from '../../components/WithdrawlModal';
import DepositModal from '../../components/DepositModal';
import CashoutModal from '../../components/CashoutModal';
import { ConvertBalanceToBZZ } from '../../utils/common';
import type { ChequebookAddressResponse } from '@ethersphere/bee-js';
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
display: 'flex',
},
details: {
display: 'flex',
},
address: {
color: 'grey',
fontWeight: 400,
},
content: {
flexGrow: 1,
},
status: {
color: '#fff',
backgroundColor: '#76a9fa',
}
}),
);
interface ChequebookBalance {
totalBalance: number,
availableBalance: number
}
interface IProps{
chequebookAddress: ChequebookAddressResponse | null,
isLoadingChequebookAddress: boolean,
chequebookBalance: ChequebookBalance | null,
isLoadingChequebookBalance: boolean,
settlements: any,
isLoadingSettlements: boolean,
}
function AccountCard(props: IProps) {
const classes = useStyles();
return (
<div>
<div style={{justifyContent: 'space-between', display: 'flex'}}>
<h2 style={{ marginTop: '0px' }}>Accounting</h2>
<div style={{display:'flex'}}>
<WithdrawlModal />
<DepositModal />
<CashoutModal />
</div>
</div>
<Card className={classes.root}>
{ !props.isLoadingChequebookBalance && !props.isLoadingSettlements && props.chequebookBalance ?
<div className={classes.details}>
<CardContent className={classes.content}>
<Grid container spacing={5}>
<Grid item>
<Typography component="h2" variant="h6" color="primary" gutterBottom>
Total Balance
</Typography>
<Typography component="p" variant="h5">
{ConvertBalanceToBZZ(props.chequebookBalance.totalBalance)}
</Typography>
</Grid>
<Grid item>
<Typography component="h2" variant="h6" color="primary" gutterBottom>
Available Balance
</Typography>
<Typography component="p" variant="h5">
{ConvertBalanceToBZZ(props.chequebookBalance.availableBalance)}
</Typography>
</Grid>
<Grid item>
<Typography component="h2" variant="h6" color="primary" gutterBottom>
Total Sent / Received
</Typography>
<Typography component="p" variant="h5" >
<span style={{marginRight:'7px'}}>{ConvertBalanceToBZZ(props.settlements.totalsent)} / {ConvertBalanceToBZZ(props.settlements.totalreceived)}</span>
<span style={{ color: props.settlements.totalsent > props.settlements.totalreceived ? '#c9201f' : '#32c48d' }}>({ConvertBalanceToBZZ(props.settlements.totalsent - props.settlements.totalreceived)})</span>
</Typography>
</Grid>
</Grid>
</CardContent>
</div>
:
<div className={classes.details}>
<Skeleton width={180} height={110} animation="wave" style={{ marginLeft: '12px', marginRight: '12px'}} />
<Skeleton width={180} height={110} animation="wave" style={{ marginLeft: '12px', marginRight: '12px'}} />
<Skeleton width={180} height={110} animation="wave" style={{ marginLeft: '12px', marginRight: '12px'}} />
<Skeleton width={180} height={110} animation="wave" />
</div>
}
</Card>
</div>
)
}
export default AccountCard;