Skip to content

Commit

Permalink
Add wallet migration notice for bitshares.org/wallet fix bitshares#635
Browse files Browse the repository at this point in the history
  • Loading branch information
svk31 committed Nov 21, 2017
1 parent 8b7151d commit 7df0c44
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 5 deletions.
4 changes: 4 additions & 0 deletions app/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import TransactionConfirm from "./components/Blockchain/TransactionConfirm";
import WalletUnlockModal from "./components/Wallet/WalletUnlockModal";
import BrowserSupportModal from "./components/Modal/BrowserSupportModal";
import Footer from "./components/Layout/Footer";
import Deprecate from "./Deprecate";
// import Incognito from "./components/Layout/Incognito";
// import { isIncognito } from "feature_detect";

Expand Down Expand Up @@ -153,6 +154,7 @@ class App extends React.Component {

render() {
let {isMobile, theme } = this.state;

let content = null;

let showFooter = 1;
Expand All @@ -171,6 +173,8 @@ class App extends React.Component {
</div>;
} else if (this.props.location.pathname === "/init-error") {
content = <div className="grid-frame vertical">{this.props.children}</div>;
} else if (__DEPRECATED__) {
content = <Deprecate {...this.props} />;
} else {
content = (
<div className="grid-frame vertical">
Expand Down
47 changes: 47 additions & 0 deletions app/Deprecate.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from "react";
import WalletDb from "stores/WalletDb";
import Settings from "./components/Settings/SettingsContainer";
import Translate from "react-translate-component";

export default class Deprecate extends React.Component {
hasWallet() {
return !!WalletDb.getWallet();
}

renderForWallet() {
return (
<div>
<Translate content="migration.text_1" component="h4" />
<Translate content="migration.text_2" component="p" unsafe />


<Settings {...this.props} deprecated />


</div>
);
}

renderForCloud() {
return (
<div>
<Translate content="migration.text_3" unsafe component="p" />
</div>
);
}

render() {
return (
<div className="grid-frame vertical">
<div className="grid-block">
<div className="grid-content" style={{paddingTop: "2rem"}}>
<Translate content="migration.title" component="h2" />
<Translate content="migration.announcement_1" unsafe component="p" />
<p><a href="https://wallet.bitshares.org" target='blank' rel='noopener noreferrer'>https://wallet.bitshares.org</a></p>
{this.hasWallet() ? this.renderForWallet() : this.renderForCloud()}
</div>
</div>
</div>
);
}
};
7 changes: 7 additions & 0 deletions app/assets/locales/locale-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1384,5 +1384,12 @@
},
"trx_error": {
"expire": "Your transaction has expired without being confirmed, please try again later."
},
"migration": {
"title": "Notice",
"announcement_1": "In an effort to provide enhanced security for the web-based wallet, we are migrating it, effective immediately to the address below. Please be sure to update any bookmarks you may have.",
"text_1": "Local wallet detected",
"text_2": "Please backup your wallet now and restore the backup file to <a href='https://wallet.bitshares.org' target='blank' rel='noopener noreferrer'>https://wallet.bitshares.org</a>, which will be your new address for the web wallet. Thanks for your continued support.",
"text_3": "Please use <a href='https://wallet.bitshares.org' target='blank' rel='noopener noreferrer'>https://wallet.bitshares.org</a> from now on, your existing credentials will let you login there as well."
}
}
11 changes: 9 additions & 2 deletions app/components/Settings/Settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Settings extends React.Component {
if (activeSetting > (menuEntries.length - 1)) {
activeSetting = 0;
}
if (props.deprecated) activeSetting = 1;

this.state = {
apiServer: props.settings.get("apiServer"),
Expand Down Expand Up @@ -58,6 +59,12 @@ class Settings extends React.Component {
}

_getMenuEntries(props) {
if (props.deprecated) {
return [
"wallet",
"backup"
];
}
let menuEntries = [
"general",
"wallet",
Expand Down Expand Up @@ -185,7 +192,7 @@ class Settings extends React.Component {
break;

case "wallet":
entries = <WalletSettings />;
entries = <WalletSettings {...this.props} />;
break;

case "password":
Expand Down Expand Up @@ -223,7 +230,7 @@ class Settings extends React.Component {
}

return (
<div className="grid-block page-layout">
<div className={this.props.deprecated ? "" : "grid-block page-layout"}>
<div className="grid-block main-content wrap">
<div className="grid-content large-offset-2 shrink" style={{paddingRight: "4rem"}}>
<Translate style={{paddingBottom: 20}} className="bottom-border" component="h4" content="header.settings" />
Expand Down
2 changes: 1 addition & 1 deletion app/components/Settings/SettingsContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class SettingsContainer extends React.Component {
}
}}
>
<Settings/>
<Settings {...this.props} />
</AltContainer>
);
}
Expand Down
11 changes: 11 additions & 0 deletions app/components/Settings/WalletSettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,23 @@ export default class WalletSettings extends React.Component {

render() {
let {lookupActive} = this.state;
let {deprecated} = this.props;

if (deprecated) {
return (
<div>
<ChangeActiveWallet />
<WalletDelete />
</div>
);
}

return (
<div>

<ChangeActiveWallet />
<WalletDelete />

<section style={{padding: "15px 0"}} className="block-list">
<header><Translate content="wallet.balance_claims" />:</header>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"build": "cross-env NODE_ENV=production webpack --env.prod",
"build-hash": "cross-env NODE_ENV=production webpack --env.prod --env.hash --env.baseUrl=''",
"build-hash-nougly": "cross-env NODE_ENV=production webpack --env.prod --env.hash --env.noUgly --env.baseUrl=''",
"build-github": "cross-env NODE_ENV=production webpack --env.prod --env.hash --env.baseUrl='/wallet/'",
"build-github": "cross-env NODE_ENV=production webpack --env.prod --env.hash env.deprecated --env.baseUrl='/wallet/'",
"build-electron": "cross-env NODE_ENV=production webpack --env.prod --env.electron --env.hash",
"build-electron-nougly": "cross-env NODE_ENV=production webpack --env.prod --env.electron --env.noUgly --env.hash --progress --display-error-details --colors",
"prepare-electron": "copyfiles -f resources/*.js build/electron/",
Expand Down
3 changes: 2 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ module.exports = function(env) {
__HASH_HISTORY__: !!env.hash,
__BASE_URL__: JSON.stringify(baseUrl),
__UI_API__: JSON.stringify(env.apiUrl || "https://ui.bitshares.eu/api"),
__TESTNET__: !!env.testnet
__TESTNET__: !!env.testnet,
__DEPRECATED__: !!env.deprecated
})
];

Expand Down

0 comments on commit 7df0c44

Please sign in to comment.