2017-02-02 16:49:14 +00:00
|
|
|
/* @flow */
|
|
|
|
|
2017-01-31 22:38:34 +00:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
2017-02-02 16:49:14 +00:00
|
|
|
declare var config: Object;
|
|
|
|
|
2017-01-31 22:38:34 +00:00
|
|
|
/**
|
2017-02-02 16:49:14 +00:00
|
|
|
* Implements a Web/React Component which renders a feedback button.
|
2017-01-31 22:38:34 +00:00
|
|
|
*/
|
|
|
|
export class FeedbackButton extends Component {
|
2017-02-02 16:49:14 +00:00
|
|
|
state = {
|
|
|
|
callStatsID: String
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes a new FeedbackButton instance.
|
|
|
|
*
|
|
|
|
* @param {Object} props - The read-only properties with which the new
|
|
|
|
* instance is to be initialized.
|
|
|
|
*/
|
|
|
|
constructor(props: Object) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
callStatsID: config.callStatsID
|
|
|
|
};
|
|
|
|
}
|
2017-01-31 22:38:34 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
2017-02-02 16:49:14 +00:00
|
|
|
// If callstats.io-support is not configured, skip rendering.
|
|
|
|
if (!this.state.callStatsID) {
|
2017-01-31 22:38:34 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<a
|
|
|
|
className = 'button icon-feedback'
|
|
|
|
id = 'feedbackButton' />
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|