]> git.r.bdr.sh - rbdr/mobius/blobdiff - hotline/ui.go
Update dependencies
[rbdr/mobius] / hotline / ui.go
index 741c9a69e9d2b4b82821795911ea235d6b306623..168bf3aecddb96938fb80a2ba5e52bd411cb64bf 100644 (file)
@@ -1,12 +1,11 @@
 package hotline
 
 import (
-       "errors"
        "fmt"
        "github.com/davecgh/go-spew/spew"
        "github.com/gdamore/tcell/v2"
        "github.com/rivo/tview"
-       "gopkg.in/yaml.v2"
+       "gopkg.in/yaml.v3"
        "io"
        "io/ioutil"
        "os"
@@ -20,7 +19,6 @@ type UI struct {
        App         *tview.Application
        Pages       *tview.Pages
        userList    *tview.TextView
-       agreeModal  *tview.Modal
        trackerList *tview.List
        HLClient    *Client
 }
@@ -76,7 +74,6 @@ func NewUI(c *Client) *UI {
                chatInput:   chatInput,
                userList:    userList,
                trackerList: tview.NewList(),
-               agreeModal:  tview.NewModal(),
                HLClient:    c,
        }
 }
@@ -197,7 +194,7 @@ func (ui *UI) joinServer(addr, login, password string) error {
                addr += ":5500"
        }
        if err := ui.HLClient.JoinServer(addr, login, password); err != nil {
-               return errors.New(fmt.Sprintf("Error joining server: %v\n", err))
+               return fmt.Errorf("Error joining server: %v\n", err)
        }
 
        go func() {
@@ -234,7 +231,7 @@ func (ui *UI) renderJoinServerForm(name, server, login, password, backPage strin
        joinServerForm.
                //      AddInputField("Name", server, 0, func(textToCheck string, lastChar rune) bool {
                //      return false
-               //}, nil).
+               // }, nil).
                AddInputField("Server", server, 0, nil, nil).
                AddInputField("Login", login, 0, nil, nil).
                AddPasswordField("Password", password, 0, '*', nil).
@@ -373,7 +370,7 @@ func (ui *UI) renderServerUI() *tview.Flex {
 
                        newsPostForm := tview.NewForm().
                                SetButtonsAlign(tview.AlignRight).
-                               //AddButton("Cancel", nil). // TODO: implement cancel button behavior
+                               // AddButton("Cancel", nil). // TODO: implement cancel button behavior
                                AddButton("Send", nil)
                        newsPostForm.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
                                switch event.Key() {
@@ -441,7 +438,7 @@ func (ui *UI) renderServerUI() *tview.Flex {
                                        SetDirection(tview.FlexRow).
                                        AddItem(nil, 0, 1, false).
                                        AddItem(newsFlex, 15, 1, true).
-                                       //AddItem(newsPostForm, 3, 0, false).
+                                       // AddItem(newsPostForm, 3, 0, false).
                                        AddItem(nil, 0, 1, false), 40, 1, false).
                                AddItem(nil, 0, 1, false)