2019-12-22 03:43:39 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const { Component } = require('inferno');
|
|
|
|
const { cacheComponent } = require('../util/cache');
|
|
|
|
|
|
|
|
class Alipay extends Component {
|
|
|
|
render() {
|
2019-12-22 17:38:31 +00:00
|
|
|
const { title, qrcode, url_for } = this.props;
|
2019-12-22 03:43:39 +00:00
|
|
|
if (!qrcode) {
|
2019-12-22 05:37:57 +00:00
|
|
|
return <div className="notification is-danger">
|
2019-12-22 03:43:39 +00:00
|
|
|
You forgot to set the <code>qrcode</code> for Alipay.
|
|
|
|
Please set it in <code>_config.yml</code>.
|
|
|
|
</div>;
|
|
|
|
}
|
2019-12-22 05:37:57 +00:00
|
|
|
return <a className="button is-info donate">
|
|
|
|
<span className="icon is-small">
|
|
|
|
<i className="fab fa-alipay"></i>
|
2019-12-22 03:43:39 +00:00
|
|
|
</span>
|
2019-12-22 17:38:31 +00:00
|
|
|
<span>{title}</span>
|
|
|
|
<span className="qrcode"><img src={url_for(qrcode)} alt={title} /></span>
|
2019-12-22 03:43:39 +00:00
|
|
|
</a>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = cacheComponent(Alipay, 'donate.alipay', props => {
|
2019-12-23 21:18:59 +00:00
|
|
|
const { donate, helper } = props;
|
|
|
|
|
2019-12-22 03:43:39 +00:00
|
|
|
return {
|
2019-12-23 21:18:59 +00:00
|
|
|
qrcode: donate.qrcode,
|
|
|
|
title: helper.__('donate.' + donate.type),
|
|
|
|
url_for: helper.url_for
|
2019-12-22 03:43:39 +00:00
|
|
|
};
|
|
|
|
});
|