lbry-desktop/ui/js/page/developer.js

52 lines
2 KiB
JavaScript
Raw Normal View History

2016-12-29 10:23:28 +01:00
import lbry from '../lbry.js';
import React from 'react';
import FormField from '../component/form.js';
const DeveloperPage = React.createClass({
getInitialState: function() {
return {
2017-03-09 00:14:43 +01:00
showDeveloperMenu: lbry.getClientSetting('showDeveloperMenu'),
2016-12-29 10:23:28 +01:00
useCustomLighthouseServers: lbry.getClientSetting('useCustomLighthouseServers'),
customLighthouseServers: lbry.getClientSetting('customLighthouseServers').join('\n'),
};
},
handleShowDeveloperMenuChange: function(event) {
2017-03-09 00:14:43 +01:00
lbry.setClientSetting('showDeveloperMenu', event.target.checked);
lbry.showMenuIfNeeded();
2016-12-29 10:23:28 +01:00
this.setState({
showDeveloperMenu: event.target.checked,
2016-12-29 10:23:28 +01:00
});
},
handleUseCustomLighthouseServersChange: function(event) {
lbry.setClientSetting('useCustomLighthouseServers', event.target.checked);
this.setState({
useCustomLighthouseServers: event.target.checked,
});
},
render: function() {
return (
<main>
<section className="card">
<h3>Developer Settings</h3>
<div className="form-row">
<label><FormField type="checkbox" onChange={this.handleShowDeveloperMenuChange} checked={this.state.showDeveloperMenu} /> Show developer menu</label>
2016-12-29 10:23:28 +01:00
</div>
<div className="form-row">
<label><FormField type="checkbox" onChange={this.handleUseCustomLighthouseServersChange} checked={this.state.useCustomLighthouseServers} /> Use custom search servers</label>
</div>
{this.state.useCustomLighthouseServers
? <div className="form-row">
<label>
Custom search servers (one per line)
<div><FormField type="textarea" className="developer-page__custom-lighthouse-servers" value={this.state.customLighthouseServers} onChange={this.handleCustomLighthouseServersChange} checked={this.state.debugMode} /></div>
</label>
</div>
: null}
</section>
</main>
);
}
});
export default DeveloperPage;