Fix schedule options. Again.

This commit is contained in:
Raphael Wickihalder 2022-07-11 20:16:56 +02:00
parent ad8fc035bb
commit 62f90ae93e
No known key found for this signature in database
GPG key ID: 05179BB92383243D
2 changed files with 11 additions and 4 deletions

View file

@ -148,6 +148,7 @@ function LivestreamForm(props: Props) {
const mode = PUBLISH_MODES.LIVESTREAM;
const [publishMode, setPublishMode] = React.useState('New');
const [replaySource, setReplaySource] = React.useState('keep');
const [isCheckingLivestreams, setCheckingLivestreams] = React.useState(false);
// Used to check if the url name has changed:
@ -519,13 +520,17 @@ function LivestreamForm(props: Props) {
checkLivestreams={fetchLivestreams}
channelId={claimChannelId}
channelName={activeChannelName}
setReplaySource={setReplaySource}
replaySource={replaySource}
/>
<PublishDescription disabled={disabled} />
{!publishing && (
<div className={classnames({ 'card--disabled': disabled })}>
{(publishMode === 'New' || (publishMode === 'Edit' && replaySource === 'keep')) && (
<Card body={<PublishStreamReleaseDate />} />
)}
<Card actions={<SelectThumbnail livestreamData={livestreamData} />} />
@ -562,8 +567,7 @@ function LivestreamForm(props: Props) {
<PublishAdditionalOptions
isLivestream={isLivestreamMode}
disabled={disabled}
// showSchedulingOptions={publishMode === 'New'}
showSchedulingOptions
showSchedulingOptions={publishMode === 'New' || (publishMode === 'Edit' && replaySource)}
/>
</div>
)}

View file

@ -44,6 +44,8 @@ type Props = {
fileSource: string,
changeFileSource: (string) => void,
inEditMode: boolean,
setReplaySource: (string) => void,
replaySource?: string,
};
function PublishLivestream(props: Props) {
@ -67,6 +69,8 @@ function PublishLivestream(props: Props) {
fileSource,
changeFileSource,
inEditMode,
setReplaySource,
replaySource,
} = props;
const livestreamDataStr = JSON.stringify(livestreamData);
@ -75,7 +79,6 @@ function PublishLivestream(props: Props) {
const [selectedFileIndex, setSelectedFileIndex] = useState(null);
const PAGE_SIZE = 4;
const [currentPage, setCurrentPage] = useState(1);
const [replaySource, setReplaySource] = useState('keep');
const totalPages =
hasLivestreamData && livestreamData.length > PAGE_SIZE ? Math.ceil(livestreamData.length / PAGE_SIZE) : 1;