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 // @flow
/* eslint react/no-unescaped-entities:0 */
/* eslint react/jsx-no-comment-textnodes:0 */
import * as SETTINGS from 'constants/settings'; import * as SETTINGS from 'constants/settings';
import * as PAGES from 'constants/pages'; import * as PAGES from 'constants/pages';
import * as React from 'react'; import * as React from 'react';
@ -208,62 +211,61 @@ class SettingsPage extends React.PureComponent<Props, State> {
return ( return (
<Page> <Page>
{noDaemonSettings && !IS_WEB ? ( // @if TARGET='app'
{noDaemonSettings ? (
<section className="card card--section"> <section className="card card--section">
<div className="card__title">{__('Failed to load settings.')}</div> <div className="card__title">{__('Failed to load settings.')}</div>
</section> </section>
) : ( ) : (
// @endif
<div> <div>
{!IS_WEB && ( // @if TARGET='app'
<section className="card card--section"> <section className="card card--section">
<h2 className="card__title">{__('Download Directory')}</h2> <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>
)}
<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"> <section className="card card--section">
<header className="card__header"> <header className="card__header">
<h2 className="card__title">{__('Max Purchase Price')}</h2> <h2 className="card__title">{__('Max Purchase Price')}</h2>
@ -304,7 +306,6 @@ class SettingsPage extends React.PureComponent<Props, State> {
</p> </p>
</Form> </Form>
</section> </section>
<section className="card card--section"> <section className="card card--section">
<h2 className="card__title">{__('Purchase Confirmations')}</h2> <h2 className="card__title">{__('Purchase Confirmations')}</h2>
@ -342,7 +343,6 @@ class SettingsPage extends React.PureComponent<Props, State> {
</p> </p>
</Form> </Form>
</section> </section>
<section className="card card--section"> <section className="card card--section">
<h2 className="card__title">{__('Content Settings')}</h2> <h2 className="card__title">{__('Content Settings')}</h2>
<FormField <FormField
@ -379,7 +379,6 @@ class SettingsPage extends React.PureComponent<Props, State> {
)} )}
/> />
</section> </section>
<section className="card card--section"> <section className="card card--section">
<h2 className="card__title">{__('Blocked Channels')}</h2> <h2 className="card__title">{__('Blocked Channels')}</h2>
<p className="card__subtitle card__help "> <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}`} /> <Button button="link" label={__('Manage')} navigate={`/$/${PAGES.BLOCKED}`} />
</p> </p>
</section> </section>
{!IS_WEB && ( // @if TARGET='app'
<section className="card card--section"> <section className="card card--section">
<h2 className="card__title">{__('Notifications')}</h2> <h2 className="card__title">{__('Notifications')}</h2>
<Form> <Form>
<FormField <FormField
type="checkbox" type="checkbox"
name="desktopNotification" name="desktopNotification"
onChange={() => setClientSetting(SETTINGS.OS_NOTIFICATIONS_ENABLED, !osNotificationsEnabled)} onChange={() => setClientSetting(SETTINGS.OS_NOTIFICATIONS_ENABLED, !osNotificationsEnabled)}
checked={osNotificationsEnabled} checked={osNotificationsEnabled}
label={__('Show Desktop Notifications')} label={__('Show Desktop Notifications')}
helper={__('Get notified when a publish is confirmed, or when new content is available to watch.')} helper={__('Get notified when a publish is confirmed, or when new content is available to watch.')}
/> />
</Form> </Form>
</section> </section>
)} // @endif
<section className="card card--section"> <section className="card card--section">
<h2 className="card__title">{__('Share Diagnostic Data')}</h2> <h2 className="card__title">{__('Share Diagnostic Data')}</h2>
@ -424,7 +422,6 @@ class SettingsPage extends React.PureComponent<Props, State> {
/> />
</Form> </Form>
</section> </section>
<section className="card card--section"> <section className="card card--section">
<h2 className="card__title">{__('Appearance')}</h2> <h2 className="card__title">{__('Appearance')}</h2>
@ -486,110 +483,109 @@ class SettingsPage extends React.PureComponent<Props, State> {
</fieldset-section> </fieldset-section>
</Form> </Form>
</section> </section>
{!IS_WEB && ( // @if TARGET='app'
<section className="card card--section"> <section className="card card--section">
<h2 className="card__title">{__('Wallet Security')}</h2> <h2 className="card__title">{__('Wallet Security')}</h2>
<Form> <Form>
<FormField <FormField
type="checkbox" type="checkbox"
name="encrypt_wallet" name="encrypt_wallet"
onChange={() => this.onChangeEncryptWallet()} onChange={() => this.onChangeEncryptWallet()}
checked={walletEncrypted} checked={walletEncrypted}
label={__('Encrypt my wallet with a custom password')} label={__('Encrypt my wallet with a custom password')}
helper={ helper={
<React.Fragment> <React.Fragment>
{__('Secure your local wallet data with a custom password.')}{' '} {__('Secure your local wallet data with a custom password.')}{' '}
<strong>{__('Lost passwords cannot be recovered.')} </strong> <strong>{__('Lost passwords cannot be recovered.')} </strong>
<Button button="link" label={__('Learn more')} href="https://lbry.com/faq/wallet-encryption" />. <Button button="link" label={__('Learn more')} href="https://lbry.com/faq/wallet-encryption" />.
</React.Fragment> </React.Fragment>
} }
/> />
<FormField <FormField
type="checkbox" type="checkbox"
name="hide_balance" name="hide_balance"
onChange={() => setClientSetting(SETTINGS.HIDE_BALANCE, !hideBalance)} onChange={() => setClientSetting(SETTINGS.HIDE_BALANCE, !hideBalance)}
checked={hideBalance} checked={hideBalance}
label={__('Hide wallet balance in header')} label={__('Hide wallet balance in header')}
/> />
</Form> </Form>
</section> </section>
)} // @endif // @if TARGET='app'
{!IS_WEB && ( <section className="card card--section">
<section className="card card--section"> <h2 className="card__title">{__('Experimental Settings')}</h2>
<h2 className="card__title">{__('Experimental Settings')}</h2>
<Form> <Form>
<FormField <FormField
type="checkbox" type="checkbox"
name="support_option" name="support_option"
onChange={() => setClientSetting(SETTINGS.SUPPORT_OPTION, !supportOption)} onChange={() => setClientSetting(SETTINGS.SUPPORT_OPTION, !supportOption)}
checked={supportOption} checked={supportOption}
label={__('Enable claim support')} label={__('Enable claim support')}
helper={ helper={
<React.Fragment> <React.Fragment>
{__('This will add a Support button along side tipping. Similar to tips, supports help ')} {__('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" /> <Button button="link" label={__(' discovery ')} href="https://lbry.com/faq/trending" />
{__(' but the LBC is returned to your wallet if revoked.')} {__(' but the LBC is returned to your wallet if revoked.')}
{__(' Both also help secure ')} {__(' Both also help secure ')}
<Button button="link" label={__('vanity names')} href="https://lbry.com/faq/naming" />. <Button button="link" label={__('vanity names')} href="https://lbry.com/faq/naming" />.
</React.Fragment> </React.Fragment>
} }
/> />
<FormField <FormField
type="checkbox" type="checkbox"
name="auto_download" name="auto_download"
onChange={() => setClientSetting(SETTINGS.AUTO_DOWNLOAD, !autoDownload)} onChange={() => setClientSetting(SETTINGS.AUTO_DOWNLOAD, !autoDownload)}
checked={autoDownload} checked={autoDownload}
label={__('Automatically download new content from my subscriptions')} label={__('Automatically download new content from my subscriptions')}
helper={__( helper={__(
"The latest file from each of your subscriptions will be downloaded for quick access as soon as it's published." "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 <FormField
name="language_select" name="max_connections"
type="select" type="select"
label={__('Language')} label={__('Max Connections')}
onChange={this.onLanguageChange}
value={currentLanguage}
helper={__( 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 => ( {connectionOptions.map(connectionOption => (
<option key={language} value={language}> <option key={connectionOption} value={connectionOption}>
{languages[language]} {connectionOption}
</option> </option>
))} ))}
</FormField> </FormField>
</Form> </fieldset-section>
<Form> </Form>
<fieldset-section> </section>
<FormField // @endif
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>
)}
<section className="card card--section"> <section className="card card--section">
<h2 className="card__title">{__('Application Cache')}</h2> <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" yargs "^13.2.2"
zstd-codec "^0.1.1" zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#1af092ce2cb507d9a41711b864874c0bd76935ae: lbry-redux@lbryio/lbry-redux#f4413a8ab4928a9487274568bb72e440c45875be:
version "0.0.1" 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: dependencies:
mime "^2.4.4"
proxy-polyfill "0.1.6" proxy-polyfill "0.1.6"
reselect "^3.0.0" reselect "^3.0.0"
uuid "^3.3.2" uuid "^3.3.2"