2020-06-12 22:44:25 +02:00
import { doToast } from 'redux/actions/notifications' ;
2021-11-22 15:32:33 +01:00
import { FormField } from 'component/common/form' ;
2019-03-18 06:06:41 +01:00
import { Lbryio } from 'lbryinc' ;
2021-11-22 15:32:33 +01:00
import Button from 'component/button' ;
2019-11-22 22:13:00 +01:00
import Card from 'component/common/card' ;
2020-05-26 13:51:27 +02:00
import I18nMessage from 'component/i18nMessage' ;
2021-11-22 15:32:33 +01:00
import Page from 'component/page' ;
import React from 'react' ;
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 ) ;
2021-11-22 15:32:33 +01:00
this . state = { submitting : false , message : '' } ;
2017-05-17 10:10:25 +02:00
}
2018-04-06 07:15:29 +02:00
onMessageChange ( event ) {
2021-11-22 15:32:33 +01:00
this . setState ( { message : event . target . value } ) ;
2018-04-06 07:15:29 +02:00
}
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
2021-11-22 15:32:33 +01:00
if ( ! message ) return ;
this . setState ( { submitting : true } ) ;
Lbryio . call ( 'event' , 'desktop_error' , { error _message : message } ) . then ( ( ) => {
this . setState ( { submitting : false } ) ;
2017-06-15 02:37:42 +02:00
2021-11-22 15:32:33 +01:00
// Display global notice
const action = doToast ( { message : _ _ ( 'Message received! Thanks for helping.' ) } ) ;
window . app . store . dispatch ( action ) ;
} ) ;
this . setState ( { message : '' } ) ;
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 >
2020-06-15 20:01:48 +02:00
< div className = "card-stack" >
< Card
2020-08-26 22:28:33 +02:00
title = { _ _ ( 'Report an issue or request a feature' ) }
2020-06-15 20:01:48 +02:00
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 = {
2021-11-22 15:32:33 +01:00
< >
2020-06-15 20:01:48 +02:00
< FormField
type = "textarea"
rows = "10"
name = "message"
stretch
value = { this . state . message }
2021-11-22 15:32:33 +01:00
onChange = { ( event ) => {
2020-06-15 20:01:48 +02:00
this . onMessageChange ( event ) ;
} }
placeholder = { _ _ ( 'Description of your issue or feature request' ) }
/ >
2018-12-19 06:44:53 +01:00
2020-06-15 20:01:48 +02:00
< div className = "section__actions" >
< Button
button = "primary"
2021-11-22 15:32:33 +01:00
label = { this . state . submitting ? _ _ ( 'Submitting...' ) : _ _ ( 'Submit Report' ) }
onClick = { ( event ) => this . submitMessage ( event ) }
2020-06-15 20:01:48 +02:00
className = { ` button-block button-primary ${ this . state . submitting ? 'disabled' : '' } ` }
2021-11-22 15:32:33 +01:00
/ >
2020-06-15 20:01:48 +02:00
< / div >
2021-11-22 15:32:33 +01:00
< / >
2020-06-15 20:01:48 +02:00
}
/ >
2019-02-13 17:27:20 +01:00
2020-06-15 20:01:48 +02:00
< Card
2021-11-22 15:32:33 +01:00
title = { _ _ ( 'Developer? Or looking for more?' ) }
2020-06-15 20:01:48 +02:00
actions = {
2021-11-22 15:32:33 +01:00
< div dir = "auto" className = "markdown-preview" >
< p > { _ _ ( 'You can also:' ) } < / p >
< ul >
< li >
< Button
button = "link"
href = "https://github.com/OdyseeTeam/odysee-frontend/issues"
label = { _ _ ( 'Submit an issue on GitHub' ) }
/ >
.
< / li >
< li >
< I18nMessage
tokens = { {
technical _resources : (
< Button button = "link" href = "https://lbry.tech" label = { _ _ ( 'technical resources' ) } / >
) ,
} }
>
Explore LBRY ' s % technical _resources %
< / I18nMessage >
.
< / li >
< li >
< I18nMessage
tokens = { {
tech _forum : < Button button = "link" href = "https://forum.lbry.tech" label = { _ _ ( 'tech forum' ) } / > ,
} }
>
Join LBRY ' s % tech _forum %
< / I18nMessage >
.
< / li >
< / ul >
< / div >
2020-06-15 20:01:48 +02:00
}
/ >
< / div >
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 ;