[Report Page] Fix GitHub URL and improve strings (#340)

* Refactor

* Fix github URL and Improve strings
This commit is contained in:
saltrafael 2021-11-22 11:32:33 -03:00 committed by GitHub
parent 87c3dcc057
commit e2c7337d11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,49 +1,40 @@
import React, { Fragment } from 'react';
import Button from 'component/button';
import { FormField } from 'component/common/form';
import { doToast } from 'redux/actions/notifications'; import { doToast } from 'redux/actions/notifications';
import { FormField } from 'component/common/form';
import { Lbryio } from 'lbryinc'; import { Lbryio } from 'lbryinc';
import Page from 'component/page'; import Button from 'component/button';
import Card from 'component/common/card'; import Card from 'component/common/card';
import I18nMessage from 'component/i18nMessage'; import I18nMessage from 'component/i18nMessage';
import Page from 'component/page';
import React from 'react';
class ReportPage extends React.Component { class ReportPage extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = { submitting: false, message: '' };
submitting: false,
message: '',
};
} }
onMessageChange(event) { onMessageChange(event) {
this.setState({ this.setState({ message: event.target.value });
message: event.target.value,
});
} }
submitMessage() { submitMessage() {
const { message } = this.state; const { message } = this.state;
if (message) {
this.setState({ if (!message) return;
submitting: true,
}); this.setState({ submitting: true });
Lbryio.call('event', 'desktop_error', { error_message: message }).then(() => { Lbryio.call('event', 'desktop_error', { error_message: message }).then(() => {
this.setState({ this.setState({ submitting: false });
submitting: false,
});
// Display global notice // Display global notice
const action = doToast({ const action = doToast({ message: __('Message received! Thanks for helping.') });
message: __('Message received! Thanks for helping.'),
});
window.app.store.dispatch(action); window.app.store.dispatch(action);
}); });
this.setState({ message: '' }); this.setState({ message: '' });
} }
}
render() { render() {
return ( return (
@ -55,14 +46,14 @@ class ReportPage extends React.Component {
'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!' '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={ actions={
<Fragment> <>
<FormField <FormField
type="textarea" type="textarea"
rows="10" rows="10"
name="message" name="message"
stretch stretch
value={this.state.message} value={this.state.message}
onChange={event => { onChange={(event) => {
this.onMessageChange(event); this.onMessageChange(event);
}} }}
placeholder={__('Description of your issue or feature request')} placeholder={__('Description of your issue or feature request')}
@ -71,29 +62,25 @@ class ReportPage extends React.Component {
<div className="section__actions"> <div className="section__actions">
<Button <Button
button="primary" button="primary"
onClick={event => { label={this.state.submitting ? __('Submitting...') : __('Submit Report')}
this.submitMessage(event); onClick={(event) => this.submitMessage(event)}
}}
className={`button-block button-primary ${this.state.submitting ? 'disabled' : ''}`} className={`button-block button-primary ${this.state.submitting ? 'disabled' : ''}`}
> />
{this.state.submitting ? __('Submitting...') : __('Submit Report')}
</Button>
</div> </div>
</Fragment> </>
} }
/> />
<Card <Card
title={__('Developer?')} title={__('Developer? Or looking for more?')}
actions={ actions={
<Fragment>
<div dir="auto" className="markdown-preview"> <div dir="auto" className="markdown-preview">
<p>{__('You can also:')}</p> <p>{__('You can also:')}</p>
<ul> <ul>
<li> <li>
<Button <Button
button="link" button="link"
href="https://github.com/lbryio/lbry-desktop/issues" href="https://github.com/OdyseeTeam/odysee-frontend/issues"
label={__('Submit an issue on GitHub')} label={__('Submit an issue on GitHub')}
/> />
. .
@ -106,7 +93,7 @@ class ReportPage extends React.Component {
), ),
}} }}
> >
Explore our %technical_resources% Explore LBRY's %technical_resources%
</I18nMessage> </I18nMessage>
. .
</li> </li>
@ -116,13 +103,12 @@ class ReportPage extends React.Component {
tech_forum: <Button button="link" href="https://forum.lbry.tech" label={__('tech forum')} />, tech_forum: <Button button="link" href="https://forum.lbry.tech" label={__('tech forum')} />,
}} }}
> >
Join our %tech_forum% Join LBRY's %tech_forum%
</I18nMessage> </I18nMessage>
. .
</li> </li>
</ul> </ul>
</div> </div>
</Fragment>
} }
/> />
</div> </div>