lbry-desktop/src/renderer/modal/modalAffirmPurchase/view.jsx

56 lines
1.2 KiB
React
Raw Normal View History

2018-09-26 19:48:07 +02:00
// @flow
import React from 'react';
import FilePrice from 'component/filePrice';
import { Modal } from 'modal/modal';
2018-09-26 19:48:07 +02:00
import type { Metadata } from 'types/claim';
2017-09-07 23:18:33 +02:00
2018-09-26 19:48:07 +02:00
type Props = {
closeModal: () => void,
loadVideo: string => void,
uri: string,
cancelPurchase: () => void,
metadata: Metadata,
};
class ModalAffirmPurchase extends React.PureComponent<Props> {
2018-05-31 06:32:31 +02:00
constructor() {
super();
this.onAffirmPurchase = this.onAffirmPurchase.bind(this);
}
2017-09-08 05:15:05 +02:00
onAffirmPurchase() {
this.props.closeModal();
this.props.loadVideo(this.props.uri);
}
2017-09-07 23:18:33 +02:00
render() {
2018-05-03 19:22:10 +02:00
const {
cancelPurchase,
metadata: { title },
uri,
} = this.props;
2017-09-07 23:18:33 +02:00
return (
<Modal
type="confirm"
isOpen
2018-09-26 19:48:07 +02:00
title={__('Confirm Purchase')}
contentLabel={__('Confirm Purchase')}
2018-05-31 06:32:31 +02:00
onConfirmed={this.onAffirmPurchase}
onAborted={cancelPurchase}
2017-09-07 23:18:33 +02:00
>
<p>
2018-09-26 19:48:07 +02:00
{__('This will purchase')} <strong>{`"${title}"`}</strong> {__('for')}{' '}
<strong>
<FilePrice uri={uri} showFullPrice inheritStyle showLBC={false} />
</strong>{' '}
{__('credits')}.
</p>
2017-09-07 23:18:33 +02:00
</Modal>
);
}
}
export default ModalAffirmPurchase;