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

View file

@ -10,7 +10,9 @@ import Page from 'component/page';
import Button from 'component/button'; import Button from 'component/button';
import Card from 'component/common/card'; import Card from 'component/common/card';
import AbandonedChannelPreview from 'component/abandonedChannelPreview'; import AbandonedChannelPreview from 'component/abandonedChannelPreview';
import Yrbl from 'component/yrbl';
import { formatLbryUrlForWeb } from 'util/url'; import { formatLbryUrlForWeb } from 'util/url';
import { parseURI } from 'lbry-redux';
type Props = { type Props = {
isResolvingUri: boolean, isResolvingUri: boolean,
@ -27,6 +29,7 @@ type Props = {
claimIsMine: boolean, claimIsMine: boolean,
claimIsPending: boolean, claimIsPending: boolean,
isLivestream: boolean, isLivestream: boolean,
beginPublish: (string) => void,
}; };
function ShowPage(props: Props) { function ShowPage(props: Props) {
@ -41,6 +44,7 @@ function ShowPage(props: Props) {
isSubscribed, isSubscribed,
claimIsPending, claimIsPending,
isLivestream, isLivestream,
beginPublish,
} = props; } = props;
const signingChannel = claim && claim.signing_channel; const signingChannel = claim && claim.signing_channel;
@ -48,6 +52,7 @@ function ShowPage(props: Props) {
const claimExists = claim !== null && claim !== undefined; const claimExists = claim !== null && claim !== undefined;
const haventFetchedYet = claim === undefined; const haventFetchedYet = claim === undefined;
const isMine = claim && claim.is_my_output; const isMine = claim && claim.is_my_output;
const { contentName } = parseURI(uri);
useEffect(() => { useEffect(() => {
// @if TARGET='web' // @if TARGET='web'
@ -84,11 +89,20 @@ function ShowPage(props: Props) {
<Page> <Page>
{(claim === undefined || isResolvingUri) && ( {(claim === undefined || isResolvingUri) && (
<div className="main--empty"> <div className="main--empty">
<Spinner /> <Spinner delayed />
</div> </div>
)} )}
{!isResolvingUri && !isSubscribed && ( {!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'} />} {!isResolvingUri && isSubscribed && claim === null && <AbandonedChannelPreview uri={uri} type={'large'} />}
</Page> </Page>