lbry-desktop/ui/js/page/report.js

69 lines
2.2 KiB
JavaScript
Raw Normal View History

2016-11-22 21:19:08 +01:00
import React from 'react';
2017-04-07 07:15:22 +02:00
import Link from 'component/link';
2017-05-22 00:34:12 +02:00
import {FormRow} from 'component/form'
2017-01-02 21:42:53 +01:00
import Modal from '../component/modal.js';
2016-11-22 21:19:08 +01:00
import lbry from '../lbry.js';
2017-05-17 10:10:25 +02:00
class ReportPage extends React.Component {
constructor(props) {
super(props);
this.state = {
submitting: false,
modal: null,
};
}
submitMessage() {
if (this._messageArea.value) {
this.setState({
submitting: true
});
lbry.reportBug(this._messageArea.value, () => {
this.setState({
submitting: false,
modal: 'submitted',
});
});
this._messageArea.value = '';
}
2017-05-17 10:10:25 +02:00
}
closeModal() {
this.setState({
modal: null,
})
2017-05-17 10:10:25 +02:00
}
render() {
return (
<main className="main--single-column">
2016-08-08 00:45:26 +02:00
<section className="card">
2017-05-22 00:34:12 +02:00
<div className="card__content">
<h3>{__("Report an Issue")}</h3>
<p>{__("Please describe the problem you experienced and any information you think might be useful to us. Links to screenshots are great!")}</p>
2017-05-22 00:34:12 +02:00
<div className="form-row">
<FormRow type="textarea" ref={(t) => this._messageArea = t} rows="10" name="message" placeholder={__("Description of your issue")} />
2017-05-22 00:34:12 +02:00
</div>
<div className="form-row form-row-submit">
<button onClick={(event) => { this.submitMessage(event) }} className={'button-block button-primary ' + (this.state.submitting ? 'disabled' : '')}>{this.state.submitting ? __('Submitting...') : __('Submit Report')}</button>
2017-05-22 00:34:12 +02:00
</div>
2016-08-27 00:06:22 +02:00
</div>
</section>
2016-08-08 00:45:26 +02:00
<section className="card">
2017-05-22 00:34:12 +02:00
<div className="card__content">
<h3>{__("Developer?")}</h3>
{__("You can also")} <Link href="https://github.com/lbryio/lbry/issues" label={__("submit an issue on GitHub")}/>.
2017-05-22 00:34:12 +02:00
</div>
</section>
<Modal isOpen={this.state.modal == 'submitted'} contentLabel={__("Bug report submitted")}
onConfirmed={(event) => { this.closeModal(event) }}>
{__("Your bug report has been submitted! Thank you for your feedback.")}
</Modal>
</main>
);
}
2017-05-17 10:10:25 +02:00
}
2016-11-22 21:19:08 +01:00
export default ReportPage;