import React from 'react'; import {FormField, FormRow} from '../component/form.js'; import lbry from '../lbry.js'; var SettingsPage = React.createClass({ onRunOnStartChange: function (event) { lbry.setDaemonSetting('run_on_startup', event.target.checked); }, onShareDataChange: function (event) { lbry.setDaemonSetting('share_debug_info', event.target.checked); }, onDownloadDirChange: function(event) { lbry.setDaemonSetting('download_directory', event.target.value); }, onMaxUploadPrefChange: function(isLimited) { if (!isLimited) { lbry.setDaemonSetting('max_upload', 0.0); } this.setState({ isMaxUpload: isLimited }); }, onMaxUploadFieldChange: function(event) { lbry.setDaemonSetting('max_upload', Number(event.target.value)); }, onMaxDownloadPrefChange: function(isLimited) { if (!isLimited) { lbry.setDaemonSetting('max_download', 0.0); } this.setState({ isMaxDownload: isLimited }); }, onMaxDownloadFieldChange: function(event) { lbry.setDaemonSetting('max_download', Number(event.target.value)); }, getInitialState: function() { return { settings: null, showNsfw: lbry.getClientSetting('showNsfw'), showUnavailable: lbry.getClientSetting('showUnavailable'), } }, componentDidMount: function() { document.title = "Settings"; }, componentWillMount: function() { lbry.getDaemonSettings(function(settings) { this.setState({ daemonSettings: settings, isMaxUpload: settings.max_upload != 0, isMaxDownload: settings.max_download != 0 }); }.bind(this)); }, onShowNsfwChange: function(event) { lbry.setClientSetting('showNsfw', event.target.checked); }, onShowUnavailableChange: function(event) { lbry.setClientSetting('showUnavailable', event.target.checked); }, render: function() { if (!this.state.daemonSettings) { return null; } return (

Run on Startup

Download Directory

Bandwidth Limits

Max Upload

{ this.state.isMaxUpload ? : '' }

Max Download

Content

Share Diagnostic Data

); } }); /*

Search

Would you like search results to include items that are not currently available for download?

Share Diagnostic Data

*/ export default SettingsPage;