Pass the 'mode' over via UpdatePublishForm to hide some fields when Posting a Markdown.

This commit is contained in:
infiinte-persistence 2020-10-01 15:52:52 +08:00 committed by Sean Yesmunt
parent 3df7ea71d3
commit 92b211dd94
3 changed files with 8 additions and 1 deletions

View file

@ -24,6 +24,7 @@ declare type UpdatePublishFormData = {
licenseType?: string,
uri?: string,
nsfw: boolean,
isMarkdownPost: boolean,
};
declare type PublishParams = {

View file

@ -221,6 +221,10 @@ function PublishForm(props: Props) {
}
}, [name, channel, resolveUri, updatePublishForm, checkAvailability]);
useEffect(() => {
updatePublishForm({ isMarkdownPost: mode === PUBLISH_MODES.POST });
}, [mode, updatePublishForm]);
function handleChannelNameChange(channel) {
updatePublishForm({ channel });
}

View file

@ -10,6 +10,7 @@ import { COPYRIGHT, OTHER } from 'constants/licenses';
type Props = {
filePath: string | WebFile,
isMarkdownPost: boolean,
optimize: boolean,
title: ?string,
description: ?string,
@ -73,6 +74,7 @@ class ModalPublishPreview extends React.PureComponent<Props> {
render() {
const {
filePath,
isMarkdownPost,
optimize,
title,
description,
@ -133,7 +135,7 @@ class ModalPublishPreview extends React.PureComponent<Props> {
<div className="section">
<table className="table table--condensed table--publish-preview">
<tbody>
{this.createRow(__('File'), this.resolveFilePathName(filePath))}
{!isMarkdownPost && this.createRow(__('File'), this.resolveFilePathName(filePath))}
{isOptimizeAvail && this.createRow(__('Transcode'), optimize ? __('Yes') : __('No'))}
{this.createRow(__('Title'), title)}
{this.createRow(__('Description'), descriptionValue)}