2019-11-22 16:13:00 -05:00
import React , { Fragment } from 'react' ;
2018-03-26 14:32:43 -07:00
import Button from 'component/button' ;
2019-02-13 12:27:20 -04:00
import { FormField } from 'component/common/form' ;
2020-06-12 16:44:25 -04:00
import { doToast } from 'redux/actions/notifications' ;
2019-03-18 01:06:41 -04:00
import { Lbryio } from 'lbryinc' ;
2018-04-25 16:18:02 -04:00
import Page from 'component/page' ;
2019-11-22 16:13:00 -05:00
import Card from 'component/common/card' ;
2020-05-26 19:51:27 +08:00
import I18nMessage from 'component/i18nMessage' ;
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-12-21 18:08:54 -03:00
message : '' ,
2017-05-17 04:10:25 -04:00
} ;
}
2018-04-06 01:15:29 -04:00
onMessageChange ( event ) {
this . setState ( {
message : event . target . value ,
} ) ;
}
2017-05-17 04:10:25 -04:00
submitMessage ( ) {
2018-04-06 01:15:29 -04:00
const { message } = this . state ;
2017-06-14 20:37:42 -04:00
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
} ) ;
2019-03-18 17:51:19 -04:00
Lbryio . call ( 'event' , 'desktop_error' , { error _message : 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
2018-10-29 13:23:53 -04:00
const action = doToast ( {
2017-12-21 18:08:54 -03:00
message : _ _ ( 'Message received! Thanks for helping.' ) ,
2017-06-14 20:37:42 -04:00
} ) ;
window . app . store . dispatch ( action ) ;
2016-04-23 08:20:54 -04:00
} ) ;
2017-06-14 20:37:42 -04:00
2017-12-21 18:08:54 -03:00
this . setState ( { message : '' } ) ;
2016-04-23 08:20:54 -04:00
}
2017-05-17 04:10:25 -04:00
}
render ( ) {
2016-04-23 08:20:54 -04:00
return (
2018-04-06 01:15:29 -04:00
< Page >
2020-06-15 14:01:48 -04:00
< div className = "card-stack" >
< Card
title = { _ _ ( 'Report an Issue/Request a Feature' ) }
subtitle = { _ _ (
'Please describe the problem you experienced or the feature you want to see and any information you think might be useful to us. Links to screenshots are great!'
) }
actions = {
< Fragment >
< FormField
type = "textarea"
rows = "10"
name = "message"
stretch
value = { this . state . message }
onChange = { event => {
this . onMessageChange ( event ) ;
} }
placeholder = { _ _ ( 'Description of your issue or feature request' ) }
/ >
2018-12-19 00:44:53 -05:00
2020-06-15 14:01:48 -04:00
< div className = "section__actions" >
< Button
button = "primary"
onClick = { event => {
this . submitMessage ( event ) ;
} }
className = { ` button-block button-primary ${ this . state . submitting ? 'disabled' : '' } ` }
>
{ this . state . submitting ? _ _ ( 'Submitting...' ) : _ _ ( 'Submit Report' ) }
< / Button >
< / div >
< / Fragment >
}
/ >
2019-02-13 12:27:20 -04:00
2020-06-15 14:01:48 -04:00
< Card
title = { _ _ ( 'Developer?' ) }
actions = {
< Fragment >
2020-08-20 13:27:28 +02:00
< div dir = "auto" className = "markdown-preview" >
2020-06-15 14:01:48 -04:00
< p > { _ _ ( 'You can also:' ) } < / p >
< ul >
< li >
< Button
button = "link"
href = "https://github.com/lbryio/lbry-desktop/issues"
label = { _ _ ( 'Submit an issue on GitHub' ) }
/ >
.
< / li >
< li >
< I18nMessage
tokens = { {
technical _resources : (
< Button button = "link" href = "https://lbry.tech" label = { _ _ ( 'technical resources' ) } / >
) ,
} }
>
Explore our % technical _resources %
< / I18nMessage >
.
< / li >
< li >
< I18nMessage
tokens = { {
tech _forum : < Button button = "link" href = "https://forum.lbry.tech" label = { _ _ ( 'tech forum' ) } / > ,
} }
>
Join our % tech _forum %
< / I18nMessage >
.
< / li >
< / ul >
< / div >
< / Fragment >
}
/ >
< / div >
2018-04-06 01:15:29 -04:00
< / Page >
2016-04-23 08:20:54 -04:00
) ;
}
2017-05-17 04:10:25 -04:00
}
2016-11-22 14:19:08 -06:00
export default ReportPage ;