Update after merge

This commit is contained in:
Jaco Greeff 2017-10-05 15:04:45 +02:00
parent 290060e6c4
commit 21c95bbec5
9 changed files with 490 additions and 571 deletions

961
js/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -34,13 +34,11 @@ import Requests from '../Requests';
import Snackbar from '../Snackbar'; import Snackbar from '../Snackbar';
import Status from '../Status'; import Status from '../Status';
import UpgradeParity from '../UpgradeParity'; import UpgradeParity from '../UpgradeParity';
import SyncWarning, { showSyncWarning } from '../SyncWarning';
import Store from './store'; import Store from './store';
import styles from './application.css'; import styles from './application.css';
const inFrame = window.parent !== window && window.parent.frames.length !== 0; const inFrame = window.parent !== window && window.parent.frames.length !== 0;
const doShowSyncWarning = showSyncWarning();
@observer @observer
class Application extends Component { class Application extends Component {
@ -83,11 +81,6 @@ class Application extends Component {
? this.renderMinimized() ? this.renderMinimized()
: this.renderApp() : this.renderApp()
} }
{
doShowSyncWarning
? <SyncWarning />
: null
}
<Connection /> <Connection />
<DappRequests /> <DappRequests />
{ {

View File

@ -80,23 +80,16 @@ class FirstRun extends Component {
hasAccounts: PropTypes.bool.isRequired, hasAccounts: PropTypes.bool.isRequired,
newError: PropTypes.func.isRequired, newError: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired, onClose: PropTypes.func.isRequired,
visible: PropTypes.bool.isRequired, visible: PropTypes.bool.isRequired
isTest: PropTypes.bool.isRequired
} }
createStore = new CreateStore(this.context.api, {}, this.props.isTest, false); createStore = new CreateStore(this.context.api, {}, true, false);
state = { state = {
stage: 0, stage: 0,
hasAcceptedTnc: false hasAcceptedTnc: false
} }
componentWillReceiveProps (nextProps) {
if (nextProps.isTest !== this.props.isTest) {
this.createStore.setIsTest(nextProps.isTest);
}
}
render () { render () {
const { visible } = this.props; const { visible } = this.props;
const { stage } = this.state; const { stage } = this.state;
@ -357,10 +350,9 @@ class FirstRun extends Component {
function mapStateToProps (state) { function mapStateToProps (state) {
const { hasAccounts } = state.personal; const { hasAccounts } = state.personal;
const { isTest } = state.nodeStatus;
return { return {
hasAccounts, isTest hasAccounts
}; };
} }

View File

@ -20,12 +20,16 @@ $textColor: #ccc;
.container { .container {
color: $textColor; color: $textColor;
left: 0; left: 0;
padding: 0.5rem 0.75rem;
position: fixed; position: fixed;
right: 0; right: 0;
top: 0; top: 0;
z-index: 1000; z-index: 1000;
.status,
.warning {
padding: 0.5rem 0.75rem;
}
.status { .status {
align-items: center; align-items: center;
display: flex; display: flex;

View File

@ -44,7 +44,7 @@ function Status ({ className = '', upgradeStore }, { api }) {
const accountStore = AccountStore.get(api); const accountStore = AccountStore.get(api);
return ( return (
<GradientBg className={ className }> <GradientBg className={ `${styles.container} ${className}` }>
<div className={ styles.status }> <div className={ styles.status }>
<ClientVersion className={ styles.version } /> <ClientVersion className={ styles.version } />
<div className={ styles.upgrade }> <div className={ styles.upgrade }>
@ -94,8 +94,8 @@ function Status ({ className = '', upgradeStore }, { api }) {
/> />
<NetChain className={ styles.chain } /> <NetChain className={ styles.chain } />
</div> </div>
<SyncWarning className={ styles.warning } />
</div> </div>
<SyncWarning className={ styles.warning } />
</GradientBg> </GradientBg>
); );
} }

View File

@ -14,4 +14,4 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
export default, { showSyncWarning } from './syncWarning'; export default from './syncWarning';

View File

@ -36,7 +36,3 @@
margin: 0.5em 0; margin: 0.5em 0;
} }
} }
.status {
font-size: 4rem;
}

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
import React, { Component } from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
@ -22,15 +22,8 @@ import StatusIndicator from '@parity/ui/StatusIndicator';
import styles from './syncWarning.css'; import styles from './syncWarning.css';
class SyncWarning extends Component { function SyncWarning ({ className, isOk, health }) {
static propTypes = { console.log('SyncWarning', isOk, health);
className: PropTypes.string,
isOk: PropTypes.bool.isRequired,
health: PropTypes.object.isRequired
};
render () {
const { className, isOk, health } = this.props;
if (isOk) { if (isOk) {
return null; return null;
@ -39,13 +32,6 @@ class SyncWarning extends Component {
return ( return (
<div className={ className }> <div className={ className }>
<div className={ styles.body }> <div className={ styles.body }>
<div className={ styles.status }>
<StatusIndicator
type='signal'
id='healthWarning.indicator'
status={ health.overall.status }
/>
</div>
{ {
health.overall.message.map((message) => ( health.overall.message.map((message) => (
<p key={ message }> <p key={ message }>
@ -56,13 +42,18 @@ class SyncWarning extends Component {
</div> </div>
</div> </div>
); );
}
} }
SyncWarning.propTypes = {
className: PropTypes.string,
isOk: PropTypes.bool.isRequired,
health: PropTypes.object.isRequired
};
function mapStateToProps (state) { function mapStateToProps (state) {
const { health } = state.nodeStatus; const { health } = state.nodeStatus;
const isNotAvailableYet = health.overall.isNotReady; const isNotAvailableYet = health.overall.isNotReady;
const isOk = isNotAvailableYet || health.overall.status === 'ok'; const isOk = !isNotAvailableYet && health.overall.status === 'ok';
return { return {
isOk, isOk,

View File

@ -57,6 +57,8 @@ if (window.location.hash && window.location.hash.indexOf(AUTH_HASH) === 0) {
const api = new SecureApi(window.location.host, token); const api = new SecureApi(window.location.host, token);
api.parity.registryAddress().then((address) => console.log('registryAddress', address)).catch((error) => console.error('registryAddress', error));
ContractInstances.get(api); ContractInstances.get(api);
setupProviderFilters(api.provider); setupProviderFilters(api.provider);