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

49 lines
1 KiB
React
Raw Normal View History

// @flow
import React from 'react';
import PublishForm from 'component/publishForm';
2018-03-26 23:32:43 +02:00
import Page from 'component/page';
import YrblWalletEmpty from 'component/yrblWalletEmpty';
import Spinner from 'component/spinner';
2016-11-22 21:19:08 +01:00
type Props = {
balance: number,
fetchingChannels: boolean,
};
function PublishPage(props: Props) {
const { balance, fetchingChannels } = props;
function scrollToTop() {
const mainContent = document.querySelector('main');
2018-03-26 23:32:43 +02:00
if (mainContent) {
2021-02-01 19:31:15 +01:00
// $FlowFixMe
mainContent.scrollTo({
top: 0,
behavior: 'smooth',
});
2018-03-26 23:32:43 +02:00
}
}
return (
2020-09-16 21:36:01 +02:00
<Page
noFooter
noSideNavigation
backout={{
title: __('Upload'),
backLabel: __('Back'),
}}
>
{balance === 0 && <YrblWalletEmpty />}
{balance !== 0 && fetchingChannels ? (
<div className="main--empty">
<Spinner />
</div>
) : (
<PublishForm scrollToTop={scrollToTop} disabled={balance === 0} />
)}
</Page>
);
2018-03-26 23:32:43 +02:00
}
2017-06-17 19:59:18 +02:00
2016-11-22 21:19:08 +01:00
export default PublishPage;