tAdd help popup for keys - scoreboard - Interactive scoreboard for CTF-like games
 (HTM) git clone git://git.z3bra.org/scoreboard.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit 9c55823c4faf89839bc65b1972a36b71debcc42c
 (DIR) parent 2db1381cace960339b3408f5f18ddf70c814cfb3
 (HTM) Author: Willy Goiffon <contact@z3bra.org>
       Date:   Fri, 27 Sep 2024 19:45:26 +0200
       
       Add help popup for keys
       
       Diffstat:
         M ui.go                               |      17 ++++++++++++++++-
       
       1 file changed, 16 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/ui.go b/ui.go
       t@@ -9,6 +9,18 @@ import (
                "github.com/dustin/go-humanize"
        )
        
       +const (
       +        HELP_TEXT = `
       +
       +Press H for help
       +Press L to login
       +ENTER for badges
       +
       +
       + Log in and select your name to see your flags
       +`
       +)
       +
        func center(width, height int, p tview.Primitive) tview.Primitive {
                return tview.NewFlex().
                        AddItem(nil, 0, 1, false).
       t@@ -98,7 +110,7 @@ func (a *Application) SetupFrame() {
                grid.AddItem(a.board, 1, 0, 1, 1, BOARD_HEIGHT, BOARD_WIDTH, true)
        
                a.frame = tview.NewFrame(grid)
       -        a.frame.AddText(fmt.Sprintf("press 'l' to login"), false, tview.AlignCenter, 0)
       +        a.frame.AddText(fmt.Sprintf("press 'h' for help"), false, tview.AlignCenter, 0)
        }
        
        func (a *Application) DrawBoard() {
       t@@ -112,6 +124,9 @@ func (a *Application) DrawBoard() {
                                a.app.Stop()
                                return nil
                        }
       +                if event.Rune() == 'h' {
       +                        a.Popup("HELP", HELP_TEXT)
       +                }
                        if event.Rune() == 'l' && a.player.token == "" {
                                page := a.Token(func () {
                                        a.pages.RemovePage("token")