diff --git a/js/src/modals/UpgradeParity/Info/index.js b/js/src/modals/UpgradeParity/Info/index.js
new file mode 100644
index 000000000..e69de29bb
diff --git a/js/src/modals/UpgradeParity/Info/info.js b/js/src/modals/UpgradeParity/Info/info.js
new file mode 100644
index 000000000..539559710
--- /dev/null
+++ b/js/src/modals/UpgradeParity/Info/info.js
@@ -0,0 +1,31 @@
+// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
+// This file is part of Parity.
+
+// Parity is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Parity is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Parity. If not, see .
+
+import { observer } from 'mobx-react';
+import React, { Component, PropTypes } from 'react';
+
+@observer
+export default class Info extends Component {
+ static propTypes = {
+ store: PropTypes.object.isRequired
+ }
+
+ render () {
+ return (
+
info
+ );
+ }
+}
diff --git a/js/src/modals/UpgradeParity/Upgrade/index.js b/js/src/modals/UpgradeParity/Upgrade/index.js
new file mode 100644
index 000000000..ff2da57b5
--- /dev/null
+++ b/js/src/modals/UpgradeParity/Upgrade/index.js
@@ -0,0 +1,17 @@
+// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
+// This file is part of Parity.
+
+// Parity is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Parity is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Parity. If not, see .
+
+export default from './upgrade';
diff --git a/js/src/modals/UpgradeParity/Upgrade/upgrade.js b/js/src/modals/UpgradeParity/Upgrade/upgrade.js
new file mode 100644
index 000000000..75637058c
--- /dev/null
+++ b/js/src/modals/UpgradeParity/Upgrade/upgrade.js
@@ -0,0 +1,33 @@
+// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
+// This file is part of Parity.
+
+// Parity is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Parity is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Parity. If not, see .
+
+import { observer } from 'mobx-react';
+import React, { Component, PropTypes } from 'react';
+
+import styles from './.css';
+
+@observer
+export default class Upgrade extends Component {
+ static propTypes = {
+ store: PropTypes.object.isRequired
+ }
+
+ render () {
+ return (
+ hello
+ );
+ }
+}
diff --git a/js/src/modals/UpgradeParity/store.js b/js/src/modals/UpgradeParity/store.js
new file mode 100644
index 000000000..57446ead8
--- /dev/null
+++ b/js/src/modals/UpgradeParity/store.js
@@ -0,0 +1,86 @@
+// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
+// This file is part of Parity.
+
+// Parity is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Parity is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Parity. If not, see .
+
+import { action, observable, transaction } from 'mobx';
+import store from 'store';
+
+const AN_HOUR = 60 * 60 * 1000;
+const A_DAY = 24 * AN_HOUR;
+const CHECK_INTERVAL = AN_HOUR;
+const LS_UPDATE = '_parity::update';
+
+export default class Store {
+ @observable availableUpgrade = null;
+ @observable remindAt = 0;
+ @observable showUpgrade = false;
+
+ constructor (api) {
+ this._api = api;
+
+ this.checkUpgrade();
+ setInterval(this.pollUpgrade, CHECK_INTERVAL);
+ }
+
+ @action loadStorage () {
+ const values = store.get(LS_UPDATE) || {};
+
+ this.remindAt = values.remindAt ? values.remindAt : 0;
+
+ return values;
+ }
+
+ @action setAvailableUpgrade (availableUpgrade, consensusCapability) {
+ transaction(() => {
+ this.setConsensusCapability(consensusCapability);
+ this.availableUpgrade = availableUpgrade;
+
+ if (availableUpgrade && Date.now() >= this.remindAt) {
+ this.showUpgrade = true;
+ }
+ });
+ }
+
+ @action setConsensusCapability (consensusCapability) {
+ this.consensusCapability = consensusCapability;
+ }
+
+ @action snoozeTillTomorrow () {
+ store.set(LS_UPDATE, Object.assign(this.loadStorage(), {
+ remindAt: Date.now() + A_DAY
+ }));
+ }
+
+ checkUpgrade = () => {
+ this.loadStorage();
+
+ return Promise
+ .all([
+ this._api.parity.upgradeReady(),
+ this._api.parity.consensusCapability()
+ ])
+ .then(([availableUpgrade, consensusCapability]) => {
+ this.setAvailableUpgrade(availableUpgrade, consensusCapability);
+ })
+ .catch((error) => {
+ console.warn('checkUpgrade', error);
+ });
+ }
+
+ executeUpgrade = () => {
+ return this._api.parity
+ .executeUpgrade();
+ }
+}
diff --git a/js/src/modals/UpgradeParity/upgradeParity.js b/js/src/modals/UpgradeParity/upgradeParity.js
new file mode 100644
index 000000000..41a28d666
--- /dev/null
+++ b/js/src/modals/UpgradeParity/upgradeParity.js
@@ -0,0 +1,47 @@
+// Copyright 2015, 2016 Parity Technologies (UK) Ltd.
+// This file is part of Parity.
+
+// Parity is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Parity is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Parity. If not, see .
+
+import { observer } from 'mobx-react';
+import React, { Component, PropTypes } from 'react';
+
+import { Button, Modal } from '~/ui';
+
+import Store from './store';
+
+@observer
+export default class UpgradeParity extends Component {
+ static contextTypes = {
+ api: PropTypes.object.isRequired
+ };
+
+ store = new Store(this.context.api);
+
+ render () {
+ if (!this.store.showUpgrade) {
+ return null;
+ }
+
+ return (
+
+ ] }
+ visible>
+
+
+ );
+ }
+}
diff --git a/js/src/modals/index.js b/js/src/modals/index.js
index d3574fdc7..373772757 100644
--- a/js/src/modals/index.js
+++ b/js/src/modals/index.js
@@ -23,12 +23,13 @@ import DeployContract from './DeployContract';
import EditMeta from './EditMeta';
import ExecuteContract from './ExecuteContract';
import FirstRun from './FirstRun';
+import LoadContract from './LoadContract';
+import SaveContract from './SaveContract';
import Shapeshift from './Shapeshift';
import SMSVerification from './SMSVerification';
import Transfer from './Transfer';
import PasswordManager from './PasswordManager';
-import SaveContract from './SaveContract';
-import LoadContract from './LoadContract';
+import UpgradeParity from './UpgradeParity';
import WalletSettings from './WalletSettings';
export {
@@ -41,11 +42,12 @@ export {
EditMeta,
ExecuteContract,
FirstRun,
+ LoadContract,
+ SaveContract,
Shapeshift,
SMSVerification,
Transfer,
PasswordManager,
- LoadContract,
- SaveContract,
+ UpgradeParity,
WalletSettings
};
diff --git a/js/src/views/Application/Container/container.js b/js/src/views/Application/Container/container.js
index c5cd529a5..275f8999c 100644
--- a/js/src/views/Application/Container/container.js
+++ b/js/src/views/Application/Container/container.js
@@ -16,7 +16,7 @@
import React, { Component, PropTypes } from 'react';
-import { FirstRun } from '~/modals';
+import { FirstRun, UpgradeParity } from '~/modals';
import { Errors, ParityBackground, Tooltips } from '~/ui';
import styles from '../application.css';
@@ -28,20 +28,21 @@ export default class Container extends Component {
static propTypes = {
children: PropTypes.node.isRequired,
- showFirstRun: PropTypes.bool,
- onCloseFirstRun: PropTypes.func
+ onCloseFirstRun: PropTypes.func,
+ showFirstRun: PropTypes.bool
};
render () {
- const { children, showFirstRun, onCloseFirstRun } = this.props;
const { muiTheme } = this.context;
+ const { children, onCloseFirstRun, showFirstRun } = this.props;
return (
+ onClose={ onCloseFirstRun }
+ visible={ showFirstRun } />
+
{ children }