quick fix to add a cancel button on publish
This commit is contained in:
parent
5cc04ca7a6
commit
ea6855df08
4 changed files with 25 additions and 3 deletions
|
@ -5,6 +5,7 @@ import {
|
||||||
makeSelectPublishFormValue,
|
makeSelectPublishFormValue,
|
||||||
doUpdatePublishForm,
|
doUpdatePublishForm,
|
||||||
doToast,
|
doToast,
|
||||||
|
doClearPublish,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import PublishPage from './view';
|
import PublishPage from './view';
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ const select = state => ({
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
|
clearPublish: () => dispatch(doClearPublish()),
|
||||||
updatePublishForm: value => dispatch(doUpdatePublishForm(value)),
|
updatePublishForm: value => dispatch(doUpdatePublishForm(value)),
|
||||||
showToast: message => dispatch(doToast({ message, isError: true })),
|
showToast: message => dispatch(doToast({ message, isError: true })),
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,10 +16,22 @@ type Props = {
|
||||||
disabled: boolean,
|
disabled: boolean,
|
||||||
publishing: boolean,
|
publishing: boolean,
|
||||||
showToast: string => void,
|
showToast: string => void,
|
||||||
|
inProgress: boolean,
|
||||||
|
clearPublish: () => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
function PublishFile(props: Props) {
|
function PublishFile(props: Props) {
|
||||||
const { name, balance, filePath, isStillEditing, updatePublishForm, disabled, publishing } = props;
|
const {
|
||||||
|
name,
|
||||||
|
balance,
|
||||||
|
filePath,
|
||||||
|
isStillEditing,
|
||||||
|
updatePublishForm,
|
||||||
|
disabled,
|
||||||
|
publishing,
|
||||||
|
inProgress,
|
||||||
|
clearPublish,
|
||||||
|
} = props;
|
||||||
|
|
||||||
let currentFile = '';
|
let currentFile = '';
|
||||||
if (filePath) {
|
if (filePath) {
|
||||||
|
@ -79,7 +91,12 @@ function PublishFile(props: Props) {
|
||||||
actionIconPadding={false}
|
actionIconPadding={false}
|
||||||
icon={ICONS.PUBLISH}
|
icon={ICONS.PUBLISH}
|
||||||
disabled={disabled || balance === 0}
|
disabled={disabled || balance === 0}
|
||||||
title={title}
|
title={
|
||||||
|
<React.Fragment>
|
||||||
|
{title}{' '}
|
||||||
|
{inProgress && <Button button="close" label={__('Cancel')} icon={ICONS.REMOVE} onClick={clearPublish} />}
|
||||||
|
</React.Fragment>
|
||||||
|
}
|
||||||
subtitle={
|
subtitle={
|
||||||
isStillEditing ? __('You are currently editing a claim.') : __('Publish something totally wacky and wild.')
|
isStillEditing ? __('You are currently editing a claim.') : __('Publish something totally wacky and wild.')
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,8 @@ function PublishForm(props: Props) {
|
||||||
disabled = false,
|
disabled = false,
|
||||||
} = props;
|
} = props;
|
||||||
const formDisabled = (!filePath && !editingURI) || publishing;
|
const formDisabled = (!filePath && !editingURI) || publishing;
|
||||||
|
const isInProgress = filePath || editingURI || name || title;
|
||||||
|
|
||||||
// If they are editing, they don't need a new file chosen
|
// If they are editing, they don't need a new file chosen
|
||||||
const formValidLessFile =
|
const formValidLessFile =
|
||||||
name && isNameValid(name, false) && title && bid && !(uploadThumbnailStatus === THUMBNAIL_STATUSES.IN_PROGRESS);
|
name && isNameValid(name, false) && title && bid && !(uploadThumbnailStatus === THUMBNAIL_STATUSES.IN_PROGRESS);
|
||||||
|
@ -132,7 +134,7 @@ function PublishForm(props: Props) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<PublishFile disabled={disabled || publishing} />
|
<PublishFile disabled={disabled || publishing} inProgress={isInProgress} />
|
||||||
<div className={classnames({ 'card--disabled': formDisabled })}>
|
<div className={classnames({ 'card--disabled': formDisabled })}>
|
||||||
<PublishText disabled={formDisabled} />
|
<PublishText disabled={formDisabled} />
|
||||||
<Card actions={<SelectThumbnail />} />
|
<Card actions={<SelectThumbnail />} />
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
transition: all var(--transition-duration) var(--transition-style);
|
transition: all var(--transition-duration) var(--transition-style);
|
||||||
border-radius: var(--card-radius);
|
border-radius: var(--card-radius);
|
||||||
color: var(--color-text);
|
color: var(--color-text);
|
||||||
|
font-size: var(--font-small);
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: var(--color-button-primary-text);
|
color: var(--color-button-primary-text);
|
||||||
|
|
Loading…
Add table
Reference in a new issue