add wallet sync message on wallet page

This commit is contained in:
Sean Yesmunt 2020-02-21 12:23:04 -05:00
parent dc38c8f809
commit 00485532d5
8 changed files with 59 additions and 8 deletions

View file

@ -962,5 +962,10 @@
"Sign in with lbry.tv to receive notifications about new content.": "Sign in with lbry.tv to receive notifications about new content.", "Sign in with lbry.tv to receive notifications about new content.": "Sign in with lbry.tv to receive notifications about new content.",
"Find new channels to follow": "Find new channels to follow", "Find new channels to follow": "Find new channels to follow",
"You aren't currently following any channels. %discover_channels_link%.": "You aren't currently following any channels. %discover_channels_link%.", "You aren't currently following any channels. %discover_channels_link%.": "You aren't currently following any channels. %discover_channels_link%.",
"LBRY Works Better If You Are Following Channels": "LBRY Works Better If You Are Following Channels" "LBRY Works Better If You Are Following Channels": "LBRY Works Better If You Are Following Channels",
"Your wallet is not currently synced with lbry.tv. You are in control of backing up your wallet.": "Your wallet is not currently synced with lbry.tv. You are in control of backing up your wallet.",
"A copy of your wallet is synced to lbry.tv": "A copy of your wallet is synced to lbry.tv",
"Saved zip archive to %outputPath%": "Saved zip archive to %outputPath%",
"A backup of your wallet is synced with lbry.tv": "A backup of your wallet is synced with lbry.tv",
"A backup of your wallet is synced with lbry.tv.": "A backup of your wallet is synced with lbry.tv."
} }

View file

@ -4,10 +4,11 @@ import React from 'react';
import Button from 'component/button'; import Button from 'component/button';
type Props = { type Props = {
href: string, href?: string,
navigate?: string,
}; };
export default function HelpLink(props: Props) { export default function HelpLink(props: Props) {
const { href } = props; const { href, navigate } = props;
return <Button className="icon--help" icon={ICONS.HELP} description={__('Help')} href={href} />; return <Button className="icon--help" icon={ICONS.HELP} description={__('Help')} href={href} navigate={navigate} />;
} }

View file

