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

46 lines
1.1 KiB
React
Raw Normal View History

2018-04-02 18:03:12 +02:00
// @flow
import React from 'react';
import { Modal } from 'modal/modal';
import { DOMAIN } from 'config';
2018-04-02 18:03:12 +02:00
type Props = {
upload: WebFile => void,
file: WebFile,
2018-04-02 18:03:12 +02:00
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() {
const { upload, updatePublishForm, closeModal, file } = this.props;
if (file) {
upload(file);
updatePublishForm({ thumbnailPath: file.path });
closeModal();
}
2018-04-02 18:03:12 +02:00
}
render() {
const { closeModal, file } = this.props;
const filePath = file && (file.path || file.name);
2018-04-02 18:03:12 +02:00
return (
<Modal
isOpen
2020-08-26 22:28:33 +02:00
title={__('Upload thumbnail')}
2018-04-02 18:03:12 +02:00
contentLabel={__('Confirm Thumbnail Upload')}
type="confirm"
confirmButtonLabel={__('Upload')}
onConfirmed={() => this.upload()}
onAborted={closeModal}
>
<label>{__('Are you sure you want to upload this thumbnail to %domain%', { domain: DOMAIN })}?</label>
<blockquote>{filePath}</blockquote>
2018-04-02 18:03:12 +02:00
</Modal>
);
}
}
export default ModalConfirmThumbnailUpload;