diff options
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) } |
