[feat] Add LiveStreaming Support #5691

Merged
neb-b merged 35 commits from feat/go-live into master 2021-03-23 00:48:10 +01:00
2 changed files with 23 additions and 11 deletions
Showing only changes of commit 204f24354f - Show all commits

View file

@ -1,16 +1,23 @@
import * as PAGES from 'constants/pages';
import { connect } from 'react-redux';
import { makeSelectClaimForUri, makeSelectClaimIsPending, doClearPublish, doPrepareEdit } from 'lbry-redux';
import {
makeSelectClaimForUri,
makeSelectClaimIsPending,
doClearPublish,
doPrepareEdit,
makeSelectClaimHasSource,
} from 'lbry-redux';
import { push } from 'connected-react-router';
import ClaimPreviewSubtitle from './view';
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
pending: makeSelectClaimIsPending(props.uri)(state),
isLivestream: !makeSelectClaimHasSource(props.uri)(state),
});
const perform = dispatch => ({
beginPublish: name => {
const perform = (dispatch) => ({
beginPublish: (name) => {
dispatch(doClearPublish());
dispatch(doPrepareEdit({ name }));
dispatch(push(`/$/${PAGES.UPLOAD}`));

View file

@ -1,4 +1,5 @@
// @flow
import { ENABLE_NO_SOURCE_CLAIMS } from 'config';
import React from 'react';
import UriIndicator from 'component/uriIndicator';
import DateTime from 'component/dateTime';
@ -11,10 +12,11 @@ type Props = {
pending?: boolean,
type: string,
beginPublish: (string) => void,
isLivestream: boolean,
};
function ClaimPreviewSubtitle(props: Props) {
const { pending, uri, claim, type, beginPublish } = props;
const { pending, uri, claim, type, beginPublish, isLivestream } = props;
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
let isChannel;
@ -28,13 +30,16 @@ function ClaimPreviewSubtitle(props: Props) {
{claim ? (
<React.Fragment>
<UriIndicator uri={uri} link />{' '}
{!pending &&
claim &&
(isChannel ? (
type !== 'inline' && `${claimsInChannel} ${claimsInChannel === 1 ? __('upload') : __('uploads')}`
) : (
<DateTime timeAgo uri={uri} />
))}
{!pending && claim && (
<>
{isChannel &&
type !== 'inline' &&
`${claimsInChannel} ${claimsInChannel === 1 ? __('upload') : __('uploads')}`}
{!isChannel &&
(isLivestream && ENABLE_NO_SOURCE_CLAIMS ? __('Livestream') : <DateTime timeAgo uri={uri} />)}
</>
)}
</React.Fragment>
) : (
<React.Fragment>