@@ -608,7 +608,7 @@ const App = (() => {
608608 return ;
609609 }
610610
611- User . updateUserDisplay ( state , initiateLogin ) ;
611+ User . updateUserDisplay ( state , initiateLogin , logout ) ;
612612 User . updateOrgFilter ( state , parseURL , githubAPI ) ;
613613 showMainContentWithLoading ( ) ;
614614
@@ -684,7 +684,7 @@ const App = (() => {
684684 if ( urlContext && urlContext . isStats ) {
685685 updateSearchInputVisibility ( ) ;
686686 await Stats . showStatsPage ( state , githubAPI , loadCurrentUser ,
687- ( ) => User . updateUserDisplay ( state , initiateLogin ) ,
687+ ( ) => User . updateUserDisplay ( state , initiateLogin , logout ) ,
688688 setupHamburgerMenu ,
689689 ( ) => User . updateOrgFilter ( state , parseURL , githubAPI ) ,
690690 handleOrgChange , handleSearch , parseURL , User . loadUserOrganizations ) ;
@@ -698,7 +698,7 @@ const App = (() => {
698698 if ( token ) {
699699 try {
700700 await loadCurrentUser ( ) ;
701- User . updateUserDisplay ( state , initiateLogin ) ;
701+ User . updateUserDisplay ( state , initiateLogin , logout ) ;
702702 setupHamburgerMenu ( ) ;
703703 await User . updateOrgFilter ( state , parseURL , githubAPI ) ;
704704
@@ -725,7 +725,7 @@ const App = (() => {
725725 if ( urlContext && urlContext . isLeaderboard ) {
726726 updateSearchInputVisibility ( ) ;
727727 await Leaderboard . showLeaderboardPage ( state , githubAPI , loadCurrentUser ,
728- ( ) => User . updateUserDisplay ( state , initiateLogin ) ,
728+ ( ) => User . updateUserDisplay ( state , initiateLogin , logout ) ,
729729 setupHamburgerMenu ,
730730 ( ) => User . updateOrgFilter ( state , parseURL , githubAPI ) ,
731731 handleOrgChange , handleSearch , parseURL , User . loadUserOrganizations ) ;
@@ -739,7 +739,7 @@ const App = (() => {
739739 if ( token ) {
740740 try {
741741 await loadCurrentUser ( ) ;
742- User . updateUserDisplay ( state , initiateLogin ) ;
742+ User . updateUserDisplay ( state , initiateLogin , logout ) ;
743743 setupHamburgerMenu ( ) ;
744744 } catch ( error ) {
745745 console . error ( "Failed to load user for notifications:" , error ) ;
@@ -770,7 +770,7 @@ const App = (() => {
770770 }
771771 }
772772
773- User . updateUserDisplay ( state , initiateLogin ) ;
773+ User . updateUserDisplay ( state , initiateLogin , logout ) ;
774774
775775 // Always update org filter to ensure dropdown is populated
776776 await User . updateOrgFilter ( state , parseURL , githubAPI ) ;
@@ -815,8 +815,32 @@ const App = (() => {
815815 await handlePRAction ( action , prId ) ;
816816 } ) ;
817817
818- // Note: Modal interactions are handled via inline onclick handlers in HTML
819- // No additional event listeners needed here
818+ // Modal event listeners
819+ const githubAppLoginBtn = $ ( "githubAppLoginBtn" ) ;
820+ const patLoginBtn = $ ( "patLoginBtn" ) ;
821+ const githubAppModalBackdrop = $ ( "githubAppModalBackdrop" ) ;
822+ const closeGitHubAppModalBtn = $ ( "closeGitHubAppModalBtn" ) ;
823+ const cancelGitHubAppBtn = $ ( "cancelGitHubAppBtn" ) ;
824+ const proceedWithOAuthBtn = $ ( "proceedWithOAuthBtn" ) ;
825+ const patModalBackdrop = $ ( "patModalBackdrop" ) ;
826+ const closePATModalBtn = $ ( "closePATModalBtn" ) ;
827+ const submitPATBtn = $ ( "submitPATBtn" ) ;
828+ const yamlModalBackdrop = $ ( "yamlModalBackdrop" ) ;
829+ const closeYAMLModalBtn = $ ( "closeYAMLModalBtn" ) ;
830+ const copyYamlBtn = $ ( "copyYaml" ) ;
831+
832+ if ( githubAppLoginBtn ) githubAppLoginBtn . addEventListener ( "click" , showGitHubAppModal ) ;
833+ if ( patLoginBtn ) patLoginBtn . addEventListener ( "click" , initiatePATLogin ) ;
834+ if ( githubAppModalBackdrop ) githubAppModalBackdrop . addEventListener ( "click" , closeGitHubAppModal ) ;
835+ if ( closeGitHubAppModalBtn ) closeGitHubAppModalBtn . addEventListener ( "click" , closeGitHubAppModal ) ;
836+ if ( cancelGitHubAppBtn ) cancelGitHubAppBtn . addEventListener ( "click" , closeGitHubAppModal ) ;
837+ if ( proceedWithOAuthBtn ) proceedWithOAuthBtn . addEventListener ( "click" , proceedWithOAuth ) ;
838+ if ( patModalBackdrop ) patModalBackdrop . addEventListener ( "click" , closePATModal ) ;
839+ if ( closePATModalBtn ) closePATModalBtn . addEventListener ( "click" , closePATModal ) ;
840+ if ( submitPATBtn ) submitPATBtn . addEventListener ( "click" , submitPAT ) ;
841+ if ( yamlModalBackdrop ) yamlModalBackdrop . addEventListener ( "click" , closeYAMLModal ) ;
842+ if ( closeYAMLModalBtn ) closeYAMLModalBtn . addEventListener ( "click" , closeYAMLModal ) ;
843+ if ( copyYamlBtn ) copyYamlBtn . addEventListener ( "click" , copyYAML ) ;
820844
821845 if ( $ ( "patInput" ) ) {
822846 $ ( "patInput" ) . addEventListener ( "keypress" , ( e ) => {
@@ -866,7 +890,7 @@ const App = (() => {
866890 state . viewingUser = await githubAPI ( `/users/${ urlContext . username } ` ) ;
867891
868892 showLoginPrompt ( ) ;
869- User . updateUserDisplay ( state , initiateLogin ) ;
893+ User . updateUserDisplay ( state , initiateLogin , logout ) ;
870894
871895 // Load public data
872896 await User . updateOrgFilter ( state , parseURL , githubAPI ) ;
@@ -909,7 +933,7 @@ const App = (() => {
909933 }
910934 }
911935
912- User . updateUserDisplay ( state , initiateLogin ) ;
936+ User . updateUserDisplay ( state , initiateLogin , logout ) ;
913937 await User . updateOrgFilter ( state , parseURL , githubAPI ) ;
914938
915939 // Only load PRs if we're on the PR dashboard page
0 commit comments