Sfoglia il codice sorgente

Allow users to open Settings and specific tabs from a URL

jelveh 1 giorno fa
parent
commit
a1b96b7130
2 ha cambiato i file con 13 aggiunte e 1 eliminazioni
  1. 11 0
      src/gui/src/UI/Settings/UIWindowSettings.js
  2. 2 1
      src/gui/src/UI/UIDesktop.js

+ 11 - 0
src/gui/src/UI/Settings/UIWindowSettings.js

@@ -118,6 +118,17 @@ async function UIWindowSettings(options){
             }
         });
 
+        // If options.tab is provided, open that tab
+        if (options.tab) {
+            const $tabToOpen = $el_window.find(`.settings-sidebar-item[data-settings="${options.tab}"]`);
+            if ($tabToOpen.length > 0) {
+                console.log('tabToOpen', $tabToOpen);
+                setTimeout(() => {
+                    $tabToOpen.trigger('click');
+                }, 50);
+            }
+        }
+
         $(el_window).on('click', '.settings-sidebar-item', function(){
             const $this = $(this);
             const settings = $this.attr('data-settings');

+ 2 - 1
src/gui/src/UI/UIDesktop.js

@@ -1249,8 +1249,9 @@ async function UIDesktop(options) {
     else if (window.url_paths[0]?.toLocaleLowerCase() === 'settings') {
         // open settings
         UIWindowSettings({
+            tab: window.url_paths[1] || 'about',
             window_options: {
-                // is_fullpage: true,
+                is_fullpage: true,
             }
         });
     }