diff options
| author | Leonardo Bishop <me@leonardobishop.net> | 2025-07-08 23:26:05 +0100 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.net> | 2025-07-08 23:26:05 +0100 |
| commit | cdb75d3fcbc9339b897f8c6ff4d69a577f017393 (patch) | |
| tree | 5e757cd236540c2cea9874c1bc09f19548db05d5 /web/command/html/home.go | |
| parent | b56101f1a11552067f594679a497ebd4cf7427d4 (diff) | |
Rewrite in Go
Diffstat (limited to 'web/command/html/home.go')
| -rw-r--r-- | web/command/html/home.go | 53 |
1 files changed, 53 insertions, 0 deletions
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"), + ) +} |
