diff --git a/.gitignore b/.gitignore
index b36c224..0246eb5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
tmp
*.db
.bin/
+appview/pages/static/
diff --git a/appview/pages/pages.go b/appview/pages/pages.go
index 6c44f14..34c87d8 100644
--- a/appview/pages/pages.go
+++ b/appview/pages/pages.go
@@ -7,6 +7,7 @@ import (
"io"
"io/fs"
"log"
+ "net/http"
"path"
"strings"
@@ -15,7 +16,7 @@ import (
"github.com/sotangled/tangled/types"
)
-//go:embed templates/*
+//go:embed templates/* static/*
var files embed.FS
type Pages struct {
@@ -239,3 +240,11 @@ type RepoBlobParams struct {
func (p *Pages) RepoBlob(w io.Writer, params RepoBlobParams) error {
return p.executeRepo("repo/blob", w, params)
}
+
+func (p *Pages) Static() http.Handler {
+ sub, err := fs.Sub(files, "static")
+ if err != nil {
+ log.Fatalf("no static dir found? that's crazy: %v", err)
+ }
+ return http.StripPrefix("/static/", http.FileServer(http.FS(sub)))
+}
diff --git a/appview/pages/templates/layouts/base.html b/appview/pages/templates/layouts/base.html
index b6703b3..b2a4aee 100644
--- a/appview/pages/templates/layouts/base.html
+++ b/appview/pages/templates/layouts/base.html
@@ -1,23 +1,21 @@
{{ define "layouts/base" }}
-
-
-
-
-
-
- {{block "title" .}}tangled{{end}}
-
-
-
- {{ block "topbar" .}}
- {{ template "layouts/topbar" . }}
- {{end}}
-
- {{block "content" .}}{{end}}
-
-
+
+
+
+
+
+ {{ block "title" . }}tangled{{ end }}
+
+
+
+ {{ block "topbar" . }}
+ {{ template "layouts/topbar" . }}
+ {{ end }}
+
+ {{ block "content" . }}{{ end }}
+
+
{{ end }}
diff --git a/appview/pages/templates/layouts/head.html b/appview/pages/templates/layouts/head.html
deleted file mode 100644
index ce6c02a..0000000
--- a/appview/pages/templates/layouts/head.html
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
-
- {{ if .parent }}
-
- {{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .parent }}/
-
-
- {{ else if .path }}
-
- {{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .path }}
-
- {{ else if .files }}
- {{ .meta.Title }} — {{ .name }} ({{ .ref }})
- {{ else if .commit }}
- {{ .meta.Title }} — {{ .name }}: {{ .commit.This }}
- {{ else if .branches }}
- {{ .meta.Title }} — {{ .name }}: refs
- {{ else if .commits }} {{ if .log }}
- {{ .meta.Title }} — {{ .name }}: log
- {{ else }}
- {{ .meta.Title }} — {{ .name }}
- {{ end }} {{ else }}
- {{ .meta.Title }}
- {{ end }} {{ if and .servername .gomod }}
-
- {{ end }}
-
-
diff --git a/appview/pages/templates/layouts/nav.html b/appview/pages/templates/layouts/nav.html
deleted file mode 100644
index 804d2ef..0000000
--- a/appview/pages/templates/layouts/nav.html
+++ /dev/null
@@ -1,13 +0,0 @@
-{{ define "nav" }}
-
-{{ end }}
diff --git a/appview/pages/templates/layouts/repo-header.html b/appview/pages/templates/layouts/repo-header.html
deleted file mode 100644
index 4b261a4..0000000
--- a/appview/pages/templates/layouts/repo-header.html
+++ /dev/null
@@ -1,11 +0,0 @@
-{{ define "repo-header" }}
-
-
- all repos
- — {{ .displayname }} {{ if .ref }}
- @ {{ .ref }}
- {{ end }}
-
- {{ .desc }}
-
-{{ end }}
diff --git a/appview/pages/templates/layouts/repoBase.html b/appview/pages/templates/layouts/repobase.html
similarity index 94%
rename from appview/pages/templates/layouts/repoBase.html
rename to appview/pages/templates/layouts/repobase.html
index e18ddcf..ab9a49d 100644
--- a/appview/pages/templates/layouts/repoBase.html
+++ b/appview/pages/templates/layouts/repobase.html
@@ -24,9 +24,8 @@
{{ end }}
-{{ define "layouts/repoBase" }}
+{{ define "layouts/repobase" }}
{{ template "layouts/base" . }}
{{ end }}
-
diff --git a/appview/pages/templates/layouts/test.html b/appview/pages/templates/layouts/test.html
deleted file mode 100644
index f3cca8d..0000000
--- a/appview/pages/templates/layouts/test.html
+++ /dev/null
@@ -1,5 +0,0 @@
-Hello world!
-
-
Welcome
-
This is a simple HTML example
-
diff --git a/appview/pages/templates/user/login.html b/appview/pages/templates/user/login.html
index 1294216..7451552 100644
--- a/appview/pages/templates/user/login.html
+++ b/appview/pages/templates/user/login.html
@@ -1,30 +1,39 @@
{{ define "user/login" }}
-
-
-
-
-
-
- login
-
-
-
- login
-
+
+
+
{{ end }}
diff --git a/appview/state/state.go b/appview/state/state.go
index 64159e6..7cd6817 100644
--- a/appview/state/state.go
+++ b/appview/state/state.go
@@ -618,6 +618,8 @@ func (s *State) UserRouter() http.Handler {
func (s *State) StandardRouter() http.Handler {
r := chi.NewRouter()
+ r.Handle("/static/*", s.pages.Static())
+
r.Get("/", s.Timeline)
r.Get("/login", s.Login)
diff --git a/flake.nix b/flake.nix
index e6c8fed..1ccc4e8 100644
--- a/flake.nix
+++ b/flake.nix
@@ -53,6 +53,7 @@
pkgs.indigo-lexgen
pkgs.litecli
pkgs.websocat
+ pkgs.tailwindcss
];
};
});
diff --git a/input.css b/input.css
new file mode 100644
index 0000000..d9b746c
--- /dev/null
+++ b/input.css
@@ -0,0 +1,21 @@
+@tailwind base;
+@tailwind components;
+@tailwind utilities;
+@layer base {
+ @font-face {
+ font-family: "Inter";
+ font-style: normal;
+ font-weight: 400;
+ font-display: swap;
+ }
+ h1 {
+ @apply text-2xl;
+ @apply font-sans;
+ @apply text-gray-900;
+ }
+ ::selection {
+ @apply bg-green-400;
+ @apply text-gray-900;
+ @apply bg-opacity-30;
+ }
+}
diff --git a/tailwind.config.js b/tailwind.config.js
new file mode 100644
index 0000000..be342c5
--- /dev/null
+++ b/tailwind.config.js
@@ -0,0 +1,22 @@
+/** @type {import('tailwindcss').Config} */
+module.exports = {
+ content: ["./appview/pages/templates/**/*.html"],
+ theme: {
+ container: {
+ padding: "2rem",
+ center: true,
+ screens: {
+ sm: "540px",
+ md: "650px",
+ lg: "900px",
+ xl: "1100px",
+ "2xl": "1300x",
+ },
+ },
+ extend: {
+ fontFamily: {
+ sans: ["Inter", "system-ui", "sans-serif", "ui-sans-serif"],
+ },
+ },
+ },
+};