lbry-desktop/src/ui/page/invite/view.jsx

44 lines
1.1 KiB
React
Raw Normal View History

// @flow
import React from 'react';
2018-03-26 23:32:43 +02:00
import BusyIndicator from 'component/common/busy-indicator';
import InviteNew from 'component/inviteNew';
import InviteList from 'component/inviteList';
2017-08-18 05:31:44 +02:00
type Props = {
isPending: boolean,
isFailed: boolean,
inviteAcknowledged: boolean,
acknowledgeInivte: () => void,
fetchInviteStatus: () => void,
};
class InvitePage extends React.PureComponent<Props> {
componentDidMount() {
const { fetchInviteStatus, inviteAcknowledged, acknowledgeInivte } = this.props;
fetchInviteStatus();
if (!inviteAcknowledged) {
acknowledgeInivte();
}
2017-08-18 05:31:44 +02:00
}
render() {
const { isPending, isFailed } = this.props;
return (
2019-06-17 22:32:38 +02:00
<div className="">
2018-03-26 23:32:43 +02:00
{isPending && <BusyIndicator message={__('Checking your invite status')} />}
2019-05-07 23:38:29 +02:00
{!isPending && isFailed && <span className="empty">{__('Failed to retrieve invite status.')}</span>}
2019-03-05 05:46:57 +01:00
{!isPending && !isFailed && (
<React.Fragment>
<InviteNew />
<InviteList />
</React.Fragment>
)}
2019-06-17 22:32:38 +02:00
</div>
2017-08-18 05:31:44 +02:00
);
}
}
export default InvitePage;