2020-06-29 21:54:07 +02:00
|
|
|
// @flow
|
2020-08-26 18:24:07 +02:00
|
|
|
import * as PAGES from 'constants/pages';
|
|
|
|
import * as ICONS from 'constants/icons';
|
2020-06-29 21:54:07 +02:00
|
|
|
import React from 'react';
|
|
|
|
import ChannelEdit from 'component/channelEdit';
|
|
|
|
import Page from 'component/page';
|
2020-08-25 21:54:06 +02:00
|
|
|
import Button from 'component/button';
|
|
|
|
import { useHistory } from 'react-router';
|
2020-08-26 18:24:07 +02:00
|
|
|
import Yrbl from 'component/yrbl';
|
2020-06-29 21:54:07 +02:00
|
|
|
|
|
|
|
type Props = {
|
2020-08-25 21:54:06 +02:00
|
|
|
balance: number,
|
2020-06-29 21:54:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
function ChannelNew(props: Props) {
|
2020-08-25 21:54:06 +02:00
|
|
|
const { balance } = props;
|
|
|
|
const { push, location } = useHistory();
|
|
|
|
const urlSearchParams = new URLSearchParams(location.search);
|
|
|
|
const redirectUrl = urlSearchParams.get('redirect');
|
|
|
|
const emptyBalance = balance === 0;
|
|
|
|
|
2020-06-29 21:54:07 +02:00
|
|
|
return (
|
2020-08-26 18:24:07 +02:00
|
|
|
<Page noSideNavigation noFooter backout={{ title: __('Create a channel'), backLabel: __('Cancel') }}>
|
2020-08-25 21:54:06 +02:00
|
|
|
{emptyBalance && (
|
2020-08-26 18:24:07 +02:00
|
|
|
<div className="main--empty">
|
|
|
|
<Yrbl
|
|
|
|
type="sad"
|
|
|
|
title={__('Your wallet is empty')}
|
|
|
|
subtitle={
|
|
|
|
<div>
|
|
|
|
<p>{__('You need LBC to create a channel and upload content.')}</p>
|
|
|
|
<p>
|
|
|
|
{__(
|
|
|
|
'Never fear though, there are tons of ways to earn LBC! You can earn or purchase LBC, or you can have your friends send you some.'
|
|
|
|
)}
|
|
|
|
</p>
|
|
|
|
<div className="section__actions">
|
|
|
|
<Button
|
|
|
|
button="primary"
|
|
|
|
icon={ICONS.REWARDS}
|
|
|
|
label={__('Earn Rewards')}
|
|
|
|
navigate={`/$/${PAGES.REWARDS}`}
|
|
|
|
/>
|
|
|
|
<Button button="secondary" icon={ICONS.BUY} label={__('Buy Credits')} navigate={`/$/${PAGES.BUY}`} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
/>
|
2020-08-25 21:54:06 +02:00
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
|
|
|
|
<ChannelEdit disabled={emptyBalance} onDone={() => push(redirectUrl || `/$/${PAGES.CHANNELS}`)} />
|
2020-06-29 21:54:07 +02:00
|
|
|
</Page>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-08-25 21:54:06 +02:00
|
|
|
export default ChannelNew;
|