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

View file

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