diff options
| author | mo khan <mo@mokhan.ca> | 2025-04-16 15:13:01 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-04-16 15:13:01 -0600 |
| commit | 691e4ba30113cee3508a54fd2383e34f38b55bde (patch) | |
| tree | 51d299537a17826a1b43428ef7b5298fa1690875 /app/controllers/dashboard/controller.go | |
| parent | d24708251deb598c522a67e6615d3403d65dbcdc (diff) | |
feat: render a blank html page for the dashboard
Diffstat (limited to 'app/controllers/dashboard/controller.go')
| -rw-r--r-- | app/controllers/dashboard/controller.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/app/controllers/dashboard/controller.go b/app/controllers/dashboard/controller.go index cd1c44f..d805027 100644 --- a/app/controllers/dashboard/controller.go +++ b/app/controllers/dashboard/controller.go @@ -1,6 +1,7 @@ package dashboard import ( + "html/template" "net/http" "github.com/xlgmokha/x/pkg/context" @@ -31,4 +32,42 @@ func (c *Controller) Show(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) w.Header().Add("Content-Type", "text/html") + const tpl = ` +<!doctype html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="color-scheme" content="light dark"> + <title>SparkleLab - {{.Title}}</title> + <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"> + </head> + <body> + <main class="container"> + <nav> + <ul> + <li><strong>SparkleLab</strong></li> + </ul> + <ul> + <li><a href="/session/new">Login</a></li> + </ul> + </nav> + {{range .Sparkles}} + <div>{{ . }}</div> + {{else}} + <div><strong>No Sparkles</strong></div> + {{end}} + </main> + </body> +</html>` + + t := x.Must(template.New("show").Parse(tpl)) + data := struct { + Title string + Sparkles []string + }{ + Title: "SparkleLab", + Sparkles: []string{}, + } + t.Execute(w, data) } |
