1- import { StrictMode , useState } from "react" ;
1+ import { StrictMode , useState , useEffect } from "react" ;
22import { App , PluginSettingTab } from "obsidian" ;
33import type DiscourseGraphPlugin from "~/index" ;
44import { Root , createRoot } from "react-dom/client" ;
@@ -7,11 +7,26 @@ import RelationshipTypeSettings from "./RelationshipTypeSettings";
77import RelationshipSettings from "./RelationshipSettings" ;
88import NodeTypeSettings from "./NodeTypeSettings" ;
99import GeneralSettings from "./GeneralSettings" ;
10+ import { AdminPanelSettings } from "./AdminPanelSettings" ;
1011import { PluginProvider } from "./PluginContext" ;
1112
1213const Settings = ( ) => {
1314 const [ activeTab , setActiveTab ] = useState ( "general" ) ;
1415
16+ useEffect ( ( ) => {
17+ const handleKeyPress = ( e : KeyboardEvent ) => {
18+ const isMod = e . metaKey || e . ctrlKey ;
19+ if ( isMod && e . shiftKey && e . key . toLowerCase ( ) === "a" ) {
20+ e . stopPropagation ( ) ;
21+ e . preventDefault ( ) ;
22+ setActiveTab ( "admin-panel" ) ;
23+ }
24+ } ;
25+
26+ window . addEventListener ( "keydown" , handleKeyPress ) ;
27+ return ( ) => window . removeEventListener ( "keydown" , handleKeyPress ) ;
28+ } , [ ] ) ;
29+
1530 return (
1631 < div className = "flex flex-col gap-4" >
1732 < h2 className = "dg-h2" > Discourse Graph Settings</ h2 >
@@ -56,13 +71,20 @@ const Settings = () => {
5671 >
5772 Discourse Relations
5873 </ button >
74+ { /* Hidden Admin Panel tab - only visible when activeTab is "admin-panel" */ }
75+ { activeTab === "admin-panel" && (
76+ < button className = "!bg-modifier-hover accent-border-bottom mr-2 cursor-pointer border-0 px-4 py-2" >
77+ Admin Panel
78+ </ button >
79+ ) }
5980 </ div >
6081
6182 { activeTab === "general" && < GeneralSettings /> }
6283 { activeTab === "nodeTypes" && < NodeTypeSettings /> }
6384 { activeTab === "relationTypes" && < RelationshipTypeSettings /> }
6485 { activeTab === "relations" && < RelationshipSettings /> }
6586 { activeTab === "frontmatter" && < GeneralSettings /> }
87+ { activeTab === "admin-panel" && < AdminPanelSettings /> }
6688 </ div >
6789 ) ;
6890} ;
0 commit comments