2017-06-06 17:19:12 -04:00
|
|
|
import React from "react";
|
|
|
|
import Link from "component/link";
|
|
|
|
import { FormRow } from "component/form";
|
2017-06-14 20:37:42 -04:00
|
|
|
import { doShowSnackBar } from "actions/app";
|
2017-06-06 17:19:12 -04:00
|
|
|
import lbry from "../lbry.js";
|
2016-11-22 14:19:08 -06:00
|
|
|
|
2017-06-14 20:37:42 -04:00
|
|
|
class ReportPage extends React.Component {
|
2017-05-17 04:10:25 -04:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
submitting: false,
|
2017-06-14 20:37:42 -04:00
|
|
|
message: "",
|
2017-05-17 04:10:25 -04:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
submitMessage() {
|
2017-06-14 20:37:42 -04:00
|
|
|
const message = this.state.message;
|
|
|
|
if (message) {
|
2016-04-23 08:20:54 -04:00
|
|
|
this.setState({
|
2017-06-06 17:19:12 -04:00
|
|
|
submitting: true,
|
2016-04-23 08:20:54 -04:00
|
|
|
});
|
2017-06-14 20:37:42 -04:00
|
|
|
lbry.report_bug({ message }).then(() => {
|
2016-04-23 08:20:54 -04:00
|
|
|
this.setState({
|
2016-10-21 03:56:37 -04:00
|
|
|
submitting: false,
|
2016-04-23 08:20:54 -04:00
|
|
|
});
|
2017-06-14 20:37:42 -04:00
|
|
|
|
|
|
|
// Display global notice
|
|
|
|
const action = doShowSnackBar({
|
|
|
|
message: __("Message received! Thanks for helping."),
|
|
|
|
isError: false,
|
|
|
|
});
|
|
|
|
window.app.store.dispatch(action);
|
2016-04-23 08:20:54 -04:00
|
|
|
});
|
2017-06-14 20:37:42 -04:00
|
|
|
|
|
|
|
this.setState({ message: "" });
|
2016-04-23 08:20:54 -04:00
|
|
|
}
|
2017-05-17 04:10:25 -04:00
|
|
|
}
|
|
|
|
|
2017-06-14 20:37:42 -04:00
|
|
|
onMessageChange(event) {
|
2016-10-21 03:56:37 -04:00
|
|
|
this.setState({
|
2017-06-14 20:37:42 -04:00
|
|
|
message: event.target.value,
|
2017-06-06 17:19:12 -04:00
|
|
|
});
|
2017-05-17 04:10:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2016-04-23 08:20:54 -04:00
|
|
|
return (
|
2017-04-30 20:15:21 -04:00
|
|
|
<main className="main--single-column">
|
2016-08-07 18:45:26 -04:00
|
|
|
<section className="card">
|
2017-05-21 18:34:12 -04:00
|
|
|
<div className="card__content">
|
2017-05-26 08:40:35 +02:00
|
|
|
<h3>{__("Report an Issue")}</h3>
|
2017-06-06 17:19:12 -04:00
|
|
|
<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-21 18:34:12 -04:00
|
|
|
<div className="form-row">
|
2017-06-06 17:19:12 -04:00
|
|
|
<FormRow
|
|
|
|
type="textarea"
|
|
|
|
rows="10"
|
|
|
|
name="message"
|
2017-06-14 20:37:42 -04:00
|
|
|
value={this.state.message}
|
|
|
|
onChange={event => {
|
|
|
|
this.onMessageChange(event);
|
|
|
|
}}
|
2017-06-06 17:19:12 -04:00
|
|
|
placeholder={__("Description of your issue")}
|
|
|
|
/>
|
2017-05-21 18:34:12 -04:00
|
|
|
</div>
|
|
|
|
<div className="form-row form-row-submit">
|
2017-06-06 17:19:12 -04:00
|
|
|
<button
|
|
|
|
onClick={event => {
|
|
|
|
this.submitMessage(event);
|
|
|
|
}}
|
|
|
|
className={
|
|
|
|
"button-block button-primary " +
|
|
|
|
(this.state.submitting ? "disabled" : "")
|
|
|
|
}
|
|
|
|
>
|
|
|
|
{this.state.submitting
|
|
|
|
? __("Submitting...")
|
|
|
|
: __("Submit Report")}
|
|
|
|
</button>
|
2017-05-21 18:34:12 -04:00
|
|
|
</div>
|
2016-08-26 18:06:22 -04:00
|
|
|
</div>
|
2016-04-23 08:20:54 -04:00
|
|
|
</section>
|
2016-08-07 18:45:26 -04:00
|
|
|
<section className="card">
|
2017-05-21 18:34:12 -04:00
|
|
|
<div className="card__content">
|
2017-05-26 08:40:35 +02:00
|
|
|
<h3>{__("Developer?")}</h3>
|
2017-06-06 17:19:12 -04:00
|
|
|
{__("You can also")}
|
|
|
|
{" "}
|
|
|
|
<Link
|
|
|
|
href="https://github.com/lbryio/lbry/issues"
|
|
|
|
label={__("submit an issue on GitHub")}
|
|
|
|
/>.
|
2017-05-21 18:34:12 -04:00
|
|
|
</div>
|
2016-04-23 08:20:54 -04:00
|
|
|
</section>
|
|
|
|
</main>
|
|
|
|
);
|
|
|
|
}
|
2017-05-17 04:10:25 -04:00
|
|
|
}
|
2016-11-22 14:19:08 -06:00
|
|
|
|
|
|
|
export default ReportPage;
|