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

47 lines
1.2 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 = {
file: FileWithPath,
upload: (FileWithPath, (string) => void) => void,
cb: (string) => void,
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, cb, closeModal, file } = this.props;
if (file) {
upload(file, cb);
updatePublishForm({ thumbnailPath: file.path });
closeModal();
}
2018-04-02 18:03:12 +02:00
}
render() {
const { closeModal, file } = this.props;
const filePath = file && file.path;
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;