aboutsummaryrefslogtreecommitdiffstats
path: root/web/command/html/home.go
diff options
context:
space:
mode:
Diffstat (limited to 'web/command/html/home.go')
-rw-r--r--web/command/html/home.go53
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"),
+ )
+}