[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 isBodyList
body={ 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' */} {/* @if TARGET='app' */}
<SettingsRow <SettingsRow
title={__('Save all viewed content to your downloads directory')} title={__('Save all viewed content to your downloads directory')}

View file

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

View file

@ -9,7 +9,6 @@ import SettingAccount from 'component/settingAccount';
import SettingAppearance from 'component/settingAppearance'; import SettingAppearance from 'component/settingAppearance';
import SettingContent from 'component/settingContent'; import SettingContent from 'component/settingContent';
import SettingSystem from 'component/settingSystem'; import SettingSystem from 'component/settingSystem';
import FileSelector from 'component/common/file-selector';
import Card from 'component/common/card'; import Card from 'component/common/card';
import classnames from 'classnames'; import classnames from 'classnames';
import Yrbl from 'component/yrbl'; import Yrbl from 'component/yrbl';
@ -28,7 +27,6 @@ type DaemonSettings = {
type Props = { type Props = {
setDaemonSetting: (string, ?SetDaemonSettingArg) => void, setDaemonSetting: (string, ?SetDaemonSettingArg) => void,
clearDaemonSetting: (string) => void,
toggle3PAnalytics: (boolean) => void, toggle3PAnalytics: (boolean) => void,
daemonSettings: DaemonSettings, daemonSettings: DaemonSettings,
allowAnalytics: boolean, allowAnalytics: boolean,
@ -55,10 +53,6 @@ class SettingsPage extends React.PureComponent<Props> {
this.props.setDaemonSetting(name, value); this.props.setDaemonSetting(name, value);
} }
clearDaemonSetting(name: string): void {
this.props.clearDaemonSetting(name);
}
render() { render() {
const { const {
daemonSettings, daemonSettings,
@ -109,24 +103,6 @@ class SettingsPage extends React.PureComponent<Props> {
</section> </section>
) : ( ) : (
<div className={classnames('card-stack', { 'card--disabled': IS_WEB && !isAuthenticated })}> <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' */} {/* @if TARGET='app' */}
<Card <Card
title={__('Share usage and diagnostic data')} title={__('Share usage and diagnostic data')}