From 9b61c3da455ccde422e270219e5c503ca7d5b98f Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 9 Apr 2019 13:29:40 -0400 Subject: [PATCH] add header and basic admin page --- app/js/App.js | 9 ++++++++- app/js/components/Admin.js | 14 ++++++++++++++ app/js/components/Header.js | 16 ++++++++++++++++ app/js/components/Home.js | 28 ++++++++++++++-------------- app/js/index.js | 2 ++ 5 files changed, 54 insertions(+), 15 deletions(-) create mode 100644 app/js/components/Admin.js create mode 100644 app/js/components/Header.js diff --git a/app/js/App.js b/app/js/App.js index 6831e89..d1b4da8 100644 --- a/app/js/App.js +++ b/app/js/App.js @@ -1,10 +1,13 @@ /*global web3*/ -import React from 'react'; +import React, {Fragment} from 'react'; import {HashRouter, Route, Redirect, Switch} from "react-router-dom"; +import ThemeProvider from 'react-bootstrap/ThemeProvider'; import EmbarkJS from 'Embark/EmbarkJS'; +import Header from './components/Header'; import Home from './components/Home'; +import Admin from './components/Admin'; const MAINNET = 1; const TESTNET = 3; @@ -50,11 +53,15 @@ class App extends React.Component { } return ( + +
+ + ); } } diff --git a/app/js/components/Admin.js b/app/js/components/Admin.js new file mode 100644 index 0000000..b9e10cf --- /dev/null +++ b/app/js/components/Admin.js @@ -0,0 +1,14 @@ +/*global web3*/ +import React from 'react'; + +class Admin extends React.Component { + + render() { + + return (
+

Admin Panel

+
); + } +} + +export default Admin; diff --git a/app/js/components/Header.js b/app/js/components/Header.js new file mode 100644 index 0000000..ebf61f5 --- /dev/null +++ b/app/js/components/Header.js @@ -0,0 +1,16 @@ +import React from 'react' +import {Navbar, Nav} from 'react-bootstrap'; + +const Header = () => ( + Meritocracy + + + + + +); + +export default Header diff --git a/app/js/components/Home.js b/app/js/components/Home.js index b74a168..7a911e6 100644 --- a/app/js/components/Home.js +++ b/app/js/components/Home.js @@ -1,13 +1,11 @@ /*global web3*/ import React from 'react'; -import {Button, Grid, Row, Col, Alert } from 'react-bootstrap'; -import * as NumericInput from 'react-numeric-input'; +import {Row, Col, Alert, Button, Container, Form} from 'react-bootstrap'; +import NumericInput from 'react-numeric-input'; import Select from 'react-select'; import Meritocracy from 'Embark/contracts/Meritocracy'; -// import './css/dapp.css'; - /* TODO: - list praise for contributor @@ -189,8 +187,6 @@ class Home extends React.Component { const maxAllocation = selectedContributors.length ? currentContributor.allocation / selectedContributors.length : 0; return (
-

Status Meritocracy

- {errorMsg && {errorMsg}} {currentContributor.name &&

Hello, {currentContributor.name} !

} @@ -206,27 +202,31 @@ class Home extends React.Component { placeholder="Choose Contributor(s)..." isDisabled={busy} /> - Your Allocatable Kudos: { currentContributor.allocation } SNT
+

Your Allocatable Kudos: { currentContributor.allocation } SNT

+ {selectedContributors.length === 0 && + Please select one or more contributors + } -
-
+ -
+
+ + Total Awarding: {award * selectedContributors.length} SNT
-

Your Kudos History

- Your Received Kudos: { currentContributor.received } SNT
- + Your Received Kudos: { currentContributor.received } SNT
+ {currentContributor.praises && currentContributor.praises.map((item, i) => { const name = options.find(x => x.value === item.author); return {(name && name.label) || item.author} has sent you {web3.utils.fromWei(item.amount, "ether")} SNT {item.praise && "\"" + item.praise + "\""}; })} -
+
); } diff --git a/app/js/index.js b/app/js/index.js index 4e4b9ab..7bd1a2f 100644 --- a/app/js/index.js +++ b/app/js/index.js @@ -3,6 +3,8 @@ import ReactDOM from 'react-dom'; import App from './App'; +import '../../node_modules/bootstrap/dist/css/bootstrap.min.css'; + ReactDOM.render( , document.getElementById('app')