2018-04-02 18:03:12 +02:00
|
|
|
// @flow
|
|
|
|
import React from 'react';
|
|
|
|
import { Modal } from 'modal/modal';
|
2020-07-22 17:24:51 +02:00
|
|
|
import { DOMAIN } from 'config';
|
2018-04-02 18:03:12 +02:00
|
|
|
|
|
|
|
type Props = {
|
2019-10-07 22:02:32 +02:00
|
|
|
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() {
|
2019-10-07 22:02:32 +02:00
|
|
|
const { upload, updatePublishForm, closeModal, file } = this.props;
|
|
|
|
upload(file);
|
|
|
|
updatePublishForm({ thumbnailPath: file.path });
|
2018-04-02 18:03:12 +02:00
|
|
|
closeModal();
|
2018-04-02 18:03:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2019-10-07 22:02:32 +02:00
|
|
|
const { closeModal, file } = this.props;
|
2020-11-11 23:07:45 +01:00
|
|
|
console.log('file', file);
|
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}
|
|
|
|
>
|
2020-07-22 17:24:51 +02:00
|
|
|
<label>{__('Are you sure you want to upload this thumbnail to %domain%', { domain: DOMAIN })}?</label>
|
2019-01-11 17:34:36 +01:00
|
|
|
|
2019-10-07 22:02:32 +02:00
|
|
|
<blockquote>{file.path || file.name}</blockquote>
|
2018-04-02 18:03:12 +02:00
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ModalConfirmThumbnailUpload;
|