@@ -76,6 +76,17 @@ const App = (() => {
7676 const parseURL = ( ) => {
7777 const path = window . location . pathname ;
7878
79+ // Check for settings page pattern: /github/(all|org)/settings
80+ const settingsMatch = path . match ( / ^ \/ g i t h u b \/ ( a l l | [ ^ \/ ] + ) \/ s e t t i n g s $ / ) ;
81+ if ( settingsMatch ) {
82+ const [ , orgOrAll ] = settingsMatch ;
83+ return {
84+ org : orgOrAll === "all" ? null : orgOrAll ,
85+ username : state . currentUser ?. login ,
86+ isSettings : true ,
87+ } ;
88+ }
89+
7990 // Check for stats page pattern: /github/(all|org)/stats
8091 const statsMatch = path . match ( / ^ \/ g i t h u b \/ ( a l l | [ ^ \/ ] + ) \/ s t a t s $ / ) ;
8192 if ( statsMatch ) {
@@ -1241,7 +1252,7 @@ const App = (() => {
12411252
12421253 // Setup navigation links
12431254 const urlContext = parseURL ( ) ;
1244- if ( urlContext ) {
1255+ if ( urlContext && urlContext . username ) {
12451256 const { org, username } = urlContext ;
12461257 const basePath = org
12471258 ? `/github/${ org } /${ username } `
@@ -1280,7 +1291,7 @@ const App = (() => {
12801291 notificationsLink . addEventListener ( "click" , ( e ) => {
12811292 e . preventDefault ( ) ;
12821293 closeMenu ( ) ;
1283- showNotificationsPage ( ) ;
1294+ window . location . href = '/notifications' ;
12841295 } ) ;
12851296 }
12861297
@@ -1290,7 +1301,7 @@ const App = (() => {
12901301 settingsLink . addEventListener ( "click" , ( e ) => {
12911302 e . preventDefault ( ) ;
12921303 closeMenu ( ) ;
1293- showSettingsPage ( ) ;
1304+ window . location . href = '/github/all/settings' ;
12941305 } ) ;
12951306 }
12961307 }
@@ -1800,6 +1811,41 @@ const App = (() => {
18001811 return ;
18011812 }
18021813
1814+ // Handle notifications page routing
1815+ const path = window . location . pathname ;
1816+ if ( path === '/notifications' ) {
1817+ // Load user first if not already loaded
1818+ const token = getStoredToken ( ) ;
1819+ if ( token ) {
1820+ state . accessToken = token ;
1821+ try {
1822+ await loadCurrentUser ( ) ;
1823+ updateUserDisplay ( ) ;
1824+ } catch ( error ) {
1825+ console . error ( "Failed to load user:" , error ) ;
1826+ }
1827+ }
1828+ showNotificationsPage ( ) ;
1829+ return ;
1830+ }
1831+
1832+ // Handle settings page routing
1833+ if ( path . match ( / ^ \/ g i t h u b \/ ( a l l | [ ^ \/ ] + ) \/ s e t t i n g s $ / ) ) {
1834+ // Load user first if not already loaded
1835+ const token = getStoredToken ( ) ;
1836+ if ( token ) {
1837+ state . accessToken = token ;
1838+ try {
1839+ await loadCurrentUser ( ) ;
1840+ updateUserDisplay ( ) ;
1841+ } catch ( error ) {
1842+ console . error ( "Failed to load user:" , error ) ;
1843+ }
1844+ }
1845+ showSettingsPage ( ) ;
1846+ return ;
1847+ }
1848+
18031849 // Setup event listeners
18041850 const orgSelect = $ ( "orgSelect" ) ;
18051851 const searchInput = $ ( "searchInput" ) ;
@@ -2682,11 +2728,14 @@ const App = (() => {
26822728 hide ( $ ( "settingsPage" ) ) ;
26832729 show ( $ ( "notificationsPage" ) ) ;
26842730
2731+ // Update page title
2732+ document . title = "Notifications - Ready to Review" ;
2733+
26852734 // Add click handler for "Configure in Robot Army" button
26862735 const goToRobotArmyBtn = $ ( "goToRobotArmy" ) ;
26872736 if ( goToRobotArmyBtn ) {
26882737 goToRobotArmyBtn . onclick = ( ) => {
2689- showSettingsPage ( ) ;
2738+ window . location . href = '/github/all/settings' ;
26902739 } ;
26912740 }
26922741 } ;
@@ -2697,8 +2746,49 @@ const App = (() => {
26972746 hide ( $ ( "notificationsPage" ) ) ;
26982747 show ( $ ( "settingsPage" ) ) ;
26992748
2700- // Load organizations
2701- await loadOrganizationsForSettings ( ) ;
2749+ // Check if we're on an org-specific settings URL
2750+ const path = window . location . pathname ;
2751+ const settingsMatch = path . match ( / ^ \/ g i t h u b \/ ( [ ^ \/ ] + ) \/ s e t t i n g s $ / ) ;
2752+
2753+ if ( settingsMatch && settingsMatch [ 1 ] !== 'all' ) {
2754+ const [ , org ] = settingsMatch ;
2755+ selectedOrg = org ;
2756+
2757+ // Update page title
2758+ document . title = `${ org } 's Robot Army` ;
2759+
2760+ // Hide org selection and show robot config directly
2761+ hide ( $ ( "orgSelectSettings" ) . parentElement . parentElement ) ;
2762+
2763+ // Update YAML path displays
2764+ const yamlPath = `${ selectedOrg } /.github/.github/codegroove.yaml` ;
2765+ const yamlPathEl = $ ( "yamlPath" ) ;
2766+ const yamlPathModalEl = $ ( "yamlPathModal" ) ;
2767+ if ( yamlPathEl ) yamlPathEl . textContent = yamlPath ;
2768+ if ( yamlPathModalEl ) yamlPathModalEl . textContent = yamlPath ;
2769+
2770+ // Initialize robot configs if empty
2771+ if ( Object . keys ( robotConfigs ) . length === 0 ) {
2772+ // Initialize with all robots disabled by default
2773+ robotDefinitions . forEach ( robot => {
2774+ robotConfigs [ robot . id ] = {
2775+ enabled : false ,
2776+ config : { }
2777+ } ;
2778+ } ) ;
2779+ }
2780+
2781+ // Show robot configuration
2782+ show ( $ ( "robotConfig" ) ) ;
2783+ renderRobotCards ( ) ;
2784+ } else {
2785+ // We're on /github/all/settings - show org selection
2786+ document . title = "Robot Army Configuration" ;
2787+ show ( $ ( "orgSelectSettings" ) . parentElement . parentElement ) ;
2788+ hide ( $ ( "robotConfig" ) ) ;
2789+ // Load organizations for selection
2790+ await loadOrganizationsForSettings ( ) ;
2791+ }
27022792 } ;
27032793
27042794 const loadOrganizationsForSettings = async ( ) => {
@@ -2773,13 +2863,31 @@ const App = (() => {
27732863 return ;
27742864 }
27752865
2866+ // Redirect to org-specific settings URL
2867+ const user = state . currentUser || state . viewingUser ;
2868+ if ( user ) {
2869+ window . location . href = `/github/${ selectedOrg } /settings` ;
2870+ return ;
2871+ }
2872+
27762873 // Update YAML path displays
27772874 const yamlPath = `${ selectedOrg } /.github/.github/codegroove.yaml` ;
27782875 const yamlPathEl = $ ( "yamlPath" ) ;
27792876 const yamlPathModalEl = $ ( "yamlPathModal" ) ;
27802877 if ( yamlPathEl ) yamlPathEl . textContent = yamlPath ;
27812878 if ( yamlPathModalEl ) yamlPathModalEl . textContent = yamlPath ;
27822879
2880+ // Initialize robot configs if empty
2881+ if ( Object . keys ( robotConfigs ) . length === 0 ) {
2882+ // Initialize with all robots disabled by default
2883+ robotDefinitions . forEach ( robot => {
2884+ robotConfigs [ robot . id ] = {
2885+ enabled : false ,
2886+ config : { }
2887+ } ;
2888+ } ) ;
2889+ }
2890+
27832891 // Show robot configuration
27842892 show ( $ ( "robotConfig" ) ) ;
27852893 renderRobotCards ( ) ;
0 commit comments