Simplify developer menu logic
This commit is contained in:
parent
694eb77b0b
commit
302a1029bd
2 changed files with 8 additions and 11 deletions
15
js/lbry.js
15
js/lbry.js
|
@ -18,7 +18,7 @@ var lbry = {
|
|||
debug: false,
|
||||
useCustomLighthouseServers: false,
|
||||
customLighthouseServers: [],
|
||||
menu: 'normal',
|
||||
showDeveloperMenubar: false,
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -560,15 +560,12 @@ lbry.fileInfoUnsubscribe = function(name, subscribeId) {
|
|||
}
|
||||
|
||||
lbry.showMenuIfNeeded = function() {
|
||||
const showingMenu = sessionStorage.getItem('menuShown');
|
||||
const chosenMenu = lbry.getClientSetting('menu');
|
||||
if (!showingMenu || showingMenu != chosenMenu) {
|
||||
if (chosenMenu == 'normal') {
|
||||
menu.showNormalMenubar();
|
||||
} else {
|
||||
menu.showDeveloperMenubar();
|
||||
}
|
||||
const showingMenu = sessionStorage.getItem('menuShown') || null;
|
||||
const chosenMenu = lbry.getClientSetting('showDeveloperMenu') ? 'developer' : 'normal';
|
||||
if (chosenMenu != showingMenu) {
|
||||
menu.showMenubar(chosenMenu == 'developer');
|
||||
}
|
||||
sessionStorage.setItem('menuShown', chosenMenu);
|
||||
};
|
||||
|
||||
export default lbry;
|
||||
|
|
|
@ -5,13 +5,13 @@ import FormField from '../component/form.js';
|
|||
const DeveloperPage = React.createClass({
|
||||
getInitialState: function() {
|
||||
return {
|
||||
showDeveloperMenu: lbry.getClientSetting('menu') == 'developer',
|
||||
showDeveloperMenu: lbry.getClientSetting('showDeveloperMenu'),
|
||||
useCustomLighthouseServers: lbry.getClientSetting('useCustomLighthouseServers'),
|
||||
customLighthouseServers: lbry.getClientSetting('customLighthouseServers').join('\n'),
|
||||
};
|
||||
},
|
||||
handleShowDeveloperMenuChange: function(event) {
|
||||
lbry.setClientSetting('menu', event.target.checked ? 'developer' : 'normal');
|
||||
lbry.setClientSetting('showDeveloperMenu', event.target.checked);
|
||||
lbry.showMenuIfNeeded();
|
||||
this.setState({
|
||||
showDeveloperMenu: event.target.checked,
|
||||
|
|
Loading…
Reference in a new issue