lbry-desktop/src/renderer/modal/modalPhoneCollection/view.jsx

41 lines
1.1 KiB
React
Raw Normal View History

import React from 'react';
import { Modal } from 'modal/modal';
import Link from 'component/link/index';
2018-01-11 07:16:03 +01:00
import UserFieldNew from 'component/userFieldNew';
import UserFieldVerify from 'component/userFieldVerify';
class ModalPhoneCollection extends React.PureComponent {
renderInner() {
2018-01-15 14:32:01 +01:00
const { closeModal, phone, user } = this.props;
const cancelButton = <Link button="text" onClick={closeModal} label={__('Not Now')} />;
2018-01-15 14:32:01 +01:00
if (!user.phone_number && !phone) {
return <UserFieldNew cancelButton={cancelButton} fieldType="phone" />;
} else if (!user.phone_number) {
return <UserFieldVerify cancelButton={cancelButton} fieldType="phone" />;
}
closeModal();
}
render() {
const { user } = this.props;
// this shouldn't happen
if (!user) {
return null;
}
return (
2018-01-11 07:16:03 +01:00
<Modal type="custom" isOpen contentLabel="Phone">
<section>
2018-01-11 07:16:03 +01:00
<h3 className="modal__header">Verify Your Phone</h3>
{this.renderInner()}
</section>
</Modal>
);
}
}
export default ModalPhoneCollection;