#1556 Adding ability to open log file and log folder from help page

This commit is contained in:
Amit Nandan P 2018-06-08 22:38:09 -05:00
parent c6684054d5
commit d46c60da86
2 changed files with 38 additions and 4 deletions

View file

@ -1,12 +1,14 @@
import { connect } from 'react-redux';
import { doAuthNavigate } from 'redux/actions/navigation';
import { doFetchAccessToken } from 'redux/actions/user';
import { selectDaemonSettings } from 'redux/selectors/settings';
import { selectAccessToken, selectUser } from 'redux/selectors/user';
import HelpPage from './view';
const select = state => ({
user: selectUser(state),
accessToken: selectAccessToken(state),
deamonSettings: selectDaemonSettings(state),
});
const perform = dispatch => ({
@ -14,4 +16,7 @@ const perform = dispatch => ({
fetchAccessToken: () => dispatch(doFetchAccessToken()),
});
export default connect(select, perform)(HelpPage);
export default connect(
select,
perform
)(HelpPage);

View file

@ -1,13 +1,19 @@
// @TODO: Customize advice based on OS
import React from 'react';
import { shell } from 'electron';
import { Lbry } from 'lbry-redux';
import Native from 'native';
import Button from 'component/button';
import BusyIndicator from 'component/common/busy-indicator';
import Icon from 'component/common/icon';
import Page from 'component/page';
import * as icons from 'constants/icons';
type Props = {
deamonSettings: {
data_dir: ?string,
},
};
class HelpPage extends React.PureComponent {
constructor(props) {
super(props);
@ -56,7 +62,8 @@ class HelpPage extends React.PureComponent {
let platform;
let newVerLink;
const { accessToken, doAuth, user } = this.props;
const { accessToken, doAuth, user, deamonSettings } = this.props;
const { data_dir: dataDirectory } = deamonSettings;
if (this.state.versionInfo) {
ver = this.state.versionInfo;
@ -108,12 +115,34 @@ class HelpPage extends React.PureComponent {
</div>
</section>
<section className="card card--section">
<div className="card__title">{__('View your Log')}</div>
<p className="card__subtitle">
{__(
'Do you find something wrong? Have a look in your log, or send your log to support for some help.'
)}
</p>
<div className="card__actions">
<Button
button="primary"
label={__('Open Log')}
icon={icons.REPORT}
onClick={() => shell.openItem(`${dataDirectory}/lbrynet.log`)}
/>
<Button
button="primary"
label={__('Open Log Folder')}
icon={icons.REPORT}
onClick={() => shell.showItemInFolder(dataDirectory)}
/>
</div>
</section>
<section className="card card--section">
<div className="card__title">{__('Report a Bug or Suggest a New Feature')}</div>
<p className="card__subtitle">
{__('Did you find something wrong? Think LBRY could add something useful and cool?')}
</p>
<div className="card__actions">
<Button
navigate="/report"