Merge branch 'hackrush01-wallet_bckp_help'

This commit is contained in:
Jeremy Kauffman 2017-08-15 17:43:05 -04:00
commit a21eaf0f57
9 changed files with 92 additions and 8 deletions

View file

@ -9,6 +9,7 @@ Web UI version numbers should always match the corresponding version of LBRY App
## [Unreleased]
### Added
* Added a new component, `FormFieldPrice` which is now used in Publish and Settings
* Added wallet backup guide reference
*
### Changed

View file

@ -17,11 +17,9 @@ const Link = props => {
const className =
(props.className || "") +
(!props.className && !props.button ? "button-text" : "") + // Non-button links get the same look as text buttons
(props.button
? " button-block button-" + props.button + " button-set-item"
: "") +
(props.disabled ? " disabled" : "");
(!props.className && !button ? "button-text" : "") + // Non-button links get the same look as text buttons
(button ? " button-block button-" + button + " button-set-item" : "") +
(disabled ? " disabled" : "");
let content;
if (children) {

View file

@ -14,6 +14,7 @@ import FileListPublished from "page/fileListPublished";
import ChannelPage from "page/channel";
import SearchPage from "page/search";
import AuthPage from "page/auth";
import BackupPage from "page/backup";
const route = (page, routesMap) => {
const component = routesMap[page];
@ -26,6 +27,7 @@ const Router = props => {
return route(currentPage, {
auth: <AuthPage params={params} />,
backup: <BackupPage params={params} />,
channel: <ChannelPage params={params} />,
developer: <DeveloperPage params={params} />,
discover: <DiscoverPage params={params} />,

View file

@ -0,0 +1,10 @@
import React from "react";
import { connect } from "react-redux";
import { selectDaemonSettings } from "selectors/settings";
import BackupPage from "./view";
const select = state => ({
daemonSettings: selectDaemonSettings(state),
});
export default connect(select, null)(BackupPage);

View file

@ -0,0 +1,55 @@
import React from "react";
import SubHeader from "component/subHeader";
import Link from "component/link";
class BackupPage extends React.PureComponent {
render() {
const { daemonSettings } = this.props;
if (!daemonSettings || Object.keys(daemonSettings).length === 0) {
return (
<main className="main--single-column">
<SubHeader />
<span className="empty">{__("Failed to load settings.")}</span>
</main>
);
}
return (
<main className="main--single-column">
<SubHeader />
<section className="card">
<div className="card__title-primary">
<h3>{__("Backup Wallet")}</h3>
</div>
<div className="card__content">
<p>
{__(
"Currently, there is no automatic wallet backup, but it is fairly easy to back up manually."
)}
</p>
<p>
{__(
"To backup your wallet, make a copy of the folder listed below:"
)}
</p>
<p>
<code>
{__(`${daemonSettings.lbryum_wallet_dir}`)}
</code>
</p>
<p>
<strong>
{__(
"Access to these files are equivalent to having access to your credits. Keep any copies you make of your wallet in a secure place."
)}
</strong>
</p>
</div>
</section>
</main>
);
}
}
export default BackupPage;

View file

@ -1,5 +1,6 @@
import React from "react";
import { connect } from "react-redux";
import { doNavigate } from "actions/app";
import { selectCurrentPage } from "selectors/app";
import { selectBalance } from "selectors/wallet";
import WalletPage from "./view";
@ -9,4 +10,8 @@ const select = state => ({
balance: selectBalance(state),
});
export default connect(select, null)(WalletPage);
const perform = dispatch => ({
navigate: path => dispatch(doNavigate(path)),
});
export default connect(select, perform)(WalletPage);

View file

@ -3,11 +3,11 @@ import SubHeader from "component/subHeader";
import TransactionList from "component/transactionList";
import WalletAddress from "component/walletAddress";
import WalletSend from "component/walletSend";
import Link from "component/link";
import { CreditAmount } from "component/common";
const WalletPage = props => {
const { balance, currentPage } = props;
const { balance, currentPage, navigate } = props;
return (
<main className="main--single-column">
@ -19,6 +19,14 @@ const WalletPage = props => {
<div className="card__content">
<CreditAmount amount={balance} precision={8} />
</div>
<div className="card__content">
<div className="help">
<Link
onClick={() => navigate("/backup")}
label={__("Backup Your Wallet")}
/>
</div>
</div>
</section>
{currentPage === "wallet" ? <TransactionList {...props} /> : ""}
{currentPage === "send" ? <WalletSend {...props} /> : ""}

View file

@ -41,6 +41,8 @@ export const selectPageTitle = createSelector(
return __("Send");
case "receive":
return __("Receive");
case "backup":
return __("Backup");
case "rewards":
return __("Rewards");
case "start":
@ -130,11 +132,13 @@ export const selectDownloadComplete = createSelector(
);
export const selectHeaderLinks = createSelector(selectCurrentPage, page => {
// This contains intentional fall throughs
switch (page) {
case "wallet":
case "send":
case "receive":
case "rewards":
case "backup":
return {
wallet: __("Overview"),
send: __("Send"),

View file

@ -57,6 +57,7 @@ export const selectWunderBarIcon = createSelector(selectCurrentPage, page => {
case "wallet":
case "send":
case "receive":
case "backup":
return "icon-bank";
case "show":
return "icon-file";