@ -4,6 +4,7 @@ import React, { useEffect } from 'react';
import { Route, Redirect, Switch, withRouter } from 'react-router-dom'; import { Route, Redirect, Switch, withRouter } from 'react-router-dom';
import SettingsPage from 'page/settings'; import SettingsPage from 'page/settings';
import HelpPage from 'page/help'; import HelpPage from 'page/help';
import BackupPage from 'page/backup';
import ReportPage from 'page/report'; import ReportPage from 'page/report';
import ShowPage from 'page/show'; import ShowPage from 'page/show';
import PublishPage from 'page/publish'; import PublishPage from 'page/publish';
@ -144,6 +145,7 @@ function AppRouter(props: Props) {
/> />
<Route path={`/$/${PAGES.CHANNELS_FOLLOWING_DISCOVER}`} exact component={ChannelsFollowingDiscoverPage} /> <Route path={`/$/${PAGES.CHANNELS_FOLLOWING_DISCOVER}`} exact component={ChannelsFollowingDiscoverPage} />
<Route path={`/$/${PAGES.HELP}`} exact component={HelpPage} /> <Route path={`/$/${PAGES.HELP}`} exact component={HelpPage} />
<Route path={`/$/${PAGES.BACKUP}`} exact component={BackupPage} />
<Route path={`/$/${PAGES.AUTH_VERIFY}`} exact component={SignInVerifyPage} /> <Route path={`/$/${PAGES.AUTH_VERIFY}`} exact component={SignInVerifyPage} />
<Route path={`/$/${PAGES.SEARCH}`} exact component={SearchPage} /> <Route path={`/$/${PAGES.SEARCH}`} exact component={SearchPage} />
<Route path={`/$/${PAGES.TOP}`} exact component={TopPage} /> <Route path={`/$/${PAGES.TOP}`} exact component={TopPage} />

View file

@ -7,7 +7,7 @@ import {
selectTipsBalance, selectTipsBalance,
} from 'lbry-redux'; } from 'lbry-redux';
import { doOpenModal } from 'redux/actions/app'; import { doOpenModal } from 'redux/actions/app';
import { selectClaimedRewards } from 'lbryinc'; import { selectClaimedRewards, selectSyncHash } from 'lbryinc';
import WalletBalance from './view'; import WalletBalance from './view';
const select = state => ({ const select = state => ({
@ -17,6 +17,7 @@ const select = state => ({
supportsBalance: selectSupportsBalance(state) || 0, supportsBalance: selectSupportsBalance(state) || 0,
tipsBalance: selectTipsBalance(state) || 0, tipsBalance: selectTipsBalance(state) || 0,
rewards: selectClaimedRewards(state), rewards: selectClaimedRewards(state),
hasSynced: Boolean(selectSyncHash(state)),
}); });
export default connect( export default connect(

View file

@ -1,10 +1,12 @@
// @flow // @flow
import * as ICONS from 'constants/icons'; import * as ICONS from 'constants/icons';
import * as MODALS from 'constants/modal_types'; import * as MODALS from 'constants/modal_types';
import * as PAGES from 'constants/pages';
import React from 'react'; import React from 'react';
import CreditAmount from 'component/common/credit-amount'; import CreditAmount from 'component/common/credit-amount';
import Button from 'component/button'; import Button from 'component/button';
import Icon from 'component/common/icon'; import Icon from 'component/common/icon';
import HelpLink from 'component/common/help-link';
type Props = { type Props = {
balance: number, balance: number,
@ -13,10 +15,11 @@ type Props = {
supportsBalance: number, supportsBalance: number,
tipsBalance: number, tipsBalance: number,
doOpenModal: string => void, doOpenModal: string => void,
hasSynced: boolean,
}; };
const WalletBalance = (props: Props) => { const WalletBalance = (props: Props) => {
const { balance, claimsBalance, supportsBalance, tipsBalance, doOpenModal } = props; const { balance, claimsBalance, supportsBalance, tipsBalance, doOpenModal, hasSynced } = props;
return ( return (
<React.Fragment> <React.Fragment>
@ -36,6 +39,31 @@ const WalletBalance = (props: Props) => {
onClick={() => doOpenModal(MODALS.WALLET_SEND)} onClick={() => doOpenModal(MODALS.WALLET_SEND)}
/> />
</div> </div>
{/* @if TARGET='app' */}
{hasSynced ? (
<div className="section">
<div className="section__flex">
<Icon sectionIcon iconColor={'blue'} icon={ICONS.LOCK} />
<h2 className="section__title--small">
{__('A backup of your wallet is synced with lbry.tv.')}
<HelpLink href="https://lbry.com/faq/account-sync" />
</h2>
</div>
</div>
) : (
<div className="section">
<div className="section__flex">
<Icon sectionIcon iconColor={'blue'} icon={ICONS.UNLOCK} />
<h2 className="section__title--small">
{__(
'Your wallet is not currently synced with lbry.tv. You are in control of backing up your wallet.'
)}
<HelpLink navigate={`/$/${PAGES.BACKUP}`} />
</h2>
</div>
</div>
)}
{/* @endif */}
</div> </div>
<div> <div>

2
ui/page/backup/index.js Normal file
View file

@ -0,0 +1,2 @@
import BackupPage from './view';
export default BackupPage;

14
ui/page/backup/view.jsx Normal file
View file

@ -0,0 +1,14 @@
// @flow
import * as React from 'react';
import Page from 'component/page';
import WalletBackup from 'component/walletBackup';
function BackupPage() {
return (
<Page>
<WalletBackup />
</Page>
);
}
export default BackupPage;

View file

@ -4,7 +4,6 @@ import * as icons from 'constants/icons';
import * as React from 'react'; import * as React from 'react';
// @if TARGET='app' // @if TARGET='app'
import { shell } from 'electron'; import { shell } from 'electron';
import WalletBackup from 'component/walletBackup';
// @endif // @endif
import { Lbry } from 'lbry-redux'; import { Lbry } from 'lbry-redux';
import Native from 'native'; import Native from 'native';
@ -199,7 +198,6 @@ class HelpPage extends React.PureComponent<Props, State> {
} }
/> />
<WalletBackup />
{/* @endif */} {/* @endif */}
<section className="card"> <section className="card">