2018-01-20 20:06:28 +00:00
|
|
|
import { donationAddressMap } from 'config';
|
2017-06-26 22:27:55 +00:00
|
|
|
import React from 'react';
|
|
|
|
import translate from 'translations';
|
|
|
|
|
2017-09-25 02:06:28 +00:00
|
|
|
interface Props {
|
|
|
|
onDonate(address: string, amount: string, unit: string): void;
|
|
|
|
}
|
|
|
|
interface State {
|
|
|
|
clicked: boolean;
|
|
|
|
}
|
|
|
|
export default class Donate extends React.Component<Props, State> {
|
|
|
|
public state = {
|
2017-07-04 00:20:47 +00:00
|
|
|
clicked: false
|
|
|
|
};
|
2017-09-25 02:06:28 +00:00
|
|
|
public render() {
|
2017-07-04 00:20:47 +00:00
|
|
|
return (
|
|
|
|
<div className="well">
|
2017-12-18 23:29:26 +00:00
|
|
|
<p>{translate('sidebar_donation')}</p>
|
2017-07-04 00:20:47 +00:00
|
|
|
<a className="btn btn-primary btn-block" onClick={this.onClick}>
|
|
|
|
{translate('sidebar_donate')}
|
|
|
|
</a>
|
2017-12-18 23:29:26 +00:00
|
|
|
{this.state.clicked && (
|
|
|
|
<div className="text-success text-center marg-v-sm">{translate('sidebar_thanks')}</div>
|
|
|
|
)}
|
2017-07-04 00:20:47 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-06-26 22:27:55 +00:00
|
|
|
|
2017-09-25 02:06:28 +00:00
|
|
|
public onClick = () => {
|
2017-07-04 00:20:47 +00:00
|
|
|
// FIXME move to config
|
|
|
|
this.props.onDonate(donationAddressMap.ETH, '1', 'ETH');
|
2017-06-26 22:27:55 +00:00
|
|
|
|
2017-07-04 00:20:47 +00:00
|
|
|
this.setState({ clicked: true });
|
|
|
|
};
|
2017-06-26 22:27:55 +00:00
|
|
|
}
|