change to @if app

This commit is contained in:
jessop 2019-08-25 16:43:44 -04:00 committed by Sean Yesmunt
parent a6d79160eb
commit 2deb6d6f16
2 changed files with 159 additions and 164 deletions

View file

@ -1,4 +1,7 @@
// @flow
/* eslint react/no-unescaped-entities:0 */
/* eslint react/jsx-no-comment-textnodes:0 */
import * as SETTINGS from 'constants/settings';
import * as PAGES from 'constants/pages';
import * as React from 'react';
@ -208,62 +211,61 @@ class SettingsPage extends React.PureComponent<Props, State> {
return (
<Page>
{noDaemonSettings && !IS_WEB ? (
// @if TARGET='app'
{noDaemonSettings ? (
<section className="card card--section">
<div className="card__title">{__('Failed to load settings.')}</div>
</section>
) : (
// @endif
<div>
{!IS_WEB && (
<section className="card card--section">
<h2 className="card__title">{__('Download Directory')}</h2>
<div className="card__content">
<FileSelector
type="openDirectory"
currentPath={daemonSettings.download_dir}
onFileChosen={(newDirectory: string) => {
setDaemonSetting('download_dir', newDirectory);
}}
/>
<p className="help">{__('LBRY downloads will be saved here.')}</p>
</div>
</section>
)}
{!IS_WEB && (
<section className="card card--section">
<h2 className="card__title">{__('Network and Data Settings')}</h2>
<Form>
<FormField
type="checkbox"
name="save_files"
onChange={() => setDaemonSetting('save_files', !daemonSettings.save_files)}
checked={daemonSettings.save_files}
label={__('Save all viewed content to your downloads directory')}
helper={__(
'Paid content and some file types are saved by default. Changing this setting will not affect previously downloaded content.'
)}
/>
</Form>
<Form>
<FormField
type="checkbox"
name="save_blobs"
onChange={() => setDaemonSetting('save_blobs', !daemonSettings.save_blobs)}
checked={daemonSettings.save_blobs}
label={__('Save hosting data to help the LBRY network')}
helper={
<React.Fragment>
{__("If disabled, LBRY will be very sad and you won't be helping improve the network.")}{' '}
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/host-content" />.
</React.Fragment>
}
/>
</Form>
</section>
)}
// @if TARGET='app'
<section className="card card--section">
<h2 className="card__title">{__('Download Directory')}</h2>
<div className="card__content">
<FileSelector
type="openDirectory"
currentPath={daemonSettings.download_dir}
onFileChosen={(newDirectory: string) => {
setDaemonSetting('download_dir', newDirectory);
}}
/>
<p className="help">{__('LBRY downloads will be saved here.')}</p>
</div>
</section>
// @endif // @if TARGET='app'
<section className="card card--section">
<h2 className="card__title">{__('Network and Data Settings')}</h2>
<Form>
<FormField
type="checkbox"
name="save_files"
onChange={() => setDaemonSetting('save_files', !daemonSettings.save_files)}
checked={daemonSettings.save_files}
label={__('Save all viewed content to your downloads directory')}
helper={__(
'Paid content and some file types are saved by default. Changing this setting will not affect previously downloaded content.'
)}
/>
</Form>
<Form>
<FormField
type="checkbox"
name="save_blobs"
onChange={() => setDaemonSetting('save_blobs', !daemonSettings.save_blobs)}
checked={daemonSettings.save_blobs}
label={__('Save hosting data to help the LBRY network')}
helper={
<React.Fragment>
{__("If disabled, LBRY will be very sad and you won't be helping improve the network.")}{' '}
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/host-content" />.
</React.Fragment>
}
/>
</Form>
</section>
// @endif
<section className="card card--section">
<header className="card__header">
<h2 className="card__title">{__('Max Purchase Price')}</h2>
@ -304,7 +306,6 @@ class SettingsPage extends React.PureComponent<Props, State> {
</p>
</Form>
</section>
<section className="card card--section">
<h2 className="card__title">{__('Purchase Confirmations')}</h2>
@ -342,7 +343,6 @@ class SettingsPage extends React.PureComponent<Props, State> {
</p>
</Form>
</section>
<section className="card card--section">
<h2 className="card__title">{__('Content Settings')}</h2>
<FormField
@ -379,7 +379,6 @@ class SettingsPage extends React.PureComponent<Props, State> {
)}
/>
</section>
<section className="card card--section">
<h2 className="card__title">{__('Blocked Channels')}</h2>
<p className="card__subtitle card__help ">
@ -389,22 +388,21 @@ class SettingsPage extends React.PureComponent<Props, State> {
<Button button="link" label={__('Manage')} navigate={`/$/${PAGES.BLOCKED}`} />
</p>
</section>
{!IS_WEB && (
<section className="card card--section">
<h2 className="card__title">{__('Notifications')}</h2>
<Form>
<FormField
type="checkbox"
name="desktopNotification"
onChange={() => setClientSetting(SETTINGS.OS_NOTIFICATIONS_ENABLED, !osNotificationsEnabled)}
checked={osNotificationsEnabled}
label={__('Show Desktop Notifications')}
helper={__('Get notified when a publish is confirmed, or when new content is available to watch.')}
/>
</Form>
</section>
)}
// @if TARGET='app'
<section className="card card--section">
<h2 className="card__title">{__('Notifications')}</h2>
<Form>
<FormField
type="checkbox"
name="desktopNotification"
onChange={() => setClientSetting(SETTINGS.OS_NOTIFICATIONS_ENABLED, !osNotificationsEnabled)}
checked={osNotificationsEnabled}
label={__('Show Desktop Notifications')}
helper={__('Get notified when a publish is confirmed, or when new content is available to watch.')}
/>
</Form>
</section>
// @endif
<section className="card card--section">
<h2 className="card__title">{__('Share Diagnostic Data')}</h2>
@ -424,7 +422,6 @@ class SettingsPage extends React.PureComponent<Props, State> {
/>
</Form>
</section>
<section className="card card--section">
<h2 className="card__title">{__('Appearance')}</h2>
@ -486,110 +483,109 @@ class SettingsPage extends React.PureComponent<Props, State> {
</fieldset-section>
</Form>
</section>
{!IS_WEB && (
<section className="card card--section">
<h2 className="card__title">{__('Wallet Security')}</h2>
// @if TARGET='app'
<section className="card card--section">
<h2 className="card__title">{__('Wallet Security')}</h2>
<Form>
<FormField
type="checkbox"
name="encrypt_wallet"
onChange={() => this.onChangeEncryptWallet()}
checked={walletEncrypted}
label={__('Encrypt my wallet with a custom password')}
helper={
<React.Fragment>
{__('Secure your local wallet data with a custom password.')}{' '}
<strong>{__('Lost passwords cannot be recovered.')} </strong>
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/wallet-encryption" />.
</React.Fragment>
}
/>
<Form>
<FormField
type="checkbox"
name="encrypt_wallet"
onChange={() => this.onChangeEncryptWallet()}
checked={walletEncrypted}
label={__('Encrypt my wallet with a custom password')}
helper={
<React.Fragment>
{__('Secure your local wallet data with a custom password.')}{' '}
<strong>{__('Lost passwords cannot be recovered.')} </strong>
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/wallet-encryption" />.
</React.Fragment>
}
/>
<FormField
type="checkbox"
name="hide_balance"
onChange={() => setClientSetting(SETTINGS.HIDE_BALANCE, !hideBalance)}
checked={hideBalance}
label={__('Hide wallet balance in header')}
/>
</Form>
</section>
)}
{!IS_WEB && (
<section className="card card--section">
<h2 className="card__title">{__('Experimental Settings')}</h2>
<FormField
type="checkbox"
name="hide_balance"
onChange={() => setClientSetting(SETTINGS.HIDE_BALANCE, !hideBalance)}
checked={hideBalance}
label={__('Hide wallet balance in header')}
/>
</Form>
</section>
// @endif // @if TARGET='app'
<section className="card card--section">
<h2 className="card__title">{__('Experimental Settings')}</h2>
<Form>
<FormField
type="checkbox"
name="support_option"
onChange={() => setClientSetting(SETTINGS.SUPPORT_OPTION, !supportOption)}
checked={supportOption}
label={__('Enable claim support')}
helper={
<React.Fragment>
{__('This will add a Support button along side tipping. Similar to tips, supports help ')}
<Button button="link" label={__(' discovery ')} href="https://lbry.com/faq/trending" />
{__(' but the LBC is returned to your wallet if revoked.')}
{__(' Both also help secure ')}
<Button button="link" label={__('vanity names')} href="https://lbry.com/faq/naming" />.
</React.Fragment>
}
/>
<Form>
<FormField
type="checkbox"
name="support_option"
onChange={() => setClientSetting(SETTINGS.SUPPORT_OPTION, !supportOption)}
checked={supportOption}
label={__('Enable claim support')}
helper={
<React.Fragment>
{__('This will add a Support button along side tipping. Similar to tips, supports help ')}
<Button button="link" label={__(' discovery ')} href="https://lbry.com/faq/trending" />
{__(' but the LBC is returned to your wallet if revoked.')}
{__(' Both also help secure ')}
<Button button="link" label={__('vanity names')} href="https://lbry.com/faq/naming" />.
</React.Fragment>
}
/>
<FormField
type="checkbox"
name="auto_download"
onChange={() => setClientSetting(SETTINGS.AUTO_DOWNLOAD, !autoDownload)}
checked={autoDownload}
label={__('Automatically download new content from my subscriptions')}
helper={__(
"The latest file from each of your subscriptions will be downloaded for quick access as soon as it's published."
)}
/>
<FormField
type="checkbox"
name="auto_download"
onChange={() => setClientSetting(SETTINGS.AUTO_DOWNLOAD, !autoDownload)}
checked={autoDownload}
label={__('Automatically download new content from my subscriptions')}
helper={__(
"The latest file from each of your subscriptions will be downloaded for quick access as soon as it's published."
)}
/>
<FormField
name="language_select"
type="select"
label={__('Language')}
onChange={this.onLanguageChange}
value={currentLanguage}
helper={__(
'Multi-language support is brand new and incomplete. Switching your language may have unintended consequences.'
)}
>
{Object.keys(languages).map(language => (
<option key={language} value={language}>
{languages[language]}
</option>
))}
</FormField>
</Form>
<Form>
<fieldset-section>
<FormField
name="language_select"
name="max_connections"
type="select"
label={__('Language')}
onChange={this.onLanguageChange}
value={currentLanguage}
label={__('Max Connections')}
helper={__(
'Multi-language support is brand new and incomplete. Switching your language may have unintended consequences.'
'For users with good bandwidth, try a higher value to improve streaming and download speeds. Low bandwidth users may benefit from a lower setting. Default is 4.'
)}
min={1}
max={100}
onChange={this.onMaxConnectionsChange}
value={daemonSettings.max_connections_per_download}
>
{Object.keys(languages).map(language => (
<option key={language} value={language}>
{languages[language]}
{connectionOptions.map(connectionOption => (
<option key={connectionOption} value={connectionOption}>
{connectionOption}
</option>
))}
</FormField>
</Form>
<Form>
<fieldset-section>
<FormField
name="max_connections"
type="select"
label={__('Max Connections')}
helper={__(
'For users with good bandwidth, try a higher value to improve streaming and download speeds. Low bandwidth users may benefit from a lower setting. Default is 4.'
)}
min={1}
max={100}
onChange={this.onMaxConnectionsChange}
value={daemonSettings.max_connections_per_download}
>
{connectionOptions.map(connectionOption => (
<option key={connectionOption} value={connectionOption}>
{connectionOption}
</option>
))}
</FormField>
</fieldset-section>
</Form>
</section>
)}
</fieldset-section>
</Form>
</section>
// @endif
<section className="card card--section">
<h2 className="card__title">{__('Application Cache')}</h2>

View file

@ -6755,11 +6755,10 @@ lazy-val@^1.0.3, lazy-val@^1.0.4:
yargs "^13.2.2"
zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#1af092ce2cb507d9a41711b864874c0bd76935ae:
lbry-redux@lbryio/lbry-redux#f4413a8ab4928a9487274568bb72e440c45875be:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/1af092ce2cb507d9a41711b864874c0bd76935ae"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/f4413a8ab4928a9487274568bb72e440c45875be"
dependencies:
mime "^2.4.4"
proxy-polyfill "0.1.6"
reselect "^3.0.0"
uuid "^3.3.2"