File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -76,4 +76,26 @@ function loadLeaderboard() {
7676 tbody . appendChild ( row ) ;
7777 } ) ;
7878 } ) ;
79- }
79+ }
80+
81+ function checkResults ( ) {
82+ fetch ( "https://your-glitch-app.glitch.me/check-results" , { method : "POST" } )
83+ . then ( res => res . json ( ) )
84+ . then ( data => alert ( `Updated games: ${ data . updatedGames . length } ` ) ) ;
85+ }
86+
87+ function startRound ( ) {
88+ fetch ( "https://your-glitch-app.glitch.me/start-round" , { method : "POST" } )
89+ . then ( res => res . json ( ) )
90+ . then ( data => alert ( `Started new round with ${ data . pairings } games.` ) ) ;
91+ }
92+
93+ auth . onAuthStateChanged ( async ( user ) => {
94+ if ( user ) {
95+ const email = user . email ;
96+ if ( email === "[email protected] " ) { 97+ document . getElementById ( "admin-panel" ) . style . display = "block" ;
98+ }
99+ loadLeaderboard ( ) ;
100+ }
101+ } ) ;
Original file line number Diff line number Diff line change @@ -24,4 +24,10 @@ <h2>Leaderboard</h2>
2424 < tr > < th > Name</ th > < th > Score</ th > </ tr >
2525 </ thead >
2626 < tbody > </ tbody >
27- </ table >
27+ </ table >
28+
29+ < div id ="admin-panel " style ="display:none; ">
30+ < h2 > Admin Panel</ h2 >
31+ < button onclick ="startRound() "> Start New Round</ button >
32+ < button onclick ="checkResults() "> Check Results</ button >
33+ </ div >
You can’t perform that action at this time.
0 commit comments