[feat] Add LiveStreaming Support #5691
2 changed files with 23 additions and 11 deletions
|
@ -1,16 +1,23 @@
|
||||||
import * as PAGES from 'constants/pages';
|
import * as PAGES from 'constants/pages';
|
||||||
import { connect } from 'react-redux';
|
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 { push } from 'connected-react-router';
|
||||||
import ClaimPreviewSubtitle from './view';
|
import ClaimPreviewSubtitle from './view';
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
claim: makeSelectClaimForUri(props.uri)(state),
|
claim: makeSelectClaimForUri(props.uri)(state),
|
||||||
pending: makeSelectClaimIsPending(props.uri)(state),
|
pending: makeSelectClaimIsPending(props.uri)(state),
|
||||||
|
isLivestream: !makeSelectClaimHasSource(props.uri)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = (dispatch) => ({
|
||||||
beginPublish: name => {
|
beginPublish: (name) => {
|
||||||
dispatch(doClearPublish());
|
dispatch(doClearPublish());
|
||||||
dispatch(doPrepareEdit({ name }));
|
dispatch(doPrepareEdit({ name }));
|
||||||
dispatch(push(`/$/${PAGES.UPLOAD}`));
|
dispatch(push(`/$/${PAGES.UPLOAD}`));
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
import { ENABLE_NO_SOURCE_CLAIMS } from 'config';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import UriIndicator from 'component/uriIndicator';
|
import UriIndicator from 'component/uriIndicator';
|
||||||
import DateTime from 'component/dateTime';
|
import DateTime from 'component/dateTime';
|
||||||
|
@ -11,10 +12,11 @@ type Props = {
|
||||||
pending?: boolean,
|
pending?: boolean,
|
||||||
type: string,
|
type: string,
|
||||||
beginPublish: (string) => void,
|
beginPublish: (string) => void,
|
||||||
|
isLivestream: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
function ClaimPreviewSubtitle(props: Props) {
|
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;
|
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
|
||||||
|
|
||||||
let isChannel;
|
let isChannel;
|
||||||
|
@ -28,13 +30,16 @@ function ClaimPreviewSubtitle(props: Props) {
|
||||||
{claim ? (
|
{claim ? (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<UriIndicator uri={uri} link />{' '}
|
<UriIndicator uri={uri} link />{' '}
|
||||||
{!pending &&
|
{!pending && claim && (
|
||||||
claim &&
|
<>
|
||||||
(isChannel ? (
|
{isChannel &&
|
||||||
type !== 'inline' && `${claimsInChannel} ${claimsInChannel === 1 ? __('upload') : __('uploads')}`
|
type !== 'inline' &&
|
||||||
) : (
|
`${claimsInChannel} ${claimsInChannel === 1 ? __('upload') : __('uploads')}`}
|
||||||
<DateTime timeAgo uri={uri} />
|
|
||||||
))}
|
{!isChannel &&
|
||||||
|
(isLivestream && ENABLE_NO_SOURCE_CLAIMS ? __('Livestream') : <DateTime timeAgo uri={uri} />)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
) : (
|
) : (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
|
Loading…
Reference in a new issue