From 755a7c07b1d625dcf0898f025595304b37982396 Mon Sep 17 00:00:00 2001 From: surtur Date: Tue, 31 May 2022 21:21:06 +0200 Subject: [PATCH] app: use 'latestComic' to set comic fields in UI --- xkcdreader/app.go | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/xkcdreader/app.go b/xkcdreader/app.go index 57e8dbd..14c9584 100644 --- a/xkcdreader/app.go +++ b/xkcdreader/app.go @@ -7,7 +7,6 @@ "fmt" "log" "os" - "time" "fyne.io/fyne/v2" "fyne.io/fyne/v2/app" @@ -125,17 +124,35 @@ func makeBrowseUI() *fyne.Container { layout.NewSpacer(), container.NewCenter( container.NewVBox( - &widget.Label{Text: "published on " + fmt.Sprint(time.Now().Date()), TextStyle: fyne.TextStyle{Italic: true}}, + &widget.Label{ + Text: "published on " + + fmt.Sprint( + latestComic.Year, "-", + latestComic.Month, "-", + latestComic.Day, + ), + TextStyle: fyne.TextStyle{Italic: true}, + }, container.NewHBox( - &widget.Label{Text: "Comic Title", TextStyle: fyne.TextStyle{Bold: true}}, - &widget.Label{Text: "(#1234)", TextStyle: fyne.TextStyle{Monospace: true}}, + &widget.Label{ + Text: latestComic.Title, + TextStyle: fyne.TextStyle{Bold: true}, + }, + &widget.Label{ + Text: "(#" + fmt.Sprint(latestComic.Num) + ")", + TextStyle: fyne.TextStyle{Monospace: true}, + }, ), ), ), imgC, layout.NewSpacer(), container.NewCenter( - &widget.Label{Text: "Comic 'title text'", TextStyle: fyne.TextStyle{Italic: true}}, + // comic "alt text" + &widget.Label{ + Text: latestComic.Alt, + TextStyle: fyne.TextStyle{Italic: true}, + }, ), )