[System] grab "Download Directory"

This commit is contained in:
infinite-persistence 2021-08-08 10:39:25 +08:00
parent 690f48b7e1
commit 379a3fb6b0
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0
3 changed files with 13 additions and 31 deletions

View file

@ -122,6 +122,18 @@ export default function SettingSystem(props: Props) {
isBodyList
body={
<>
{/* @if TARGET='app' */}
<SettingsRow title={__('Download directory')} subtitle={__('LBRY downloads will be saved here.')}>
<FileSelector
type="openDirectory"
currentPath={daemonSettings.download_dir}
onFileChosen={(newDirectory: WebFile) => {
setDaemonSetting('download_dir', newDirectory.path);
}}
/>
</SettingsRow>
{/* @endif */}
{/* @if TARGET='app' */}
<SettingsRow
title={__('Save all viewed content to your downloads directory')}

View file

@ -1,12 +1,7 @@
import { connect } from 'react-redux';
import { doToggle3PAnalytics } from 'redux/actions/app';
import { selectAllowAnalytics } from 'redux/selectors/app';
import {
doSetDaemonSetting,
doClearDaemonSetting,
doEnterSettingsPage,
doExitSettingsPage,
} from 'redux/actions/settings';
import { doSetDaemonSetting, doEnterSettingsPage, doExitSettingsPage } from 'redux/actions/settings';
import { makeSelectClientSetting, selectDaemonSettings } from 'redux/selectors/settings';
import { SETTINGS } from 'lbry-redux';
import SettingsPage from './view';
@ -22,7 +17,6 @@ const select = (state) => ({
const perform = (dispatch) => ({
setDaemonSetting: (key, value) => dispatch(doSetDaemonSetting(key, value)),
clearDaemonSetting: (key) => dispatch(doClearDaemonSetting(key)),
toggle3PAnalytics: (allow) => dispatch(doToggle3PAnalytics(allow)),
enterSettings: () => dispatch(doEnterSettingsPage()),
exitSettings: () => dispatch(doExitSettingsPage()),

View file

@ -9,7 +9,6 @@ import SettingAccount from 'component/settingAccount';
import SettingAppearance from 'component/settingAppearance';
import SettingContent from 'component/settingContent';
import SettingSystem from 'component/settingSystem';
import FileSelector from 'component/common/file-selector';
import Card from 'component/common/card';
import classnames from 'classnames';
import Yrbl from 'component/yrbl';
@ -28,7 +27,6 @@ type DaemonSettings = {
type Props = {
setDaemonSetting: (string, ?SetDaemonSettingArg) => void,
clearDaemonSetting: (string) => void,
toggle3PAnalytics: (boolean) => void,
daemonSettings: DaemonSettings,
allowAnalytics: boolean,
@ -55,10 +53,6 @@ class SettingsPage extends React.PureComponent<Props> {
this.props.setDaemonSetting(name, value);
}
clearDaemonSetting(name: string): void {
this.props.clearDaemonSetting(name);
}
render() {
const {
daemonSettings,
@ -109,24 +103,6 @@ class SettingsPage extends React.PureComponent<Props> {
</section>
) : (
<div className={classnames('card-stack', { 'card--disabled': IS_WEB && !isAuthenticated })}>
{/* @if TARGET='app' */}
<Card
title={__('Download directory')}
actions={
<React.Fragment>
<FileSelector
type="openDirectory"
currentPath={daemonSettings.download_dir}
onFileChosen={(newDirectory: WebFile) => {
setDaemonSetting('download_dir', newDirectory.path);
}}
/>
<p className="help">{__('LBRY downloads will be saved here.')}</p>
</React.Fragment>
}
/>
{/* @endif */}
{/* @if TARGET='app' */}
<Card
title={__('Share usage and diagnostic data')}