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

View File

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

View File

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

View File

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

View File

@ -14,4 +14,4 @@
// You should have received a copy of the GNU General Public License
// 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;
}
}
.status {
font-size: 4rem;
}

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// 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 { connect } from 'react-redux';
@ -22,47 +22,38 @@ import StatusIndicator from '@parity/ui/StatusIndicator';
import styles from './syncWarning.css';
class SyncWarning extends Component {
static propTypes = {
className: PropTypes.string,
isOk: PropTypes.bool.isRequired,
health: PropTypes.object.isRequired
};
function SyncWarning ({ className, isOk, health }) {
console.log('SyncWarning', isOk, health);
render () {
const { className, isOk, health } = this.props;
if (isOk) {
return null;
}
return (
<div className={ className }>
<div className={ styles.body }>
<div className={ styles.status }>
<StatusIndicator
type='signal'
id='healthWarning.indicator'
status={ health.overall.status }
/>
</div>
{
health.overall.message.map((message) => (
<p key={ message }>
{ message }
</p>
))
}
</div>
</div>
);
if (isOk) {
return null;
}
return (
<div className={ className }>
<div className={ styles.body }>
{
health.overall.message.map((message) => (
<p key={ message }>
{ message }
</p>
))
}
</div>
</div>
);
}
SyncWarning.propTypes = {
className: PropTypes.string,
isOk: PropTypes.bool.isRequired,
health: PropTypes.object.isRequired
};
function mapStateToProps (state) {
const { health } = state.nodeStatus;
const isNotAvailableYet = health.overall.isNotReady;
const isOk = isNotAvailableYet || health.overall.status === 'ok';
const isOk = !isNotAvailableYet && health.overall.status === 'ok';
return {
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);
api.parity.registryAddress().then((address) => console.log('registryAddress', address)).catch((error) => console.error('registryAddress', error));
ContractInstances.get(api);
setupProviderFilters(api.provider);