From 2d7990e39e7dbcbf14fb8e4b24a65a29763eec7f Mon Sep 17 00:00:00 2001 From: Roman Storm Date: Fri, 5 Jan 2018 12:36:25 -0800 Subject: [PATCH] Add card id + have live clockwatch --- jsconfig.json | 5 ++++ package-lock.json | 30 +++++++++++----------- src/App.js | 8 +++--- src/assets/App.css | 6 ++++- src/assets/stylesheets/ballots/footer.scss | 5 ++++ src/components/BallotKeysCard.jsx | 18 ++++++++++--- src/contracts/addresses.js | 20 +++++++-------- src/getWeb3.js | 2 +- src/stores/ContractsStore.js | 1 - 9 files changed, 61 insertions(+), 34 deletions(-) create mode 100644 jsconfig.json diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 0000000..904df79 --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "experimentalDecorators": true + } +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index df869e5..33e64fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4588,6 +4588,13 @@ } } }, + "string_decoder": { + "version": "1.0.1", + "bundled": true, + "requires": { + "safe-buffer": "5.0.1" + } + }, "string-width": { "version": "1.0.2", "bundled": true, @@ -4597,13 +4604,6 @@ "strip-ansi": "3.0.1" } }, - "string_decoder": { - "version": "1.0.1", - "bundled": true, - "requires": { - "safe-buffer": "5.0.1" - } - }, "stringstream": { "version": "0.0.5", "bundled": true, @@ -10293,6 +10293,14 @@ "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "requires": { + "safe-buffer": "5.1.1" + } + }, "string-length": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/string-length/-/string-length-1.0.1.tgz", @@ -10335,14 +10343,6 @@ "function-bind": "1.1.1" } }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "requires": { - "safe-buffer": "5.1.1" - } - }, "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", diff --git a/src/App.js b/src/App.js index c9c5e63..2f2dd8a 100644 --- a/src/App.js +++ b/src/App.js @@ -38,9 +38,10 @@ class App extends Component { const { commonStore } = this.props; const currentPath = this.props.location.pathname; let showNavPan = - currentPath == `${commonStore.rootPath}` - || currentPath == `${commonStore.rootPath}/` - || currentPath == `${commonStore.rootPath}/active`; + currentPath === `${commonStore.rootPath}` + || currentPath === "/" + || currentPath === `${commonStore.rootPath}/` + || currentPath === `${commonStore.rootPath}/active`; return showNavPan; } @@ -61,6 +62,7 @@ class App extends Component { {loading}
{nav} + diff --git a/src/assets/App.css b/src/assets/App.css index e0c1473..ca1c1f7 100644 --- a/src/assets/App.css +++ b/src/assets/App.css @@ -772,7 +772,11 @@ button { .ballots-footer { display: flex; - align-items: center; } + align-items: center; + justify-content: space-between; } + .ballots-footer-left { + display: inline-flex; + align-items: center; } @media screen and (max-width: 768px) { .ballots-footer { padding-top: 20px; } } diff --git a/src/assets/stylesheets/ballots/footer.scss b/src/assets/stylesheets/ballots/footer.scss index 5832ddf..79fba9b 100644 --- a/src/assets/stylesheets/ballots/footer.scss +++ b/src/assets/stylesheets/ballots/footer.scss @@ -1,7 +1,12 @@ .ballots-footer { display: flex; align-items: center; + justify-content: space-between; + &-left { + display: inline-flex; + align-items: center; + } @media screen and (max-width: $tablet-width) { padding-top: $tablet-indent; } diff --git a/src/components/BallotKeysCard.jsx b/src/components/BallotKeysCard.jsx index dcf1b35..f81f1f3 100644 --- a/src/components/BallotKeysCard.jsx +++ b/src/components/BallotKeysCard.jsx @@ -1,6 +1,6 @@ import React from 'react'; import moment from 'moment'; -import { observable, action, computed } from "mobx"; +import { observable, action, computed, autorun } from "mobx"; import { inject, observer } from "mobx-react"; import { toAscii } from "../helpers"; import { constants } from "../constants"; @@ -265,6 +265,15 @@ export class BallotKeysCard extends React.Component { this.getProgress(); this.getIsFinalized(); } + componentDidMount() { + this.interval = setInterval(() => { + this.calcTimeToFinish() + }, 1000) + } + + componentWillUnmount() { + window.clearInterval(this.interval); + } hideCard = () => { let { commonStore } = this.props; @@ -360,8 +369,11 @@ export class BallotKeysCard extends React.Component {
- -

{constants.CARD_FINALIZE_DESCRIPTION}

+
+ +

{constants.CARD_FINALIZE_DESCRIPTION}

+
+
Ballot ID: {this.props.id}
); diff --git a/src/contracts/addresses.js b/src/contracts/addresses.js index e753870..91499bf 100644 --- a/src/contracts/addresses.js +++ b/src/contracts/addresses.js @@ -1,11 +1,11 @@ -const local = { - VOTING_TO_CHANGE_KEYS_ADDRESS: '0x758492834ed6454f41d6d3d6b73d6e46d4555429', - VOTING_TO_CHANGE_MIN_THRESHOLD: '0xcbf043db3498b5064bd62341be0c0e3fb0344b1b', - VOTING_TO_CHANGE_PROXY: '0xcb3f870269a3f7215eb87d9548ee5b7eff6396dd', - BALLOTS_STORAGE_ADDRESS: '0x144947d78b932ea0dff14d75e1f7cd1b2f131426', - METADATA_ADDRESS: '0x3111c94b9243a8a99d5a867e00609900e437e2c0', - POA_ADDRESS: '0xf472e0e43570b9afaab67089615080cf7c20018d', -} +// const local = { +// VOTING_TO_CHANGE_KEYS_ADDRESS: '0x758492834ed6454f41d6d3d6b73d6e46d4555429', +// VOTING_TO_CHANGE_MIN_THRESHOLD: '0xcbf043db3498b5064bd62341be0c0e3fb0344b1b', +// VOTING_TO_CHANGE_PROXY: '0xcb3f870269a3f7215eb87d9548ee5b7eff6396dd', +// BALLOTS_STORAGE_ADDRESS: '0x144947d78b932ea0dff14d75e1f7cd1b2f131426', +// METADATA_ADDRESS: '0x3111c94b9243a8a99d5a867e00609900e437e2c0', +// POA_ADDRESS: '0xf472e0e43570b9afaab67089615080cf7c20018d', +// } const CORE_ADDRESSES = { VOTING_TO_CHANGE_KEYS_ADDRESS: '0x49df4ec19243263e5db22da5865b4f482b8323a0', @@ -30,9 +30,9 @@ module.exports = (netId) => { case '77': return SOKOL_ADDRESSES case '99': - return local + return CORE_ADDRESSES default: - return local + return CORE_ADDRESSES } } diff --git a/src/getWeb3.js b/src/getWeb3.js index fef21e1..e899f40 100644 --- a/src/getWeb3.js +++ b/src/getWeb3.js @@ -29,7 +29,7 @@ let getWeb3 = () => { errorMsg = constants.WRONG_NETWORK_MSG console.log('This is an unknown network.', netId) } - document.title = `${netIdName} - POA governance dApp` + document.title = `${netIdName} - POA Network Governance DApp` var defaultAccount = web3.eth.defaultAccount || null; if(defaultAccount === null){ reject({message: constants.NO_METAMASK_MSG}) diff --git a/src/stores/ContractsStore.js b/src/stores/ContractsStore.js index f5dc67c..615e39f 100644 --- a/src/stores/ContractsStore.js +++ b/src/stores/ContractsStore.js @@ -19,7 +19,6 @@ import "babel-polyfill"; class ContractsStore { @observable activeKeysBallotsIDs; - @observable validatorLimits; @observable poaConsensus; @observable ballotsStorage; @observable votingToChangeKeys;