tAdd new popup for submitted flags and cleanup drawing/focus - scoreboard - Interactive scoreboard for CTF-like games
 (HTM) git clone git://git.z3bra.org/scoreboard.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit 0503ec4c0e923db118064edb9db6648eebc33478
 (DIR) parent 9bb93f39ff3606bde881bbdee57b5fb355613aa2
 (HTM) Author: Willy Goiffon <contact@z3bra.org>
       Date:   Wed,  2 Oct 2024 23:53:34 +0200
       
       Add new popup for submitted flags and cleanup drawing/focus
       
       Diffstat:
         M main.go                             |       1 +
         M ui.go                               |       5 +++--
       
       2 files changed, 4 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/main.go b/main.go
       t@@ -180,6 +180,7 @@ func main() {
                                        scoreboard.HighlightBoard(scoreboard.player.Rank() + 1)
                                        scoreboard.pages.RemovePage("token")
                                        scoreboard.GenerateHTML()
       +                                scoreboard.Popup("CONGRATULATIONS", fmt.Sprintf("[::-]Badge: [::b]%s[::-]\nScore: [::b]%d[::-]\n", scoreboard.flag.badge, scoreboard.flag.score))
                                })
        
                                scoreboard.pages.AddAndSwitchToPage("token", page, true)
 (DIR) diff --git a/ui.go b/ui.go
       t@@ -199,6 +199,7 @@ func (a *Application) Message(title, text string) {
                })
        
                a.pages.AddAndSwitchToPage("popup", p, true)
       +        a.app.SetFocus(p)
        }
        
        func (a *Application) Popup(title, text string) {
       t@@ -207,6 +208,7 @@ func (a *Application) Popup(title, text string) {
                })
        
                a.pages.AddAndSwitchToPage("popup", p, true)
       +        a.app.SetFocus(p)
        }
        
        func (a *Application) Fatal(err error) {
       t@@ -215,6 +217,7 @@ func (a *Application) Fatal(err error) {
                })
        
                a.pages.AddAndSwitchToPage("popup", p, true)
       +        a.app.SetFocus(p)
        }
        
        func (a *Application) Token(callback func()) tview.Primitive {
       t@@ -260,8 +263,6 @@ func (a *Application) Token(callback func()) tview.Primitive {
                                }
        
                                a.pages.RemovePage("token");
       -                        a.frame.Clear()
       -                        a.frame.AddText(fmt.Sprintf("🔑%s", a.player.token), false, tview.AlignCenter, 0)
                                callback()
                        })