2018-03-26 23:32:43 +02:00
// @flow
2018-11-26 02:21:25 +01:00
import * as SETTINGS from 'constants/settings' ;
2019-07-08 22:54:58 +02:00
import * as PAGES from 'constants/pages' ;
2018-03-26 23:32:43 +02:00
import * as React from 'react' ;
2019-03-18 06:06:41 +01:00
import classnames from 'classnames' ;
2019-02-13 17:27:20 +01:00
import { FormField , FormFieldPrice , Form } from 'component/common/form' ;
2018-03-26 23:32:43 +02:00
import Button from 'component/button' ;
import Page from 'component/page' ;
import FileSelector from 'component/common/file-selector' ;
2019-03-18 06:06:41 +01:00
import UnsupportedOnWeb from 'component/common/unsupported-on-web' ;
2018-03-26 23:32:43 +02:00
2019-04-24 16:02:08 +02:00
type Price = {
2018-03-26 23:32:43 +02:00
currency : string ,
amount : number ,
} ;
2019-02-12 18:26:50 +01:00
type SetDaemonSettingArg = boolean | string | number | Price ;
2019-08-18 19:01:04 +02:00
type DarkModeTimes = {
from : { hour : string , min : string , formattedTime : string } ,
to : { hour : string , min : string , formattedTime : string } ,
} ;
type OptionTimes = {
fromTo : string ,
time : string ,
} ;
2018-03-26 23:32:43 +02:00
type DaemonSettings = {
2019-02-12 18:26:50 +01:00
download _dir : string ,
2018-03-26 23:32:43 +02:00
share _usage _data : boolean ,
2018-10-13 17:49:47 +02:00
max _key _fee ? : Price ,
2019-08-02 08:28:14 +02:00
max _connections _per _download ? : number ,
save _files : boolean ,
save _blobs : boolean ,
2018-03-26 23:32:43 +02:00
} ;
type Props = {
2019-02-12 18:26:50 +01:00
setDaemonSetting : ( string , ? SetDaemonSettingArg ) => void ,
setClientSetting : ( string , SetDaemonSettingArg ) => void ,
2018-03-26 23:32:43 +02:00
clearCache : ( ) => Promise < any > ,
getThemes : ( ) => void ,
daemonSettings : DaemonSettings ,
showNsfw : boolean ,
instantPurchaseEnabled : boolean ,
instantPurchaseMax : Price ,
2019-07-24 16:17:58 +02:00
currentLanguage : string ,
languages : { } ,
2018-03-26 23:32:43 +02:00
currentTheme : string ,
themes : Array < string > ,
automaticDarkModeEnabled : boolean ,
2018-05-30 05:18:41 +02:00
autoplay : boolean ,
2018-08-10 16:51:51 +02:00
autoDownload : boolean ,
2019-06-07 23:10:47 +02:00
changeLanguage : string => void ,
2018-07-18 21:48:30 +02:00
encryptWallet : ( ) => void ,
decryptWallet : ( ) => void ,
2018-10-13 17:49:47 +02:00
updateWalletStatus : ( ) => void ,
2018-07-18 21:48:30 +02:00
walletEncrypted : boolean ,
2018-08-01 20:49:57 +02:00
osNotificationsEnabled : boolean ,
2019-07-19 22:21:41 +02:00
supportOption : boolean ,
2019-07-08 22:54:58 +02:00
userBlockedChannelsCount ? : number ,
2019-07-29 17:37:29 +02:00
hideBalance : boolean ,
2019-08-13 07:35:13 +02:00
floatingPlayer : boolean ,
clearPlayingUri : ( ) => void ,
2019-08-18 19:01:04 +02:00
darkModeTimes : DarkModeTimes ,
2019-08-18 18:54:55 +02:00
setDarkTime : ( string , { } ) => void ,
2018-03-26 23:32:43 +02:00
} ;
type State = {
clearingCache : boolean ,
} ;
class SettingsPage extends React . PureComponent < Props , State > {
constructor ( props : Props ) {
2017-05-17 10:10:25 +02:00
super ( props ) ;
2017-06-02 18:40:26 +02:00
2017-05-18 03:37:39 +02:00
this . state = {
2017-06-16 07:43:43 +02:00
clearingCache : false ,
2017-06-06 23:19:12 +02:00
} ;
2018-02-08 20:28:46 +01:00
2018-03-26 23:32:43 +02:00
( this : any ) . onKeyFeeChange = this . onKeyFeeChange . bind ( this ) ;
2019-08-02 08:28:14 +02:00
( this : any ) . onMaxConnectionsChange = this . onMaxConnectionsChange . bind ( this ) ;
2019-02-12 18:26:50 +01:00
( this : any ) . onKeyFeeDisableChange = this . onKeyFeeDisableChange . bind ( this ) ;
2018-03-26 23:32:43 +02:00
( this : any ) . onInstantPurchaseMaxChange = this . onInstantPurchaseMaxChange . bind ( this ) ;
( this : any ) . onThemeChange = this . onThemeChange . bind ( this ) ;
( this : any ) . onAutomaticDarkModeChange = this . onAutomaticDarkModeChange . bind ( this ) ;
2019-06-07 23:10:47 +02:00
( this : any ) . onLanguageChange = this . onLanguageChange . bind ( this ) ;
2018-03-26 23:32:43 +02:00
( this : any ) . clearCache = this . clearCache . bind ( this ) ;
2019-08-18 18:54:55 +02:00
( this : any ) . onChangeTime = this . onChangeTime . bind ( this ) ;
2017-06-16 07:43:43 +02:00
}
2018-03-26 23:32:43 +02:00
componentDidMount ( ) {
2018-10-13 17:49:47 +02:00
this . props . getThemes ( ) ;
this . props . updateWalletStatus ( ) ;
2017-05-17 10:10:25 +02:00
}
2018-03-26 23:32:43 +02:00
onKeyFeeChange ( newValue : Price ) {
this . setDaemonSetting ( 'max_key_fee' , newValue ) ;
2017-05-17 10:10:25 +02:00
}
2019-08-02 08:28:14 +02:00
onMaxConnectionsChange ( event : SyntheticInputEvent < * > ) {
const { value } = event . target ;
this . setDaemonSetting ( 'max_connections_per_download' , value ) ;
}
2018-03-26 23:32:43 +02:00
onKeyFeeDisableChange ( isDisabled : boolean ) {
2019-02-12 18:26:50 +01:00
if ( isDisabled ) this . setDaemonSetting ( 'max_key_fee' ) ;
2017-05-17 10:10:25 +02:00
}
2018-03-26 23:32:43 +02:00
onThemeChange ( event : SyntheticInputEvent < * > ) {
2017-08-12 20:46:10 +02:00
const { value } = event . target ;
2018-02-08 20:28:46 +01:00
if ( value === 'dark' ) {
this . onAutomaticDarkModeChange ( false ) ;
}
2018-11-26 02:21:25 +01:00
this . props . setClientSetting ( SETTINGS . THEME , value ) ;
2017-08-05 03:36:36 +02:00
}
2019-06-07 23:10:47 +02:00
onLanguageChange ( event : SyntheticInputEvent < * > ) {
const { value } = event . target ;
this . props . changeLanguage ( value ) ;
}
2018-03-26 23:32:43 +02:00
onAutomaticDarkModeChange ( value : boolean ) {
2018-11-26 02:21:25 +01:00
this . props . setClientSetting ( SETTINGS . AUTOMATIC _DARK _MODE _ENABLED , value ) ;
2018-01-14 10:14:15 +01:00
}
2018-03-26 23:32:43 +02:00
onInstantPurchaseEnabledChange ( enabled : boolean ) {
2018-11-26 02:21:25 +01:00
this . props . setClientSetting ( SETTINGS . INSTANT _PURCHASE _ENABLED , enabled ) ;
2017-09-08 07:03:37 +02:00
}
2018-03-26 23:32:43 +02:00
onInstantPurchaseMaxChange ( newValue : Price ) {
2018-11-26 02:21:25 +01:00
this . props . setClientSetting ( SETTINGS . INSTANT _PURCHASE _MAX , newValue ) ;
2017-09-08 07:03:37 +02:00
}
2018-07-18 21:48:30 +02:00
onChangeEncryptWallet ( ) {
2018-10-13 17:49:47 +02:00
const { decryptWallet , walletEncrypted , encryptWallet } = this . props ;
if ( walletEncrypted ) {
decryptWallet ( ) ;
} else {
encryptWallet ( ) ;
}
2017-08-24 18:29:54 +02:00
}
2019-08-18 19:01:04 +02:00
onChangeTime ( event : SyntheticInputEvent < * > , options : OptionTimes ) {
2019-08-18 18:54:55 +02:00
const { value } = event . target ;
this . props . setDarkTime ( value , options ) ;
}
to12Hour ( time : string ) {
const now = new Date ( 0 , 0 , 0 , Number ( time ) ) ;
const hour = now . toLocaleTimeString ( 'en-US' , { hour12 : true , hour : '2-digit' } ) ;
return hour ;
}
2019-02-12 18:26:50 +01:00
setDaemonSetting ( name : string , value : ? SetDaemonSettingArg ) : void {
2018-10-13 17:49:47 +02:00
this . props . setDaemonSetting ( name , value ) ;
}
2018-03-26 23:32:43 +02:00
clearCache ( ) {
this . setState ( {
clearingCache : true ,
} ) ;
const success = ( ) => {
this . setState ( { clearingCache : false } ) ;
window . location . href = 'index.html' ;
} ;
const clear = ( ) => this . props . clearCache ( ) . then ( success ) ;
setTimeout ( clear , 1000 , { once : true } ) ;
}
2017-08-07 05:01:10 +02:00
2017-05-17 10:10:25 +02:00
render ( ) {
2017-09-07 03:53:42 +02:00
const {
daemonSettings ,
showNsfw ,
2017-09-08 07:03:37 +02:00
instantPurchaseEnabled ,
instantPurchaseMax ,
2018-03-26 23:32:43 +02:00
currentTheme ,
2019-07-24 16:17:58 +02:00
currentLanguage ,
languages ,
2017-09-07 03:53:42 +02:00
themes ,
2018-01-14 10:14:15 +01:00
automaticDarkModeEnabled ,
2018-05-30 05:18:41 +02:00
autoplay ,
2018-07-18 21:48:30 +02:00
walletEncrypted ,
2018-08-01 20:49:57 +02:00
osNotificationsEnabled ,
2018-08-10 16:51:51 +02:00
autoDownload ,
2019-02-13 17:27:20 +01:00
setDaemonSetting ,
setClientSetting ,
2019-07-19 22:21:41 +02:00
supportOption ,
2019-07-29 17:37:29 +02:00
hideBalance ,
2019-07-08 22:54:58 +02:00
userBlockedChannelsCount ,
2019-08-13 07:35:13 +02:00
floatingPlayer ,
2019-08-14 05:04:08 +02:00
clearPlayingUri ,
2019-08-18 18:54:55 +02:00
darkModeTimes ,
2017-09-07 03:53:42 +02:00
} = this . props ;
2017-05-17 23:52:45 +02:00
2018-03-26 23:32:43 +02:00
const noDaemonSettings = ! daemonSettings || Object . keys ( daemonSettings ) . length === 0 ;
2018-02-08 20:28:46 +01:00
2019-02-12 18:26:50 +01:00
const defaultMaxKeyFee = { currency : 'USD' , amount : 50 } ;
2019-08-02 08:28:14 +02:00
2019-02-12 18:26:50 +01:00
const disableMaxKeyFee = ! ( daemonSettings && daemonSettings . max _key _fee ) ;
2019-08-13 07:35:13 +02:00
const connectionOptions = [ 1 , 2 , 4 , 6 , 10 , 20 ] ;
2019-08-18 18:54:55 +02:00
const startHours = [ '18' , '19' , '20' , '21' ] ;
const endHours = [ '5' , '6' , '7' , '8' ] ;
2019-02-12 18:26:50 +01:00
2016-04-10 02:00:56 +02:00
return (
2018-03-26 23:32:43 +02:00
< Page >
2019-03-18 06:06:41 +01:00
{ IS _WEB && < UnsupportedOnWeb / > }
2018-03-26 23:32:43 +02:00
{ noDaemonSettings ? (
< section className = "card card--section" >
< div className = "card__title" > { _ _ ( 'Failed to load settings.' ) } < / div >
< / section >
) : (
2019-03-18 06:06:41 +01:00
< div className = { classnames ( { 'card--disabled' : IS _WEB } ) } >
2018-03-26 23:32:43 +02:00
< section className = "card card--section" >
2019-07-21 23:31:22 +02:00
< h2 className = "card__title" > { _ _ ( 'Download Directory' ) } < / h2 >
2018-12-19 06:44:53 +01:00
2018-10-19 22:38:07 +02:00
< div className = "card__content" >
2019-07-09 07:53:24 +02:00
< FileSelector
type = "openDirectory"
currentPath = { daemonSettings . download _dir }
onFileChosen = { ( newDirectory : string ) => {
setDaemonSetting ( 'download_dir' , newDirectory ) ;
} }
/ >
< p className = "help" > { _ _ ( 'LBRY downloads will be saved here.' ) } < / p >
2018-10-19 22:38:07 +02:00
< / div >
2018-03-26 23:32:43 +02:00
< / section >
2018-12-19 06:44:53 +01:00
2018-03-26 23:32:43 +02:00
< section className = "card card--section" >
2019-08-02 08:28:14 +02:00
< 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 }
2019-08-13 07:35:13 +02:00
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.'
2019-08-02 08:28:14 +02:00
) }
/ >
< / Form >
< Form >
< FormField
type = "checkbox"
name = "save_blobs"
onChange = { ( ) => setDaemonSetting ( 'save_blobs' , ! daemonSettings . save _blobs ) }
checked = { daemonSettings . save _blobs }
2019-08-13 07:35:13 +02:00
label = { _ _ ( 'Save hosting data to help the LBRY network' ) }
helper = {
2019-08-02 08:28:14 +02:00
< React.Fragment >
2019-08-13 07:35:13 +02:00
{ _ _ ( "If disabled, LBRY will be very sad and you won't be helping improve the network." ) } { ' ' }
2019-08-02 08:28:14 +02:00
< Button button = "link" label = { _ _ ( 'Learn more' ) } href = "https://lbry.com/faq/host-content" / > .
< / React.Fragment >
}
/ >
< / Form >
< / section >
< section className = "card card--section" >
< header className = "card__header" >
< h2 className = "card__title" > { _ _ ( 'Max Purchase Price' ) } < / h2 >
< / header >
2018-12-19 06:44:53 +01:00
2019-07-21 23:31:22 +02:00
< Form >
2019-02-20 06:20:29 +01:00
< FormField
type = "radio"
name = "no_max_purchase_no_limit"
checked = { disableMaxKeyFee }
label = { _ _ ( 'No Limit' ) }
onChange = { ( ) => {
this . onKeyFeeDisableChange ( true ) ;
} }
/ >
< FormField
type = "radio"
name = "max_purchase_limit"
checked = { ! disableMaxKeyFee }
onChange = { ( ) => {
this . onKeyFeeDisableChange ( false ) ;
this . onKeyFeeChange ( defaultMaxKeyFee ) ;
} }
label = { _ _ ( 'Choose limit' ) }
/ >
2019-02-13 17:27:20 +01:00
2019-02-12 18:26:50 +01:00
{ ! disableMaxKeyFee && (
2018-04-11 00:05:30 +02:00
< FormFieldPrice
name = "max_key_fee"
min = { 0 }
onChange = { this . onKeyFeeChange }
2019-05-07 23:38:29 +02:00
price = { daemonSettings . max _key _fee ? daemonSettings . max _key _fee : defaultMaxKeyFee }
2018-04-11 00:05:30 +02:00
/ >
) }
2019-05-08 03:29:30 +02:00
< p className = "help" >
{ _ _ ( 'This will prevent you from purchasing any content over a certain cost, as a safety measure.' ) }
< / p >
2019-02-13 17:27:20 +01:00
< / Form >
2018-03-26 23:32:43 +02:00
< / section >
2018-12-19 06:44:53 +01:00
2018-03-26 23:32:43 +02:00
< section className = "card card--section" >
2019-07-21 23:31:22 +02:00
< h2 className = "card__title" > { _ _ ( 'Purchase Confirmations' ) } < / h2 >
2018-12-19 06:44:53 +01:00
2019-07-21 23:31:22 +02:00
< Form >
2019-02-20 06:20:29 +01:00
< FormField
type = "radio"
name = "confirm_all_purchases"
checked = { ! instantPurchaseEnabled }
label = { _ _ ( 'Always confirm before purchasing content' ) }
onChange = { ( ) => {
this . onInstantPurchaseEnabledChange ( false ) ;
} }
/ >
< FormField
type = "radio"
name = "instant_purchases"
checked = { instantPurchaseEnabled }
label = { _ _ ( 'Only confirm purchases over a certain price' ) }
onChange = { ( ) => {
this . onInstantPurchaseEnabledChange ( true ) ;
} }
/ >
2018-04-11 00:05:30 +02:00
{ instantPurchaseEnabled && (
< FormFieldPrice
2019-02-13 17:27:20 +01:00
name = "confirmation_price"
2018-04-11 00:05:30 +02:00
min = { 0.1 }
onChange = { this . onInstantPurchaseMaxChange }
price = { instantPurchaseMax }
/ >
) }
2019-05-08 03:29:30 +02:00
< p className = "help" >
{ _ _ ( "When this option is chosen, LBRY won't ask you to confirm downloads below your chosen price." ) }
< / p >
2019-02-13 17:27:20 +01:00
< / Form >
2018-03-26 23:32:43 +02:00
< / section >
2018-12-19 06:44:53 +01:00
2018-03-26 23:32:43 +02:00
< section className = "card card--section" >
2019-07-21 23:31:22 +02:00
< h2 className = "card__title" > { _ _ ( 'Content Settings' ) } < / h2 >
2019-08-13 07:35:13 +02:00
< FormField
type = "checkbox"
name = "floating_player"
onChange = { ( ) => {
setClientSetting ( SETTINGS . FLOATING _PLAYER , ! floatingPlayer ) ;
2019-08-14 05:04:08 +02:00
clearPlayingUri ( ) ;
2019-08-13 07:35:13 +02:00
} }
checked = { floatingPlayer }
label = { _ _ ( 'Floating video player' ) }
helper = { _ _ ( 'Keep content playing in the corner when navigating to a different page.' ) }
/ >
2018-12-19 06:44:53 +01:00
2019-08-13 07:35:13 +02:00
< FormField
type = "checkbox"
name = "autoplay"
onChange = { ( ) => setClientSetting ( SETTINGS . AUTOPLAY , ! autoplay ) }
checked = { autoplay }
label = { _ _ ( 'Autoplay media files' ) }
helper = { _ _ (
'Autoplay video and audio files when navigating to a file, as well as the next related item when a file finishes playing.'
) }
/ >
< FormField
type = "checkbox"
name = "show_nsfw"
onChange = { ( ) => setClientSetting ( SETTINGS . SHOW _NSFW , ! showNsfw ) }
checked = { showNsfw }
label = { _ _ ( 'Show mature content' ) }
helper = { _ _ (
'Mature content may include nudity, intense sexuality, profanity, or other adult content. By displaying mature content, you are affirming you are of legal age to view mature content in your country or jurisdiction. '
) }
/ >
2018-03-26 23:32:43 +02:00
< / section >
2018-08-01 00:42:54 +02:00
2019-07-08 22:54:58 +02:00
< section className = "card card--section" >
< h2 className = "card__title" > { _ _ ( 'Blocked Channels' ) } < / h2 >
< p className = "card__subtitle card__help " >
{ _ _ ( 'You have' ) } { userBlockedChannelsCount } { _ _ ( 'blocked' ) } { ' ' }
{ userBlockedChannelsCount === 1 && _ _ ( 'channel' ) }
{ userBlockedChannelsCount !== 1 && _ _ ( 'channels' ) } . { ' ' }
< Button button = "link" label = { _ _ ( 'Manage' ) } navigate = { ` / $ / ${ PAGES . BLOCKED } ` } / >
< / p >
< / section >
2018-08-01 00:42:54 +02:00
< section className = "card card--section" >
2019-07-21 23:31:22 +02:00
< h2 className = "card__title" > { _ _ ( 'Notifications' ) } < / h2 >
< Form >
2018-12-19 06:44:53 +01:00
< FormField
2019-07-21 23:31:22 +02:00
type = "checkbox"
2018-12-19 06:44:53 +01:00
name = "desktopNotification"
2019-05-07 23:38:29 +02:00
onChange = { ( ) => setClientSetting ( SETTINGS . OS _NOTIFICATIONS _ENABLED , ! osNotificationsEnabled ) }
2018-12-19 06:44:53 +01:00
checked = { osNotificationsEnabled }
2019-02-13 17:27:20 +01:00
label = { _ _ ( 'Show Desktop Notifications' ) }
2019-05-07 23:38:29 +02:00
helper = { _ _ ( 'Get notified when a publish is confirmed, or when new content is available to watch.' ) }
2018-12-19 06:44:53 +01:00
/ >
2019-02-13 17:27:20 +01:00
< / Form >
2018-08-01 00:42:54 +02:00
< / section >
2018-03-26 23:32:43 +02:00
< section className = "card card--section" >
2019-07-21 23:31:22 +02:00
< h2 className = "card__title" > { _ _ ( 'Share Diagnostic Data' ) } < / h2 >
2018-12-19 06:44:53 +01:00
2019-07-21 23:31:22 +02:00
< Form >
2018-12-19 06:44:53 +01:00
< FormField
2019-07-21 23:31:22 +02:00
type = "checkbox"
2018-12-19 06:44:53 +01:00
name = "share_usage_data"
2019-05-07 23:38:29 +02:00
onChange = { ( ) => setDaemonSetting ( 'share_usage_data' , ! daemonSettings . share _usage _data ) }
2018-12-19 06:44:53 +01:00
checked = { daemonSettings . share _usage _data }
2019-07-17 20:04:50 +02:00
label = {
< React.Fragment >
{ _ _ ( 'Help make LBRY better by contributing analytics and diagnostic data about my usage.' ) } { ' ' }
< Button button = "link" label = { _ _ ( 'Learn more' ) } href = "https://lbry.com/privacypolicy" / > .
< / React.Fragment >
}
2019-05-07 23:38:29 +02:00
helper = { _ _ ( 'You will be ineligible to earn rewards while diagnostics are not being shared.' ) }
2018-12-19 06:44:53 +01:00
/ >
2019-02-13 17:27:20 +01:00
< / Form >
2018-03-26 23:32:43 +02:00
< / section >
2018-12-19 06:44:53 +01:00
2018-07-18 21:48:30 +02:00
< section className = "card card--section" >
2019-07-21 23:31:22 +02:00
< h2 className = "card__title" > { _ _ ( 'Appearance' ) } < / h2 >
2018-12-19 06:44:53 +01:00
2019-07-21 23:31:22 +02:00
< Form >
2019-02-13 17:27:20 +01:00
< fieldset - section >
2019-01-09 05:29:06 +01:00
< FormField
name = "theme_select"
type = "select"
2019-02-13 17:27:20 +01:00
label = { _ _ ( 'Theme' ) }
2019-01-09 05:29:06 +01:00
onChange = { this . onThemeChange }
value = { currentTheme }
disabled = { automaticDarkModeEnabled }
>
{ themes . map ( theme => (
< option key = { theme } value = { theme } >
{ theme }
< / option >
) ) }
< / FormField >
2019-02-13 17:27:20 +01:00
< / f i e l d s e t - s e c t i o n >
< fieldset - section >
< FormField
2019-07-21 23:31:22 +02:00
type = "checkbox"
2019-02-13 17:27:20 +01:00
name = "automatic_dark_mode"
onChange = { ( ) => this . onAutomaticDarkModeChange ( ! automaticDarkModeEnabled ) }
checked = { automaticDarkModeEnabled }
2019-08-18 18:54:55 +02:00
label = { _ _ ( 'Automatic dark mode' ) }
2019-02-13 17:27:20 +01:00
/ >
2019-08-19 18:10:48 +02:00
{ automaticDarkModeEnabled && (
2019-08-18 20:24:04 +02:00
< fieldset - group class = "fieldset-group--smushed" >
< FormField
type = "select"
name = "automatic_dark_mode_range"
onChange = { value => this . onChangeTime ( value , { fromTo : 'from' , time : 'hour' } ) }
value = { darkModeTimes . from . hour }
2019-08-19 18:10:48 +02:00
label = { _ _ ( 'From' ) }
2019-08-18 20:24:04 +02:00
>
{ startHours . map ( time => (
< option key = { time } value = { time } >
{ this . to12Hour ( time ) }
< / option >
) ) }
< / FormField >
< FormField
type = "select"
name = "automatic_dark_mode_range"
2019-08-19 18:10:48 +02:00
label = { _ _ ( 'To' ) }
2019-08-18 20:24:04 +02:00
onChange = { value => this . onChangeTime ( value , { fromTo : 'to' , time : 'hour' } ) }
value = { darkModeTimes . to . hour }
>
{ endHours . map ( time => (
< option key = { time } value = { time } >
{ this . to12Hour ( time ) }
< / option >
) ) }
< / FormField >
< / f i e l d s e t - g r o u p >
2019-08-19 18:10:48 +02:00
) }
2019-02-13 17:27:20 +01:00
< / f i e l d s e t - s e c t i o n >
< / Form >
2018-07-18 21:48:30 +02:00
< / section >
2018-12-19 06:44:53 +01:00
2018-07-18 21:48:30 +02:00
< section className = "card card--section" >
2019-07-21 23:31:22 +02:00
< h2 className = "card__title" > { _ _ ( 'Wallet Security' ) } < / h2 >
2018-12-19 06:44:53 +01:00
2019-07-21 23:31:22 +02:00
< Form >
2018-12-19 06:44:53 +01:00
< FormField
2019-07-21 23:31:22 +02:00
type = "checkbox"
2018-12-19 06:44:53 +01:00
name = "encrypt_wallet"
onChange = { ( ) => this . onChangeEncryptWallet ( ) }
checked = { walletEncrypted }
2019-07-19 22:21:41 +02:00
label = { _ _ ( 'Encrypt my wallet with a custom password' ) }
2018-12-19 06:44:53 +01:00
helper = {
< React.Fragment >
{ _ _ ( 'Secure your local wallet data with a custom password.' ) } { ' ' }
< strong > { _ _ ( 'Lost passwords cannot be recovered.' ) } < / strong >
2019-05-07 23:38:29 +02:00
< Button button = "link" label = { _ _ ( 'Learn more' ) } href = "https://lbry.com/faq/wallet-encryption" / > .
2018-12-19 06:44:53 +01:00
< / React.Fragment >
}
/ >
2019-07-29 17:37:29 +02:00
< FormField
type = "checkbox"
name = "hide_balance"
onChange = { ( ) => setClientSetting ( SETTINGS . HIDE _BALANCE , ! hideBalance ) }
checked = { hideBalance }
label = { _ _ ( 'Hide wallet balance in header' ) }
/ >
2019-02-13 17:27:20 +01:00
< / Form >
2018-08-29 02:05:14 +02:00
< / section >
2018-12-19 06:44:53 +01:00
2019-01-28 21:05:28 +01:00
< section className = "card card--section" >
2019-07-21 23:31:22 +02:00
< h2 className = "card__title" > { _ _ ( 'Experimental Settings' ) } < / h2 >
2019-01-28 21:05:28 +01:00
2019-07-21 23:31:22 +02:00
< Form >
2019-07-19 22:21:41 +02:00
< FormField
2019-07-23 22:13:06 +02:00
type = "checkbox"
2019-07-19 22:21:41 +02:00
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 >
}
/ >
2019-02-13 17:27:20 +01:00
< FormField
2019-07-21 23:31:22 +02:00
type = "checkbox"
2019-02-13 17:27:20 +01:00
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."
) }
/ >
2019-08-02 08:28:14 +02:00
< 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 >
2019-07-24 16:17:58 +02:00
< FormField
2019-08-02 08:28:14 +02:00
name = "max_connections"
2019-07-24 16:17:58 +02:00
type = "select"
2019-08-02 08:28:14 +02:00
label = { _ _ ( 'Max Connections' ) }
2019-08-13 07:35:13 +02:00
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.'
) }
2019-08-02 08:28:14 +02:00
min = { 1 }
max = { 100 }
onChange = { this . onMaxConnectionsChange }
2019-08-13 07:35:13 +02:00
value = { daemonSettings . max _connections _per _download }
2019-07-24 16:17:58 +02:00
>
2019-08-02 08:28:14 +02:00
{ connectionOptions . map ( connectionOption => (
< option key = { connectionOption } value = { connectionOption } >
{ connectionOption }
2019-07-24 16:17:58 +02:00
< / option >
) ) }
< / FormField >
2019-08-02 08:28:14 +02:00
< / f i e l d s e t - s e c t i o n >
2019-02-13 17:27:20 +01:00
< / Form >
2019-01-28 21:05:28 +01:00
< / section >
2018-03-26 23:32:43 +02:00
< section className = "card card--section" >
2019-07-21 23:31:22 +02:00
< h2 className = "card__title" > { _ _ ( 'Application Cache' ) } < / h2 >
2018-12-19 06:44:53 +01:00
2019-07-21 23:31:22 +02:00
< p className = "card__subtitle--status" >
2019-07-24 16:17:58 +02:00
{ _ _ (
2019-08-13 07:35:13 +02:00
'This will clear the application cache. Your wallet will not be affected. Currently, followed tags and blocked channels will be cleared.'
2019-07-24 16:17:58 +02:00
) }
2019-05-08 03:29:30 +02:00
< / p >
2019-07-21 23:31:22 +02:00
< Button
button = "inverse"
label = { this . state . clearingCache ? _ _ ( 'Clearing' ) : _ _ ( 'Clear Cache' ) }
onClick = { this . clearCache }
disabled = { this . state . clearingCache }
/ >
2018-03-26 23:32:43 +02:00
< / section >
2019-03-18 06:06:41 +01:00
< / div >
2018-03-26 23:32:43 +02:00
) }
< / Page >
2016-04-10 02:00:56 +02:00
) ;
}
2017-05-17 10:10:25 +02:00
}
2016-11-22 21:19:08 +01:00
export default SettingsPage ;