livestream related publish fixes
This commit is contained in:
parent
0653dbde04
commit
9b82f57006
7 changed files with 155 additions and 44 deletions
|
@ -112,17 +112,17 @@ function PublishFile(props: Props) {
|
||||||
);
|
);
|
||||||
|
|
||||||
const fileSelectorModes = [
|
const fileSelectorModes = [
|
||||||
{ label: __('Choose Replay'), actionName: SOURCE_SELECT, icon: ICONS.MENU },
|
|
||||||
{ label: __('Upload'), actionName: SOURCE_UPLOAD, icon: ICONS.PUBLISH },
|
{ label: __('Upload'), actionName: SOURCE_UPLOAD, icon: ICONS.PUBLISH },
|
||||||
|
{ label: __('Choose Replay'), actionName: SOURCE_SELECT, icon: ICONS.MENU },
|
||||||
{ label: __('None'), actionName: SOURCE_NONE },
|
{ label: __('None'), actionName: SOURCE_NONE },
|
||||||
];
|
];
|
||||||
|
|
||||||
const livestreamDataStr = JSON.stringify(livestreamData);
|
const livestreamDataStr = JSON.stringify(livestreamData);
|
||||||
const hasLivestreamData = livestreamData && Boolean(livestreamData.length);
|
const hasLivestreamData = livestreamData && Boolean(livestreamData.length);
|
||||||
const showSourceSelector = isLivestreamClaim;
|
const showSourceSelector = isLivestreamClaim || (hasLivestreamData && mode === PUBLISH_MODES.FILE);
|
||||||
|
|
||||||
const [fileSelectSource, setFileSelectSource] = useState(
|
const [fileSelectSource, setFileSelectSource] = useState(
|
||||||
IS_WEB && showSourceSelector ? SOURCE_SELECT : SOURCE_UPLOAD
|
IS_WEB && showSourceSelector && name ? SOURCE_SELECT : SOURCE_UPLOAD
|
||||||
);
|
);
|
||||||
// const [showFileUpdate, setShowFileUpdate] = useState(false);
|
// const [showFileUpdate, setShowFileUpdate] = useState(false);
|
||||||
const [selectedFileIndex, setSelectedFileIndex] = useState(null);
|
const [selectedFileIndex, setSelectedFileIndex] = useState(null);
|
||||||
|
@ -437,7 +437,7 @@ function PublishFile(props: Props) {
|
||||||
updatePublishForm(publishFormParams);
|
updatePublishForm(publishFormParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
const showFileUpload = mode === PUBLISH_MODES.FILE || (mode === PUBLISH_MODES.LIVESTREAM && hasLivestreamData);
|
const showFileUpload = mode === PUBLISH_MODES.FILE;
|
||||||
const isPublishPost = mode === PUBLISH_MODES.POST;
|
const isPublishPost = mode === PUBLISH_MODES.POST;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -474,7 +474,7 @@ function PublishFile(props: Props) {
|
||||||
<fieldset-section>
|
<fieldset-section>
|
||||||
<div className="section__actions--between section__actions--align-bottom">
|
<div className="section__actions--between section__actions--align-bottom">
|
||||||
<div>
|
<div>
|
||||||
<label>{__('Add replay video')}</label>
|
<label>{__('Replay video available')}</label>
|
||||||
<div className="button-group">
|
<div className="button-group">
|
||||||
{fileSelectorModes.map((fmode) => (
|
{fileSelectorModes.map((fmode) => (
|
||||||
<Button
|
<Button
|
||||||
|
|
|
@ -130,6 +130,7 @@ function PublishForm(props: Props) {
|
||||||
const urlParams = new URLSearchParams(location.search);
|
const urlParams = new URLSearchParams(location.search);
|
||||||
const TYPE_PARAM = 'type';
|
const TYPE_PARAM = 'type';
|
||||||
const uploadType = urlParams.get(TYPE_PARAM);
|
const uploadType = urlParams.get(TYPE_PARAM);
|
||||||
|
const _uploadType = uploadType && uploadType.toLowerCase();
|
||||||
const enableLivestream =
|
const enableLivestream =
|
||||||
ENABLE_NO_SOURCE_CLAIMS &&
|
ENABLE_NO_SOURCE_CLAIMS &&
|
||||||
user &&
|
user &&
|
||||||
|
@ -137,6 +138,7 @@ function PublishForm(props: Props) {
|
||||||
(activeChannelStakedLevel >= CHANNEL_STAKED_LEVEL_LIVESTREAM || user.odysee_live_enabled);
|
(activeChannelStakedLevel >= CHANNEL_STAKED_LEVEL_LIVESTREAM || user.odysee_live_enabled);
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
const AVAILABLE_MODES = Object.values(PUBLISH_MODES).filter((mode) => {
|
const AVAILABLE_MODES = Object.values(PUBLISH_MODES).filter((mode) => {
|
||||||
|
// $FlowFixMe
|
||||||
if (editingURI) {
|
if (editingURI) {
|
||||||
if (isPostClaim) {
|
if (isPostClaim) {
|
||||||
return mode === PUBLISH_MODES.POST;
|
return mode === PUBLISH_MODES.POST;
|
||||||
|
@ -145,11 +147,10 @@ function PublishForm(props: Props) {
|
||||||
} else {
|
} else {
|
||||||
return mode === PUBLISH_MODES.FILE;
|
return mode === PUBLISH_MODES.FILE;
|
||||||
}
|
}
|
||||||
|
} else if (_uploadType) {
|
||||||
|
return mode === _uploadType && (mode !== PUBLISH_MODES.LIVESTREAM || enableLivestream);
|
||||||
} else {
|
} else {
|
||||||
if (mode === PUBLISH_MODES.LIVESTREAM) {
|
return mode !== PUBLISH_MODES.LIVESTREAM || enableLivestream;
|
||||||
return enableLivestream;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -159,7 +160,7 @@ function PublishForm(props: Props) {
|
||||||
[PUBLISH_MODES.LIVESTREAM]: 'Livestream --[noun, livestream tab button]--',
|
[PUBLISH_MODES.LIVESTREAM]: 'Livestream --[noun, livestream tab button]--',
|
||||||
};
|
};
|
||||||
|
|
||||||
const [mode, setMode] = React.useState(uploadType || PUBLISH_MODES.FILE);
|
const [mode, setMode] = React.useState(_uploadType || PUBLISH_MODES.FILE);
|
||||||
const [isCheckingLivestreams, setCheckingLivestreams] = React.useState(false);
|
const [isCheckingLivestreams, setCheckingLivestreams] = React.useState(false);
|
||||||
|
|
||||||
let customSubtitle;
|
let customSubtitle;
|
||||||
|
@ -208,7 +209,9 @@ function PublishForm(props: Props) {
|
||||||
myClaimForUri && myClaimForUri.value && myClaimForUri.value.source
|
myClaimForUri && myClaimForUri.value && myClaimForUri.value.source
|
||||||
? myClaimForUri.value.source.media_type
|
? myClaimForUri.value.source.media_type
|
||||||
: undefined;
|
: undefined;
|
||||||
const claimChannelId = myClaimForUri && myClaimForUri.signing_channel && myClaimForUri.signing_channel.claim_id;
|
const claimChannelId =
|
||||||
|
(myClaimForUri && myClaimForUri.signing_channel && myClaimForUri.signing_channel.claim_id) ||
|
||||||
|
(activeChannelClaim && activeChannelClaim.claim_id);
|
||||||
|
|
||||||
const nameEdited = isStillEditing && name !== prevName;
|
const nameEdited = isStillEditing && name !== prevName;
|
||||||
|
|
||||||
|
@ -283,10 +286,10 @@ function PublishForm(props: Props) {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const signedMessage = JSON.parse(signedMessageStr);
|
const signedMessage = JSON.parse(signedMessageStr);
|
||||||
if (claimChannelId && isLivestreamClaim && signedMessage.signature) {
|
if (claimChannelId && signedMessage.signature) {
|
||||||
fetchLivestreams(claimChannelId, signedMessage.signature, signedMessage.signing_ts);
|
fetchLivestreams(claimChannelId, signedMessage.signature, signedMessage.signing_ts);
|
||||||
}
|
}
|
||||||
}, [claimChannelId, isLivestreamClaim, signedMessageStr]);
|
}, [claimChannelId, signedMessageStr]);
|
||||||
|
|
||||||
const isLivestreamMode = mode === PUBLISH_MODES.LIVESTREAM;
|
const isLivestreamMode = mode === PUBLISH_MODES.LIVESTREAM;
|
||||||
let submitLabel;
|
let submitLabel;
|
||||||
|
@ -395,8 +398,6 @@ function PublishForm(props: Props) {
|
||||||
|
|
||||||
// set mode based on urlParams 'type'
|
// set mode based on urlParams 'type'
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const _uploadType = uploadType && uploadType.toLowerCase();
|
|
||||||
|
|
||||||
// Default to standard file publish if none specified
|
// Default to standard file publish if none specified
|
||||||
if (!_uploadType) {
|
if (!_uploadType) {
|
||||||
setMode(PUBLISH_MODES.FILE);
|
setMode(PUBLISH_MODES.FILE);
|
||||||
|
@ -425,15 +426,15 @@ function PublishForm(props: Props) {
|
||||||
|
|
||||||
// Default to standard file publish
|
// Default to standard file publish
|
||||||
setMode(PUBLISH_MODES.FILE);
|
setMode(PUBLISH_MODES.FILE);
|
||||||
}, [uploadType, enableLivestream]);
|
}, [_uploadType, enableLivestream]);
|
||||||
|
|
||||||
// if we have a type urlparam, update it? necessary?
|
// if we have a type urlparam, update it? necessary?
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!uploadType) return;
|
if (!_uploadType) return;
|
||||||
const newParams = new URLSearchParams();
|
const newParams = new URLSearchParams();
|
||||||
newParams.set(TYPE_PARAM, mode.toLowerCase());
|
newParams.set(TYPE_PARAM, mode.toLowerCase());
|
||||||
replace({ search: newParams.toString() });
|
replace({ search: newParams.toString() });
|
||||||
}, [mode, uploadType]);
|
}, [mode, _uploadType]);
|
||||||
|
|
||||||
// @if TARGET='web'
|
// @if TARGET='web'
|
||||||
function createWebFile() {
|
function createWebFile() {
|
||||||
|
@ -575,7 +576,7 @@ function PublishForm(props: Props) {
|
||||||
|
|
||||||
{!publishing && (
|
{!publishing && (
|
||||||
<div className={classnames({ 'card--disabled': formDisabled })}>
|
<div className={classnames({ 'card--disabled': formDisabled })}>
|
||||||
{mode === PUBLISH_MODES.FILE && <PublishDescription disabled={formDisabled} />}
|
{mode !== PUBLISH_MODES.POST && <PublishDescription disabled={formDisabled} />}
|
||||||
<Card actions={<SelectThumbnail livestreamdData={livestreamData} />} />
|
<Card actions={<SelectThumbnail livestreamdData={livestreamData} />} />
|
||||||
<TagsSelect
|
<TagsSelect
|
||||||
suggestMature={!SIMPLE_SITE}
|
suggestMature={!SIMPLE_SITE}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
export const FILE = 'File';
|
export const FILE = 'file';
|
||||||
export const POST = 'Post';
|
export const POST = 'post';
|
||||||
export const LIVESTREAM = 'Livestream';
|
export const LIVESTREAM = 'livestream';
|
||||||
|
|
|
@ -81,7 +81,7 @@ function HomePage(props: Props) {
|
||||||
)}
|
)}
|
||||||
{rowData.map(({ title, route, link, icon, help, options = {} }, index) => (
|
{rowData.map(({ title, route, link, icon, help, options = {} }, index) => (
|
||||||
<div key={title} className="claim-grid__wrapper">
|
<div key={title} className="claim-grid__wrapper">
|
||||||
{title && (
|
{index !== 0 && title && typeof title === 'string' && (
|
||||||
<h1 className="claim-grid__header">
|
<h1 className="claim-grid__header">
|
||||||
<Button navigate={route || link} button="link">
|
<Button navigate={route || link} button="link">
|
||||||
{icon && <Icon className="claim-grid__header-icon" sectionIcon icon={icon} size={20} />}
|
{icon && <Icon className="claim-grid__header-icon" sectionIcon icon={icon} size={20} />}
|
||||||
|
@ -92,7 +92,7 @@ function HomePage(props: Props) {
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<ClaimTilesDiscover {...options} />
|
<ClaimTilesDiscover {...options} />
|
||||||
{link && (
|
{(route || link) && (
|
||||||
<Button
|
<Button
|
||||||
className="claim-grid__title--secondary"
|
className="claim-grid__title--secondary"
|
||||||
button="link"
|
button="link"
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { selectMyChannelClaims, selectFetchingMyChannels, selectPendingClaims } from 'lbry-redux';
|
import { selectMyChannelClaims, selectFetchingMyChannels, selectPendingClaims, doClearPublish } from 'lbry-redux';
|
||||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||||
import LivestreamSetupPage from './view';
|
import LivestreamSetupPage from './view';
|
||||||
|
import { push } from 'connected-react-router';
|
||||||
|
|
||||||
const select = (state) => ({
|
const select = (state) => ({
|
||||||
channels: selectMyChannelClaims(state),
|
channels: selectMyChannelClaims(state),
|
||||||
|
@ -9,5 +10,10 @@ const select = (state) => ({
|
||||||
activeChannelClaim: selectActiveChannelClaim(state),
|
activeChannelClaim: selectActiveChannelClaim(state),
|
||||||
pendingClaims: selectPendingClaims(state),
|
pendingClaims: selectPendingClaims(state),
|
||||||
});
|
});
|
||||||
|
const perform = (dispatch) => ({
|
||||||
export default connect(select)(LivestreamSetupPage);
|
doNewLivestream: (path) => {
|
||||||
|
dispatch(doClearPublish());
|
||||||
|
dispatch(push(path));
|
||||||
|
},
|
||||||
|
});
|
||||||
|
export default connect(select, perform)(LivestreamSetupPage);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import * as PAGES from 'constants/pages';
|
import * as PAGES from 'constants/pages';
|
||||||
import * as ICONS from 'constants/icons';
|
import * as ICONS from 'constants/icons';
|
||||||
import * as PUBLISH_MODES from 'constants/publish_types';
|
import * as PUBLISH_MODES from 'constants/publish_types';
|
||||||
|
import I18nMessage from 'component/i18nMessage';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Page from 'component/page';
|
import Page from 'component/page';
|
||||||
import Spinner from 'component/spinner';
|
import Spinner from 'component/spinner';
|
||||||
|
@ -15,17 +16,19 @@ import CopyableText from 'component/copyableText';
|
||||||
import Card from 'component/common/card';
|
import Card from 'component/common/card';
|
||||||
import ClaimList from 'component/claimList';
|
import ClaimList from 'component/claimList';
|
||||||
import usePersistedState from 'effects/use-persisted-state';
|
import usePersistedState from 'effects/use-persisted-state';
|
||||||
|
import usePrevious from 'effects/use-previous';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
channels: Array<ChannelClaim>,
|
channels: Array<ChannelClaim>,
|
||||||
fetchingChannels: boolean,
|
fetchingChannels: boolean,
|
||||||
activeChannelClaim: ?ChannelClaim,
|
activeChannelClaim: ?ChannelClaim,
|
||||||
pendingClaims: Array<Claim>,
|
pendingClaims: Array<Claim>,
|
||||||
|
doNewLivestream: (string) => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function LivestreamSetupPage(props: Props) {
|
export default function LivestreamSetupPage(props: Props) {
|
||||||
const LIVESTREAM_CLAIM_POLL_IN_MS = 60000;
|
const LIVESTREAM_CLAIM_POLL_IN_MS = 60000;
|
||||||
const { channels, fetchingChannels, activeChannelClaim, pendingClaims } = props;
|
const { channels, fetchingChannels, activeChannelClaim, pendingClaims, doNewLivestream } = props;
|
||||||
|
|
||||||
const [sigData, setSigData] = React.useState({ signature: undefined, signing_ts: undefined });
|
const [sigData, setSigData] = React.useState({ signature: undefined, signing_ts: undefined });
|
||||||
const [showHelpTest, setShowHelpTest] = usePersistedState('livestream-help-seen', true);
|
const [showHelpTest, setShowHelpTest] = usePersistedState('livestream-help-seen', true);
|
||||||
|
@ -50,8 +53,18 @@ export default function LivestreamSetupPage(props: Props) {
|
||||||
claim.value_type === 'stream' && !(claim.value && claim.value.source)
|
claim.value_type === 'stream' && !(claim.value && claim.value.source)
|
||||||
)
|
)
|
||||||
: [];
|
: [];
|
||||||
|
const [localPending, setLocalPending] = React.useState([]); //
|
||||||
|
const localPendingStr = JSON.stringify(localPending);
|
||||||
|
const pendingLivestreamClaimsStr = JSON.stringify(pendingLiveStreamClaims);
|
||||||
|
const prevPendingLiveStreamClaimStr = usePrevious(pendingLivestreamClaimsStr);
|
||||||
|
const liveStreamClaimsStr = JSON.stringify(livestreamClaims);
|
||||||
|
const prevLiveStreamClaimsStr = JSON.stringify(liveStreamClaimsStr);
|
||||||
const pendingLength = pendingLiveStreamClaims.length;
|
const pendingLength = pendingLiveStreamClaims.length;
|
||||||
const totalLivestreamClaims = pendingLiveStreamClaims.concat(livestreamClaims);
|
const totalLivestreamClaims = pendingLiveStreamClaims.concat(livestreamClaims);
|
||||||
|
const activeChannelId = activeChannelClaim && activeChannelClaim.claim_id;
|
||||||
|
const localPendingForChannel = localPending.filter(
|
||||||
|
(claim) => claim.signing_channel && claim.signing_channel.claim_id === activeChannelId
|
||||||
|
);
|
||||||
const helpText = (
|
const helpText = (
|
||||||
<div className="section__subtitle">
|
<div className="section__subtitle">
|
||||||
<p>
|
<p>
|
||||||
|
@ -110,16 +123,53 @@ export default function LivestreamSetupPage(props: Props) {
|
||||||
}
|
}
|
||||||
}, [activeChannelClaimStr, setSigData]);
|
}, [activeChannelClaimStr, setSigData]);
|
||||||
|
|
||||||
|
// The following 2 effects handle the time between pending disappearing and claim_search being able to find it.
|
||||||
|
// We'll maintain our own pending list:
|
||||||
|
// add to it when there are new things in pending
|
||||||
|
// remove items only when our claim_search finds it
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
let checkClaimsInterval;
|
// add to localPending when pending changes
|
||||||
if (!activeChannelClaimStr) return;
|
const localPending = JSON.parse(localPendingStr);
|
||||||
const channelClaim = JSON.parse(activeChannelClaimStr);
|
const pendingLivestreamClaims = JSON.parse(pendingLivestreamClaimsStr);
|
||||||
|
if (
|
||||||
|
pendingLiveStreamClaims !== prevPendingLiveStreamClaimStr ||
|
||||||
|
(pendingLivestreamClaims.length && !localPending.length)
|
||||||
|
) {
|
||||||
|
const prevPendingLivestreamClaims = prevPendingLiveStreamClaimStr
|
||||||
|
? JSON.parse(prevPendingLiveStreamClaimStr)
|
||||||
|
: [];
|
||||||
|
const pendingClaimIds = pendingLivestreamClaims.map((claim) => claim.claim_id);
|
||||||
|
const prevPendingClaimIds = prevPendingLivestreamClaims.map((claim) => claim.claim_id);
|
||||||
|
const newLocalPending = [];
|
||||||
|
if (pendingClaimIds.length > prevPendingClaimIds.length) {
|
||||||
|
pendingLivestreamClaims.forEach((pendingClaim) => {
|
||||||
|
if (!localPending.some((lClaim) => lClaim.claim_id === pendingClaim.claim_id)) {
|
||||||
|
newLocalPending.push(pendingClaim);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setLocalPending(localPending.concat(newLocalPending));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [pendingLivestreamClaimsStr, prevPendingLiveStreamClaimStr, localPendingStr, setLocalPending]);
|
||||||
|
|
||||||
function checkLivestreamClaims() {
|
React.useEffect(() => {
|
||||||
|
// remove from localPending when livestreamClaims found
|
||||||
|
const localPending = JSON.parse(localPendingStr);
|
||||||
|
if (liveStreamClaimsStr !== prevLiveStreamClaimsStr && localPending.length) {
|
||||||
|
const livestreamClaims = JSON.parse(liveStreamClaimsStr);
|
||||||
|
setLocalPending(
|
||||||
|
localPending.filter((pending) => !livestreamClaims.some((claim) => claim.claim_id === pending.claim_id))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, [liveStreamClaimsStr, prevLiveStreamClaimsStr, localPendingStr, setLocalPending]);
|
||||||
|
|
||||||
|
const checkLivestreams = React.useCallback(
|
||||||
|
function checkLivestreamClaims(channelClaimId, setLivestreamClaims, setSpin) {
|
||||||
Lbry.claim_search({
|
Lbry.claim_search({
|
||||||
channel_ids: [channelClaim.claim_id],
|
channel_ids: [channelClaimId],
|
||||||
has_no_source: true,
|
has_no_source: true,
|
||||||
claim_type: ['stream'],
|
claim_type: ['stream'],
|
||||||
|
include_purchase_receipt: true,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res && res.items && res.items.length > 0) {
|
if (res && res.items && res.items.length > 0) {
|
||||||
|
@ -133,17 +183,27 @@ export default function LivestreamSetupPage(props: Props) {
|
||||||
setLivestreamClaims([]);
|
setLivestreamClaims([]);
|
||||||
setSpin(false);
|
setSpin(false);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
[activeChannelId]
|
||||||
|
);
|
||||||
|
React.useEffect(() => {
|
||||||
|
let checkClaimsInterval;
|
||||||
|
if (!activeChannelClaimStr) return;
|
||||||
|
const channelClaim = JSON.parse(activeChannelClaimStr);
|
||||||
|
|
||||||
if (!checkClaimsInterval) {
|
if (!checkClaimsInterval) {
|
||||||
checkLivestreamClaims();
|
checkLivestreams(channelClaim.claim_id, setLivestreamClaims, setSpin);
|
||||||
checkClaimsInterval = setInterval(checkLivestreamClaims, LIVESTREAM_CLAIM_POLL_IN_MS);
|
checkClaimsInterval = setInterval(
|
||||||
|
() => checkLivestreams(channelClaim.claim_id, setLivestreamClaims, setSpin),
|
||||||
|
LIVESTREAM_CLAIM_POLL_IN_MS
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return () => {
|
return () => {
|
||||||
if (checkClaimsInterval) {
|
if (checkClaimsInterval) {
|
||||||
clearInterval(checkClaimsInterval);
|
clearInterval(checkClaimsInterval);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}, [activeChannelClaimStr, pendingLength, setSpin]);
|
}, [activeChannelClaimStr, pendingLength, setSpin, checkLivestreams]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
|
@ -189,6 +249,7 @@ export default function LivestreamSetupPage(props: Props) {
|
||||||
)}
|
)}
|
||||||
{streamKey && totalLivestreamClaims.length > 0 && (
|
{streamKey && totalLivestreamClaims.length > 0 && (
|
||||||
<Card
|
<Card
|
||||||
|
className="section"
|
||||||
title={__('Your stream key')}
|
title={__('Your stream key')}
|
||||||
actions={
|
actions={
|
||||||
<>
|
<>
|
||||||
|
@ -212,22 +273,65 @@ export default function LivestreamSetupPage(props: Props) {
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{totalLivestreamClaims.length > 0 ? (
|
{totalLivestreamClaims.length > 0 ? (
|
||||||
|
<>
|
||||||
|
{Boolean(localPendingForChannel.length) && (
|
||||||
|
<div className="section">
|
||||||
|
<ClaimList
|
||||||
|
header={__('Your pending livestream uploads')}
|
||||||
|
uris={localPendingForChannel.map((claim) => claim.permanent_url)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{Boolean(livestreamClaims.length) && (
|
||||||
|
<div className="section">
|
||||||
<ClaimList
|
<ClaimList
|
||||||
header={__('Your livestream uploads')}
|
header={__('Your livestream uploads')}
|
||||||
uris={totalLivestreamClaims.map((claim) => claim.permanent_url)}
|
empty={
|
||||||
|
<I18nMessage
|
||||||
|
tokens={{
|
||||||
|
check_again: (
|
||||||
|
<Button
|
||||||
|
button="link"
|
||||||
|
onClick={() => checkLivestreams(activeChannelId, setLivestreamClaims, setSpin)}
|
||||||
|
label={__('Check again')}
|
||||||
/>
|
/>
|
||||||
|
),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Nothing here yet. %check_again%
|
||||||
|
</I18nMessage>
|
||||||
|
}
|
||||||
|
uris={livestreamClaims
|
||||||
|
.filter((c) => !pendingLiveStreamClaims.some((p) => p.permanent_url === c.permanent_url))
|
||||||
|
.map((claim) => claim.permanent_url)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Yrbl
|
<Yrbl
|
||||||
className="livestream__publish-intro"
|
className="livestream__publish-intro"
|
||||||
title={__('No livestream publishes found')}
|
title={__('No livestream publishes found')}
|
||||||
subtitle={__('You need to upload your livestream details before you can go live.')}
|
subtitle={__(
|
||||||
|
'You need to upload your livestream details before you can go live. If you already created one in this channel, it should appear soon.'
|
||||||
|
)}
|
||||||
actions={
|
actions={
|
||||||
<div className="section__actions">
|
<div className="section__actions">
|
||||||
<Button
|
<Button
|
||||||
button="primary"
|
button="primary"
|
||||||
navigate={`/$/${PAGES.UPLOAD}?type=${PUBLISH_MODES.LIVESTREAM.toLowerCase()}`}
|
onClick={() =>
|
||||||
|
doNewLivestream(`/$/${PAGES.UPLOAD}?type=${PUBLISH_MODES.LIVESTREAM.toLowerCase()}`)
|
||||||
|
}
|
||||||
label={__('Create A Livestream')}
|
label={__('Create A Livestream')}
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
button="alt"
|
||||||
|
onClick={() => {
|
||||||
|
setSpin(true);
|
||||||
|
checkLivestreams(activeChannelId, setLivestreamClaims, setSpin);
|
||||||
|
}}
|
||||||
|
label={__('Check again...')}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -257,7 +257,7 @@
|
||||||
}
|
}
|
||||||
&:nth-child(n) {
|
&:nth-child(n) {
|
||||||
&.livestream__data-row--selected {
|
&.livestream__data-row--selected {
|
||||||
background-color: var(--color-input-toggle-bg-hover);
|
background-color: var(--color-button-toggle-bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
td {
|
td {
|
||||||
|
|
Loading…
Reference in a new issue