fix publish something empty

This commit is contained in:
zeppi 2021-03-25 02:48:29 -04:00 committed by Sean Yesmunt
parent f5125b25c2
commit eea3497845
2 changed files with 25 additions and 2 deletions

View file

@ -1,3 +1,4 @@
import * as PAGES from 'constants/pages';
import { DOMAIN } from 'config';
import { connect } from 'react-redux';
import { PAGE_SIZE } from 'constants/claim';
@ -11,7 +12,10 @@ import {
makeSelectClaimIsMine,
makeSelectClaimIsPending,
makeSelectClaimIsStreamPlaceholder,
doClearPublish,
doPrepareEdit,
} from 'lbry-redux';
import { push } from 'connected-react-router';
import { makeSelectChannelInSubscriptions } from 'redux/selectors/subscriptions';
import { selectBlackListedOutpoints } from 'lbryinc';
import ShowPage from './view';
@ -67,6 +71,11 @@ const select = (state, props) => {
const perform = (dispatch) => ({
resolveUri: (uri) => dispatch(doResolveUri(uri)),
beginPublish: (name) => {
dispatch(doClearPublish());
dispatch(doPrepareEdit({ name }));
dispatch(push(`/$/${PAGES.UPLOAD}`));
},
});
export default connect(select, perform)(ShowPage);

View file

@ -10,7 +10,9 @@ import Page from 'component/page';
import Button from 'component/button';
import Card from 'component/common/card';
import AbandonedChannelPreview from 'component/abandonedChannelPreview';
import Yrbl from 'component/yrbl';
import { formatLbryUrlForWeb } from 'util/url';
import { parseURI } from 'lbry-redux';
type Props = {
isResolvingUri: boolean,
@ -27,6 +29,7 @@ type Props = {
claimIsMine: boolean,
claimIsPending: boolean,
isLivestream: boolean,
beginPublish: (string) => void,
};
function ShowPage(props: Props) {
@ -41,6 +44,7 @@ function ShowPage(props: Props) {
isSubscribed,
claimIsPending,
isLivestream,
beginPublish,
} = props;
const signingChannel = claim && claim.signing_channel;
@ -48,6 +52,7 @@ function ShowPage(props: Props) {
const claimExists = claim !== null && claim !== undefined;
const haventFetchedYet = claim === undefined;
const isMine = claim && claim.is_my_output;
const { contentName } = parseURI(uri);
useEffect(() => {
// @if TARGET='web'
@ -84,11 +89,20 @@ function ShowPage(props: Props) {
<Page>
{(claim === undefined || isResolvingUri) && (
<div className="main--empty">
<Spinner />
<Spinner delayed />
</div>
)}
{!isResolvingUri && !isSubscribed && (
<span className="empty">{__("There's nothing available at this location.")}</span>
<div className="main--empty">
<Yrbl
title={__('No Content Found')}
subtitle={
<div className="section__actions">
<Button button="primary" label={__('Publish Something')} onClick={() => beginPublish(contentName)} />
</div>
}
/>
</div>
)}
{!isResolvingUri && isSubscribed && claim === null && <AbandonedChannelPreview uri={uri} type={'large'} />}
</Page>