2019-06-28 09:27:55 +02:00
|
|
|
// @flow
|
2019-04-03 06:17:00 +02:00
|
|
|
import React, { Fragment } from 'react';
|
2017-12-21 22:08:54 +01:00
|
|
|
import PublishForm from 'component/publishForm';
|
2018-03-26 23:32:43 +02:00
|
|
|
import Page from 'component/page';
|
2019-04-03 06:17:00 +02:00
|
|
|
import Yrbl from 'component/yrbl';
|
|
|
|
import LbcSymbol from 'component/common/lbc-symbol';
|
2019-11-13 19:14:19 +01:00
|
|
|
import RewardAuthIntro from 'component/rewardAuthIntro';
|
2020-06-16 11:58:25 +02:00
|
|
|
import usePersistedState from 'effects/use-persisted-state';
|
2016-11-22 21:19:08 +01:00
|
|
|
|
2019-06-28 09:27:55 +02:00
|
|
|
type Props = {
|
|
|
|
balance: number,
|
|
|
|
totalRewardValue: number,
|
|
|
|
};
|
|
|
|
|
|
|
|
function PublishPage(props: Props) {
|
2019-11-13 19:14:19 +01:00
|
|
|
const { balance } = props;
|
2019-06-28 09:27:55 +02:00
|
|
|
|
2020-06-16 11:58:25 +02:00
|
|
|
const [channel, setChannel] = usePersistedState('publish-channel', '');
|
|
|
|
|
2019-06-28 09:27:55 +02:00
|
|
|
function scrollToTop() {
|
2019-04-03 06:17:00 +02:00
|
|
|
const mainContent = document.querySelector('main');
|
2018-03-26 23:32:43 +02:00
|
|
|
if (mainContent) {
|
|
|
|
mainContent.scrollTop = 0; // It would be nice to animate this
|
|
|
|
}
|
|
|
|
}
|
2019-06-28 09:27:55 +02:00
|
|
|
|
2020-06-16 11:58:25 +02:00
|
|
|
function handleChannelChange(channel) {
|
|
|
|
setChannel(channel);
|
|
|
|
}
|
|
|
|
|
2019-06-28 09:27:55 +02:00
|
|
|
return (
|
|
|
|
<Page>
|
2020-04-15 21:32:47 +02:00
|
|
|
{balance === 0 ? (
|
2019-06-28 09:27:55 +02:00
|
|
|
<Fragment>
|
2020-04-15 21:32:47 +02:00
|
|
|
<div className="section">
|
|
|
|
<Yrbl
|
|
|
|
title={__("You can't publish things quite yet")}
|
|
|
|
subtitle={
|
|
|
|
<Fragment>
|
|
|
|
<p>
|
|
|
|
{__(
|
|
|
|
'LBRY uses a blockchain, which is a fancy way of saying that users (you) are in control of your data.'
|
|
|
|
)}
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
{__('Because of the blockchain, some actions require LBRY credits')} (
|
|
|
|
<LbcSymbol />
|
|
|
|
).
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<LbcSymbol />{' '}
|
|
|
|
{__(
|
|
|
|
'allows you to do some neat things, like paying your favorite creators for their content. And no company can stop you.'
|
|
|
|
)}
|
|
|
|
</p>
|
|
|
|
</Fragment>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div className="section">
|
|
|
|
<RewardAuthIntro />
|
|
|
|
</div>
|
2019-06-28 09:27:55 +02:00
|
|
|
</Fragment>
|
2020-04-15 21:32:47 +02:00
|
|
|
) : (
|
2020-06-16 11:58:25 +02:00
|
|
|
<PublishForm
|
|
|
|
scrollToTop={scrollToTop}
|
|
|
|
disabled={balance === 0}
|
|
|
|
channel={channel}
|
|
|
|
onChannelChange={handleChannelChange}
|
|
|
|
/>
|
2019-06-28 09:27:55 +02:00
|
|
|
)}
|
|
|
|
</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;
|