Update UI on connect

This commit is contained in:
Ivan Danyliuk
2018-11-16 12:57:01 +01:00
parent 17355b8833
commit d50f33f703
2 changed files with 6 additions and 4 deletions
+3 -2
View File
@@ -26,8 +26,9 @@ func NewApp() *App {
wsAddress := js.Global.Get("WSAddress").String()
fmt.Println("WSaddress:", wsAddress)
app := &App{
session: NewSession(),
settings: NewSettings(),
session: NewSession(),
settings: NewSettings(),
connected: false,
}
app.ws = NewWSClient(wsAddress, app)
+3 -2
View File
@@ -32,7 +32,8 @@ func (a *App) StartQR() vecty.ComponentOrHTML {
vecty.Markup(
vecty.Class("has-text-weight-bold"),
),
vecty.Text("Scan QR code to start testing"),
vecty.If(!a.connected, vecty.Text("Scan QR code to connect")),
vecty.If(a.connected, vecty.Text("Scan QR code to start testing")),
),
),
),
@@ -60,7 +61,7 @@ func (a *App) StartQR() vecty.ComponentOrHTML {
vecty.If(a.connected,
elem.Paragraph(
vecty.Markup(
vecty.Class("card-footer-item"),
vecty.Class("card-footer-item", "has-background-success", "has-text-white", "has-text-weight-bold"),
),
vecty.Text(
fmt.Sprintf("Connected"),