2017-12-21 22:08:54 +01:00
|
|
|
import React from 'react';
|
2018-03-26 23:32:43 +02:00
|
|
|
import Button from 'component/button';
|
2018-04-25 22:18:02 +02:00
|
|
|
import { FormRow, FormField } from 'component/common/form';
|
2018-04-19 20:49:47 +02:00
|
|
|
import { Lbry, doNotify } from 'lbry-redux';
|
2018-04-25 22:18:02 +02:00
|
|
|
import Page from 'component/page';
|
2016-11-22 21:19:08 +01:00
|
|
|
|
2017-06-15 02:37:42 +02:00
|
|
|
class ReportPage extends React.Component {
|
2017-05-17 10:10:25 +02:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
submitting: false,
|
2017-12-21 22:08:54 +01:00
|
|
|
message: '',
|
2017-05-17 10:10:25 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-04-06 07:15:29 +02:00
|
|
|
onMessageChange(event) {
|
|
|
|
this.setState({
|
|
|
|
message: event.target.value,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-05-17 10:10:25 +02:00
|
|
|
submitMessage() {
|
2018-04-06 07:15:29 +02:00
|
|
|
const { message } = this.state;
|
2017-06-15 02:37:42 +02:00
|
|
|
if (message) {
|
2016-04-23 14:20:54 +02:00
|
|
|
this.setState({
|
2017-06-06 23:19:12 +02:00
|
|
|
submitting: true,
|
2016-04-23 14:20:54 +02:00
|
|
|
});
|
2018-04-18 06:03:01 +02:00
|
|
|
Lbry.report_bug({ message }).then(() => {
|
2016-04-23 14:20:54 +02:00
|
|
|
this.setState({
|
2016-10-21 09:56:37 +02:00
|
|
|
submitting: false,
|
2016-04-23 14:20:54 +02:00
|
|
|
});
|
2017-06-15 02:37:42 +02:00
|
|
|
|
|
|
|
// Display global notice
|
2018-04-19 20:49:47 +02:00
|
|
|
const action = doNotify({
|
|
|
|
displayType: ['snackbar'],
|
2017-12-21 22:08:54 +01:00
|
|
|
message: __('Message received! Thanks for helping.'),
|
2017-06-15 02:37:42 +02:00
|
|
|
isError: false,
|
|
|
|
});
|
|
|
|
window.app.store.dispatch(action);
|
2016-04-23 14:20:54 +02:00
|
|
|
});
|
2017-06-15 02:37:42 +02:00
|
|
|
|
2017-12-21 22:08:54 +01:00
|
|
|
this.setState({ message: '' });
|
2016-04-23 14:20:54 +02:00
|
|
|
}
|
2017-05-17 10:10:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2016-04-23 14:20:54 +02:00
|
|
|
return (
|
2018-04-06 07:15:29 +02:00
|
|
|
<Page>
|
|
|
|
<section className="card card--section">
|
2017-05-22 00:34:12 +02:00
|
|
|
<div className="card__content">
|
2018-04-06 07:15:29 +02:00
|
|
|
<div className="card__title">{__('Report an Issue')}</div>
|
2017-06-06 23:19:12 +02:00
|
|
|
<p>
|
|
|
|
{__(
|
2017-12-21 22:08:54 +01:00
|
|
|
'Please describe the problem you experienced and any information you think might be useful to us. Links to screenshots are great!'
|
2017-06-06 23:19:12 +02:00
|
|
|
)}
|
|
|
|
</p>
|
2018-04-06 07:15:29 +02:00
|
|
|
<FormRow>
|
|
|
|
<FormField
|
2017-06-06 23:19:12 +02:00
|
|
|
type="textarea"
|
|
|
|
rows="10"
|
|
|
|
name="message"
|
2018-04-06 07:15:29 +02:00
|
|
|
stretch
|
2017-06-15 02:37:42 +02:00
|
|
|
value={this.state.message}
|
|
|
|
onChange={event => {
|
|
|
|
this.onMessageChange(event);
|
|
|
|
}}
|
2017-12-21 22:08:54 +01:00
|
|
|
placeholder={__('Description of your issue')}
|
2017-06-06 23:19:12 +02:00
|
|
|
/>
|
2018-04-06 07:15:29 +02:00
|
|
|
</FormRow>
|
|
|
|
<div className="card__actions">
|
|
|
|
<Button
|
|
|
|
button="primary"
|
2017-06-06 23:19:12 +02:00
|
|
|
onClick={event => {
|
|
|
|
this.submitMessage(event);
|
|
|
|
}}
|
2017-12-21 22:08:54 +01:00
|
|
|
className={`button-block button-primary ${this.state.submitting ? 'disabled' : ''}`}
|
2017-06-06 23:19:12 +02:00
|
|
|
>
|
2017-12-21 22:08:54 +01:00
|
|
|
{this.state.submitting ? __('Submitting...') : __('Submit Report')}
|
2018-04-06 07:15:29 +02:00
|
|
|
</Button>
|
2017-05-22 00:34:12 +02:00
|
|
|
</div>
|
2016-08-27 00:06:22 +02:00
|
|
|
</div>
|
2016-04-23 14:20:54 +02:00
|
|
|
</section>
|
2018-04-06 07:15:29 +02:00
|
|
|
<section className="card card--section">
|
|
|
|
<div className="card__title">{__('Developer?')}</div>
|
|
|
|
<p>
|
2017-12-21 22:08:54 +01:00
|
|
|
{__('You can also')}{' '}
|
2018-03-26 23:32:43 +02:00
|
|
|
<Button
|
2018-04-06 07:15:29 +02:00
|
|
|
button="link"
|
2017-06-06 23:19:12 +02:00
|
|
|
href="https://github.com/lbryio/lbry/issues"
|
2017-12-21 22:08:54 +01:00
|
|
|
label={__('submit an issue on GitHub')}
|
2017-06-06 23:19:12 +02:00
|
|
|
/>.
|
2018-04-06 07:15:29 +02:00
|
|
|
</p>
|
2016-04-23 14:20:54 +02:00
|
|
|
</section>
|
2018-04-06 07:15:29 +02:00
|
|
|
</Page>
|
2016-04-23 14:20:54 +02:00
|
|
|
);
|
|
|
|
}
|
2017-05-17 10:10:25 +02:00
|
|
|
}
|
2016-11-22 21:19:08 +01:00
|
|
|
|
|
|
|
export default ReportPage;
|