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

56 lines
1.5 KiB
React
Raw Normal View History

// @flow
2020-08-24 19:59:37 +02:00
import { SITE_NAME } from 'config';
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';
2019-09-26 18:07:11 +02:00
import Page from 'component/page';
import RewardAuthIntro from 'component/rewardAuthIntro';
2017-08-18 05:31:44 +02:00
type Props = {
isPending: boolean,
isFailed: boolean,
inviteAcknowledged: boolean,
authenticated: boolean,
acknowledgeInivte: () => void,
fetchInviteStatus: (boolean) => void,
};
class InvitePage extends React.PureComponent<Props> {
componentDidMount() {
const { fetchInviteStatus, inviteAcknowledged, acknowledgeInivte } = this.props;
fetchInviteStatus(false);
if (!inviteAcknowledged) {
acknowledgeInivte();
}
2017-08-18 05:31:44 +02:00
}
render() {
const { isPending, isFailed, authenticated } = this.props;
2017-08-18 05:31:44 +02:00
return (
2019-09-26 18:07:11 +02:00
<Page>
{!authenticated ? (
2020-08-24 19:59:37 +02:00
<RewardAuthIntro
2020-09-03 22:05:38 +02:00
title={__('Log in to %SITE_NAME% to earn rewards From Inviting Your Friends', { SITE_NAME })}
2020-08-24 19:59:37 +02:00
/>
) : (
2019-03-05 05:46:57 +01:00
<React.Fragment>
{isPending && <BusyIndicator message={__('Checking your invite status')} />}
{!isPending && isFailed && <span className="empty">{__('Failed to retrieve invite status.')}</span>}
{!isPending && !isFailed && (
<React.Fragment>
<InviteNew />
<InviteList />
</React.Fragment>
)}
2019-03-05 05:46:57 +01:00
</React.Fragment>
)}
2019-09-26 18:07:11 +02:00
</Page>
2017-08-18 05:31:44 +02:00
);
}
}
export default InvitePage;