lbry-desktop/src/ui/modal/modalConfirmThumbnailUpload/view.jsx

54 lines
1.4 KiB
React
Raw Normal View History

2018-04-02 18:03:12 +02:00
// @flow
import React from 'react';
import { Modal } from 'modal/modal';
2019-02-13 17:27:20 +01:00
import { FormField } from 'component/common/form';
2018-04-02 18:03:12 +02:00
type Props = {
upload: (string, boolean) => void,
path: string,
nsfw: boolean,
closeModal: () => void,
2018-04-02 22:27:44 +02:00
updatePublishForm: ({}) => void,
2018-04-02 18:03:12 +02:00
};
class ModalConfirmThumbnailUpload extends React.PureComponent<Props> {
upload() {
2018-06-08 06:05:45 +02:00
const { upload, updatePublishForm, closeModal, path, nsfw } = this.props;
2018-04-02 18:03:12 +02:00
upload(path, nsfw);
2018-06-08 06:05:45 +02:00
updatePublishForm({ thumbnailPath: path });
2018-04-02 18:03:12 +02:00
closeModal();
2018-04-02 18:03:12 +02:00
}
render() {
const { closeModal, path, updatePublishForm, nsfw } = this.props;
return (
<Modal
isOpen
title={__('Upload Thumbnail')}
2018-04-02 18:03:12 +02:00
contentLabel={__('Confirm Thumbnail Upload')}
type="confirm"
confirmButtonLabel={__('Upload')}
onConfirmed={() => this.upload()}
onAborted={closeModal}
>
<section className="card__content">
<p>{__('Are you sure you want to upload this thumbnail to spee.ch')}?</p>
<blockquote>{path}</blockquote>
2019-02-13 17:27:20 +01:00
<FormField
type="checkbox"
name="content_is_mature"
label={__('For mature audiences only')}
checked={nsfw}
onChange={event => updatePublishForm({ nsfw: event.target.checked })}
/>
</section>
2018-04-02 18:03:12 +02:00
</Modal>
);
}
}
export default ModalConfirmThumbnailUpload;