2020-06-29 21:54:07 +02:00
|
|
|
// @flow
|
2020-08-26 18:24:07 +02:00
|
|
|
import * as PAGES from 'constants/pages';
|
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 { useHistory } from 'react-router';
|
2020-08-26 19:19:03 +02:00
|
|
|
import YrblWalletEmpty from 'component/yrblWalletEmpty';
|
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-26 19:19:03 +02:00
|
|
|
{emptyBalance && <YrblWalletEmpty />}
|
2020-08-25 21:54:06 +02:00
|
|
|
|
2021-03-03 19:50:16 +01:00
|
|
|
<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;
|