wallet changes

finish rebase
This commit is contained in:
Jeremy Kauffman 2017-08-22 17:19:33 -04:00
parent 8c012bc087
commit b07682ef9d
11 changed files with 41 additions and 19 deletions

View file

@ -30,6 +30,7 @@ const Router = props => {
const { currentPage, params } = props;
return route(currentPage, {
address: <ReceiveCreditsPage params={params} />,
auth: <AuthPage params={params} />,
backup: <BackupPage params={params} />,
channel: <ChannelPage params={params} />,
@ -41,7 +42,6 @@ const Router = props => {
invite: <InvitePage params={params} />,
publish: <PublishPage params={params} />,
published: <FileListPublished params={params} />,
receive: <ReceiveCreditsPage params={params} />,
report: <ReportPage params={params} />,
rewards: <RewardsPage params={params} />,
search: <SearchPage params={params} />,

View file

@ -16,6 +16,11 @@ class WalletAddress extends React.PureComponent {
<h3>{__("Wallet Address")}</h3>
</div>
<div className="card__content">
<p>
{__(
'Other LBRY users may send credits to you by entering this address on the "Send" page.'
)}
</p>
<Address address={receiveAddress} />
</div>
<div className="card__actions">
@ -29,11 +34,6 @@ class WalletAddress extends React.PureComponent {
</div>
<div className="card__content">
<div className="help">
<p>
{__(
'Other LBRY users may send credits to you by entering this address on the "Send" page.'
)}
</p>
<p>
{__(
"You can generate a new address at any time, and any previous addresses will continue to work. Using multiple addresses can be helpful for keeping track of incoming payments from multiple sources."

View file

@ -18,11 +18,12 @@ const WalletBalance = props => {
<h3>{__("Balance")}</h3>
</div>
<div className="card__content">
{balance && <CreditAmount amount={balance} precision={8} />}
{(balance || balance === 0) &&
<CreditAmount amount={balance} precision={8} />}
</div>
<div className="card__content">
<Link button="text" navigate="/send" label={__("Send")} />
<Link button="text" navigate="/receive" label={__("Receive")} />
<Link button="text" navigate="/address" label={__("Address")} />
<Link
button="text"
navigate="/backup"

View file

@ -22,7 +22,7 @@ const ModalCreditIntro = props => {
)}
</p>
<p>
{__("New verified users automatically receive more than ")} {" "}
{__("New verified users can receive more than ")} {" "}
{totalRewardValue
? <CreditAmount amount={totalRewardRounded} />
: <span className="credit-amount">{__("credits")}</span>}

View file

@ -11,11 +11,11 @@ class ModalInsufficientCredits extends React.PureComponent {
type="confirm"
contentLabel={__("Not enough credits")}
confirmButtonLabel={__("Get Credits")}
abortButtonLabel={__("Cancel")}
abortButtonLabel={__("Not Now")}
onAborted={closeModal}
onConfirmed={addFunds}
>
{__("More LBRY credits are required to purchase this.")}
<p>{__("More LBRY credits are required to take this action.")}</p>
</Modal>
);
}

View file

@ -4,10 +4,12 @@ import { selectCurrentModal, selectCurrentPage } from "selectors/app";
import { doOpenModal } from "actions/app";
import { makeSelectClientSetting } from "selectors/settings";
import { selectUser } from "selectors/user";
import { selectCostForCurrentPageUri } from "selectors/cost_info";
import * as settings from "constants/settings";
import ModalRouter from "./view";
const select = (state, props) => ({
showPageCost: selectCostForCurrentPageUri(state),
modal: selectCurrentModal(state),
page: selectCurrentPage(state),
isWelcomeAcknowledged: makeSelectClientSetting(

View file

@ -45,14 +45,23 @@ class ModalRouter extends React.PureComponent {
}
checkShowCreditIntro(props) {
const { page, isCreditIntroAcknowledged, openModal, user } = props;
const {
page,
isCreditIntroAcknowledged,
openModal,
user,
showPageCost,
} = props;
if (
!isCreditIntroAcknowledged &&
user &&
!user.is_reward_approved &&
!user.is_identity_verified &&
["rewards", "send", "receive", "show", "publish", "wallet"].includes(page)
["rewards", "send", "address", "show", "publish", "wallet"].includes(
page
) &&
(page != "show" || showPageCost > 0)
) {
openModal(modals.CREDIT_INTRO);
return true;

View file

@ -1,5 +1,6 @@
import * as types from "constants/action_types";
import * as settings from "constants/settings";
import LANGUAGES from "constants/languages";
import lbry from "lbry";
const reducers = {};
@ -10,7 +11,7 @@ const defaultState = {
credit_intro_acknowledged: lbry.getClientSetting(
settings.CREDIT_INTRO_ACKNOWLEDGED
),
language: lbry.getClientSetting(settings.LANGUAGE)
language: lbry.getClientSetting(settings.LANGUAGE),
},
languages: {},
};

View file

@ -39,8 +39,8 @@ export const selectPageTitle = createSelector(
return __("Wallet");
case "send":
return __("Send Credits");
case "receive":
return __("Receive Credits");
case "address":
return __("Wallet Address");
case "backup":
return __("Backup Your Wallet");
case "rewards":
@ -143,7 +143,7 @@ export const selectHeaderLinks = createSelector(selectCurrentPage, page => {
case "wallet":
case "history":
case "send":
case "receive":
case "address":
case "invite":
case "rewards":
case "backup":
@ -153,7 +153,7 @@ export const selectHeaderLinks = createSelector(selectCurrentPage, page => {
invite: __("Invites"),
history: __("History"),
send: __("Send"),
receive: __("Receive"),
address: __("Address"),
};
case "downloaded":
case "published":

View file

@ -1,4 +1,5 @@
import { createSelector } from "reselect";
import { selectCurrentParams } from "./app";
export const _selectState = state => state.costInfo || {};
@ -15,6 +16,13 @@ export const makeSelectCostInfoForUri = () => {
return createSelector(selectCostInfoForUri, costInfo => costInfo);
};
export const selectCostForCurrentPageUri = createSelector(
selectAllCostInfoByUri,
selectCurrentParams,
(costInfo, params) =>
params.uri && costInfo[params.uri] ? costInfo[params.uri].cost : undefined
);
export const selectFetchingCostInfo = createSelector(
_selectState,
state => state.fetching || {}

View file

@ -60,7 +60,8 @@ export const selectWunderBarIcon = createSelector(selectCurrentPage, page => {
return "icon-rocket";
case "invite":
return "icon-envelope-open";
case "receive":
case "address":
return "icon-address-book";
case "wallet":
case "backup":
return "icon-bank";