mirror of
https://github.com/divan/txqr.git
synced 2026-08-31 23:37:32 +08:00
Update UI on connect
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user