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

41 lines
1.4 KiB
React
Raw Normal View History

2020-06-29 21:54:07 +02:00
// @flow
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';
import * as PAGES from 'constants/pages';
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-25 21:54:06 +02:00
<Page noSideNavigation noFooter backout={{ title: __('Create A Channel'), backLabel: __('Cancel') }}>
{emptyBalance && (
<div className="main--contained">
<div className="notice-message--above-content">
<h1 className="section__title">You need LBC for this</h1>
<h1 className="section__subtitle">Get sum coinz</h1>
<div className="section__actions">
<Button button="primary" label={__('Earn Rewards')} navigate={`/$/${PAGES.REWARDS}`} />
<Button button="primary" label={__('Purchase LBC')} navigate={`/$/${PAGES.BUY}`} />
</div>
</div>
</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;