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