summaryrefslogtreecommitdiff
path: root/ext/js/pages/settings/audio-controller.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-05-26 20:40:53 -0400
committerGitHub <noreply@github.com>2021-05-26 20:40:53 -0400
commit8ed712512b43c3a546369bfdd247a7c1bb347c4f (patch)
tree9a92cb60c45956ce9d5e3eaf89319661ad74d43d /ext/js/pages/settings/audio-controller.js
parent0232325f960b1fbe41e03f74a46fb18a7abf33f7 (diff)
Add some help popups for custom audio sources (#1712)
Diffstat (limited to 'ext/js/pages/settings/audio-controller.js')
-rw-r--r--ext/js/pages/settings/audio-controller.js36
1 files changed, 35 insertions, 1 deletions
diff --git a/ext/js/pages/settings/audio-controller.js b/ext/js/pages/settings/audio-controller.js
index 6b1ce0b5..dcc5428e 100644
--- a/ext/js/pages/settings/audio-controller.js
+++ b/ext/js/pages/settings/audio-controller.js
@@ -20,8 +20,9 @@
*/
class AudioController {
- constructor(settingsController) {
+ constructor(settingsController, modalController) {
this._settingsController = settingsController;
+ this._modalController = modalController;
this._audioSystem = new AudioSystem();
this._audioSourceContainer = null;
this._audioSourceAddButton = null;
@@ -166,6 +167,7 @@ class AudioController {
eventListeners.addEventListener(removeButton, 'click', this._onAudioSourceRemoveClicked.bind(this, entry), false);
}
if (menuButton !== null) {
+ eventListeners.addEventListener(menuButton, 'menuOpen', this._onMenuOpen.bind(this, entry), false);
eventListeners.addEventListener(menuButton, 'menuClose', this._onMenuClose.bind(this, entry), false);
}
@@ -222,11 +224,43 @@ class AudioController {
this._removeAudioSourceEntry(entry);
}
+ _onMenuOpen(entry, e) {
+ const {menu} = e.detail;
+
+ let hasHelp = false;
+ switch (entry.value) {
+ case 'custom':
+ case 'custom-json':
+ hasHelp = true;
+ break;
+ }
+
+ menu.bodyNode.querySelector('.popup-menu-item[data-menu-action=help]').hidden = !hasHelp;
+ }
+
_onMenuClose(entry, e) {
switch (e.detail.action) {
+ case 'help':
+ this._showHelp(entry.value);
+ break;
case 'remove':
this._removeAudioSourceEntry(entry);
break;
}
}
+
+ _showHelp(type) {
+ switch (type) {
+ case 'custom':
+ this._showModal('audio-source-help-custom');
+ break;
+ case 'custom-json':
+ this._showModal('audio-source-help-custom-json');
+ break;
+ }
+ }
+
+ _showModal(name) {
+ this._modalController.getModal(name).setVisible(true);
+ }
}