From cdb75d3fcbc9339b897f8c6ff4d69a577f017393 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Tue, 8 Jul 2025 23:26:05 +0100 Subject: Rewrite in Go --- web/command/html/home.go | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 web/command/html/home.go (limited to 'web/command/html/home.go') diff --git a/web/command/html/home.go b/web/command/html/home.go new file mode 100644 index 0000000..f0e783d --- /dev/null +++ b/web/command/html/home.go @@ -0,0 +1,53 @@ +package html + +import ( + "fmt" + + "github.com/LMBishop/scrapbook/pkg/index" + "github.com/LMBishop/scrapbook/pkg/site" + . "maragu.dev/gomponents" + . "maragu.dev/gomponents/html" +) + +func HomePage(siteIndex *index.SiteIndex) Node { + return page("All sites", + H1(Text("All sites")), + + Div( + Class("sites-table"), + Group{ + Span( + Class("header name"), + Text("Site"), + ), + Span( + Class("header status"), + Text("Status"), + ), + Span( + Class("header actions"), + Text("Actions"), + ), + }, + Map(siteIndex.GetSites(), func(site *site.Site) Node { + return Group{ + Span( + Class("name"), + Span(Text(site.Name)), + Span(Text(fmt.Sprintf("on %s", site.SiteConfig.Host))), + ), + Span( + Class("status"), + Text(site.EvaluateSiteStatus()), + ), + Span( + Class("actions"), + navButton("Details", fmt.Sprintf("/site/%s/", site.Name)), + ), + } + }), + ), + + navButton("Create new", "/create"), + ) +} -- cgit v1.2.3-70-g09d2