c03c0de0a2
show full price on confirmation don't format full price smart format for full price
44 lines
963 B
JavaScript
44 lines
963 B
JavaScript
import React from "react";
|
|
import { CreditAmount } from "component/common";
|
|
|
|
class FilePrice extends React.PureComponent {
|
|
componentWillMount() {
|
|
this.fetchCost(this.props);
|
|
}
|
|
|
|
componentWillReceiveProps(nextProps) {
|
|
this.fetchCost(nextProps);
|
|
}
|
|
|
|
fetchCost(props) {
|
|
const { costInfo, fetchCostInfo, uri, fetching, claim } = props;
|
|
|
|
if (costInfo === undefined && !fetching && claim) {
|
|
fetchCostInfo(uri);
|
|
}
|
|
}
|
|
|
|
render() {
|
|
const { costInfo, look = "indicator", showFullPrice = false } = this.props;
|
|
|
|
const isEstimate = costInfo ? !costInfo.includesData : null;
|
|
|
|
if (!costInfo) {
|
|
return (
|
|
<span className={`credit-amount credit-amount--${look}`}>???</span>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<CreditAmount
|
|
label={false}
|
|
amount={costInfo.cost}
|
|
isEstimate={isEstimate}
|
|
showFree={true}
|
|
showFullPrice={showFullPrice}
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default FilePrice;
|