minor cleanup, update api field name
This commit is contained in:
parent
c2a611f11c
commit
ed2cbc0555
9 changed files with 27 additions and 35 deletions
|
@ -136,7 +136,7 @@ lbryio.authenticate = function() {
|
|||
resolve({
|
||||
id: 1,
|
||||
language: "en",
|
||||
has_email: true,
|
||||
primary_email: "disabled@lbry.io",
|
||||
has_verified_email: true,
|
||||
is_identity_verified: true,
|
||||
is_reward_approved: false,
|
||||
|
|
|
@ -4,7 +4,6 @@ import { connect } from "react-redux";
|
|||
import { selectPathAfterAuth } from "selectors/app";
|
||||
import {
|
||||
selectAuthenticationIsPending,
|
||||
selectUserHasEmail,
|
||||
selectEmailToVerify,
|
||||
selectUserIsVerificationCandidate,
|
||||
selectUser,
|
||||
|
@ -19,7 +18,6 @@ const select = state => ({
|
|||
selectUserIsPending(state) ||
|
||||
selectIdentityVerifyIsPending(state),
|
||||
email: selectEmailToVerify(state),
|
||||
hasEmail: selectUserHasEmail(state),
|
||||
pathAfterAuth: selectPathAfterAuth(state),
|
||||
user: selectUser(state),
|
||||
isVerificationCandidate: selectUserIsVerificationCandidate(state),
|
||||
|
|
|
@ -56,7 +56,7 @@ export class AuthPage extends React.PureComponent {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { email, hasEmail, isPending } = this.props;
|
||||
const { email, user, isPending } = this.props;
|
||||
|
||||
return (
|
||||
<main className="">
|
||||
|
@ -67,7 +67,7 @@ export class AuthPage extends React.PureComponent {
|
|||
<div className="card__content">
|
||||
{!isPending &&
|
||||
!email &&
|
||||
!hasEmail &&
|
||||
!user.has_verified_email &&
|
||||
<p>
|
||||
{__("Create a verified identity and receive LBC rewards.")}
|
||||
</p>}
|
||||
|
|
|
@ -2,9 +2,14 @@ import React from "react";
|
|||
import { doNavigate } from "actions/app";
|
||||
import { connect } from "react-redux";
|
||||
import HelpPage from "./view";
|
||||
import { selectUser } from "selectors/user";
|
||||
|
||||
const select = state => ({
|
||||
user: selectUser(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
||||
});
|
||||
|
||||
export default connect(null, perform)(HelpPage);
|
||||
export default connect(select, perform)(HelpPage);
|
||||
|
|
|
@ -41,7 +41,7 @@ class HelpPage extends React.PureComponent {
|
|||
render() {
|
||||
let ver, osName, platform, newVerLink;
|
||||
|
||||
const { navigate } = this.props;
|
||||
const { navigate, user } = this.props;
|
||||
|
||||
if (this.state.versionInfo) {
|
||||
ver = this.state.versionInfo;
|
||||
|
@ -136,16 +136,24 @@ class HelpPage extends React.PureComponent {
|
|||
? <table className="table-standard">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{__("daemon (lbrynet)")}</th>
|
||||
<th>{__("App")}</th>
|
||||
<td>{this.state.uiVersion}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{__("Daemon (lbrynet)")}</th>
|
||||
<td>{ver.lbrynet_version}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{__("wallet (lbryum)")}</th>
|
||||
<th>{__("Wallet (lbryum)")}</th>
|
||||
<td>{ver.lbryum_version}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{__("interface")}</th>
|
||||
<td>{this.state.uiVersion}</td>
|
||||
<th>{__("Connected Email")}</th>
|
||||
<td>
|
||||
{user && user.primary_email
|
||||
? user.primary_email
|
||||
: <span className="empty">{__("none")}</span>}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{__("Platform")}</th>
|
||||
|
|
|
@ -5,11 +5,7 @@ import {
|
|||
selectFetchingRewards,
|
||||
selectRewards,
|
||||
} from "selectors/rewards";
|
||||
import {
|
||||
selectUser,
|
||||
selectUserHasEmail,
|
||||
selectUserIsVerificationCandidate,
|
||||
} from "selectors/user";
|
||||
import { selectUser } from "selectors/user";
|
||||
import { doAuthNavigate, doNavigate } from "actions/app";
|
||||
import { doRewardList } from "actions/rewards";
|
||||
import rewards from "rewards";
|
||||
|
|
|
@ -73,7 +73,7 @@ class RewardsPage extends React.PureComponent {
|
|||
|
||||
if (
|
||||
user &&
|
||||
(!user.has_email ||
|
||||
(!user.primary_email ||
|
||||
!user.has_verified_email ||
|
||||
!user.is_identity_verified)
|
||||
) {
|
||||
|
|
|
@ -73,7 +73,7 @@ reducers[types.USER_EMAIL_NEW_STARTED] = function(state, action) {
|
|||
|
||||
reducers[types.USER_EMAIL_NEW_SUCCESS] = function(state, action) {
|
||||
let user = Object.assign({}, state.user);
|
||||
user.has_email = true;
|
||||
user.primary_email = action.data.email;
|
||||
return Object.assign({}, state, {
|
||||
emailToVerify: action.data.email,
|
||||
emailNewIsPending: false,
|
||||
|
@ -105,7 +105,7 @@ reducers[types.USER_EMAIL_VERIFY_STARTED] = function(state, action) {
|
|||
|
||||
reducers[types.USER_EMAIL_VERIFY_SUCCESS] = function(state, action) {
|
||||
let user = Object.assign({}, state.user);
|
||||
user.has_email = true;
|
||||
user.primary_email = action.data.email;
|
||||
return Object.assign({}, state, {
|
||||
emailToVerify: "",
|
||||
emailVerifyIsPending: false,
|
||||
|
|
|
@ -21,13 +21,7 @@ export const selectEmailToVerify = createSelector(
|
|||
|
||||
export const selectUserEmail = createSelector(
|
||||
selectUser,
|
||||
user => (user && user.email ? user.email : "fake@lbry.io")
|
||||
);
|
||||
|
||||
export const selectUserHasEmail = createSelector(
|
||||
selectUser,
|
||||
selectEmailToVerify,
|
||||
(user, email) => (user && user.has_email) || !!email
|
||||
user => (user ? user.primary_email : null)
|
||||
);
|
||||
|
||||
export const selectUserIsRewardApproved = createSelector(
|
||||
|
@ -74,12 +68,3 @@ export const selectUserIsVerificationCandidate = createSelector(
|
|||
selectUser,
|
||||
user => user && (!user.has_verified_email || !user.is_identity_verified)
|
||||
);
|
||||
|
||||
export const selectUserIsAuthRequested = createSelector(
|
||||
selectEmailNewDeclined,
|
||||
selectAuthenticationIsPending,
|
||||
selectUserIsVerificationCandidate,
|
||||
selectUserHasEmail,
|
||||
(isEmailDeclined, isPending, isVerificationCandidate, hasEmail) =>
|
||||
!isEmailDeclined && (isPending || !hasEmail || isVerificationCandidate)
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue