Update publish form when editing livestream + update to radios for liveststream release time

This commit is contained in:
Dan Peterson 2021-12-22 15:45:47 -06:00 committed by Thomas Zarebczan
parent d4866b09bb
commit 7671d12e42
3 changed files with 12 additions and 16 deletions

View file

@ -114,7 +114,7 @@ function PublishFile(props: Props) {
const fileSelectorModes = [
{ label: __('Upload'), actionName: SOURCE_UPLOAD, icon: ICONS.PUBLISH },
{ label: __('Choose Replay'), actionName: SOURCE_SELECT, icon: ICONS.MENU },
{ label: __('None'), actionName: SOURCE_NONE },
{ label: isLivestreamClaim ? __('Edit / Update') : __('None'), actionName: SOURCE_NONE },
];
const livestreamDataStr = JSON.stringify(livestreamData);
@ -144,10 +144,7 @@ function PublishFile(props: Props) {
// set default file source to select if necessary
useEffect(() => {
if (hasLivestreamData && isLivestreamClaim) {
setWaitForFile(true);
setFileSelectSource(SOURCE_SELECT);
} else if (isLivestreamClaim) {
if (isLivestreamClaim) {
setFileSelectSource(SOURCE_NONE);
}
}, [hasLivestreamData, isLivestreamClaim, setFileSelectSource]);
@ -437,7 +434,7 @@ function PublishFile(props: Props) {
updatePublishForm(publishFormParams);
}
const showFileUpload = mode === PUBLISH_MODES.FILE;
const showFileUpload = mode === PUBLISH_MODES.FILE || PUBLISH_MODES.LIVESTREAM;
const isPublishPost = mode === PUBLISH_MODES.POST;
return (

View file

@ -173,7 +173,8 @@ function PublishForm(props: Props) {
[PUBLISH_MODES.LIVESTREAM]: 'Livestream --[noun, livestream tab button]--',
};
const [mode, setMode] = React.useState(_uploadType || PUBLISH_MODES.FILE);
const defaultPublishMode = isLivestreamClaim ? PUBLISH_MODES.LIVESTREAM : PUBLISH_MODES.FILE;
const [mode, setMode] = React.useState(_uploadType || defaultPublishMode);
const [isCheckingLivestreams, setCheckingLivestreams] = React.useState(false);
let customSubtitle;
@ -422,9 +423,8 @@ function PublishForm(props: Props) {
// set mode based on urlParams 'type'
useEffect(() => {
// Default to standard file publish if none specified
if (!_uploadType) {
setMode(PUBLISH_MODES.FILE);
setMode(defaultPublishMode);
return;
}
@ -448,9 +448,8 @@ function PublishForm(props: Props) {
return;
}
// Default to standard file publish
setMode(PUBLISH_MODES.FILE);
}, [_uploadType, enableLivestream]);
setMode(defaultPublishMode);
}, [_uploadType, enableLivestream, defaultPublishMode]);
// if we have a type urlparam, update it? necessary?
useEffect(() => {

View file

@ -59,8 +59,8 @@ const PublishStreamReleaseDate = (props: Props) => {
<div className={'w-full flex flex-col mt-s md:mt-0 md:h-12 md:items-center md:flex-row'}>
<FormField
type="checkbox"
name="rightNow"
type="radio"
name="anytime"
disabled={false}
onChange={handleToggle}
checked={!publishLater}
@ -69,8 +69,8 @@ const PublishStreamReleaseDate = (props: Props) => {
<div className={'md:ml-m mt-s md:mt-0'}>
<FormField
type="checkbox"
name="rightNow"
type="radio"
name="scheduled_time"
disabled={false}
onChange={handleToggle}
checked={publishLater}