lbry-desktop/ui/js/component/authOverlay/view.jsx

81 lines
2.1 KiB
React
Raw Normal View History

2017-06-01 18:20:12 +02:00
import React from "react";
2017-06-08 02:56:52 +02:00
import lbryio from "lbryio.js";
2017-06-01 18:20:12 +02:00
import ModalPage from "component/modal-page.js";
2017-06-08 02:56:52 +02:00
import Auth from "component/auth";
import Link from "component/link";
2017-06-01 18:20:12 +02:00
2017-06-03 01:09:52 +02:00
export class AuthOverlay extends React.Component {
2017-06-01 18:20:12 +02:00
constructor(props) {
super(props);
this.state = {
showNoEmailConfirm: false,
};
}
2017-06-08 02:56:52 +02:00
componentWillReceiveProps(nextProps) {
if (this.props.isShowing && !this.props.isPending && !nextProps.isShowing) {
setTimeout(() => this.props.openWelcomeModal(), 1);
}
}
2017-06-01 18:20:12 +02:00
onEmailSkipClick() {
2017-06-08 02:56:52 +02:00
this.setState({ showNoEmailConfirm: true });
2017-06-01 18:20:12 +02:00
}
onEmailSkipConfirm() {
2017-06-08 02:56:52 +02:00
this.props.userEmailDecline();
2017-06-01 18:20:12 +02:00
}
render() {
2017-06-08 02:56:52 +02:00
if (!lbryio.enabled) {
return null;
}
const { isPending, isShowing } = this.props;
2017-06-03 01:09:52 +02:00
2017-06-08 02:56:52 +02:00
if (isShowing) {
return (
<ModalPage
className="modal-page--full"
isOpen={true}
contentLabel="Authentication"
>
<h1>LBRY Early Access</h1>
<Auth />
{isPending
? ""
: <div className="form-row-submit">
{this.state.showNoEmailConfirm
? <div>
<p className="help form-input-width">
{__(
"If you continue without an email, you will be ineligible to earn free LBC rewards, as well as unable to receive security related communications."
)}
</p>
<Link
className="button-text-help"
onClick={() => {
this.onEmailSkipConfirm();
}}
label={__("Continue without email")}
/>
</div>
: <Link
className="button-text-help"
onClick={() => {
this.onEmailSkipClick();
}}
label={__("Do I have to?")}
/>}
</div>}
</ModalPage>
);
2017-06-01 18:20:12 +02:00
}
2017-06-08 02:56:52 +02:00
return null;
2017-06-01 18:20:12 +02:00
}
}
2017-06-08 02:56:52 +02:00
export default AuthOverlay;