Activity Tracker
-
-
-
-
+
+
+
+
Today
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
diff --git a/internal/web/style.css b/internal/web/style.css
new file mode 100644
index 0000000..59ea395
--- /dev/null
+++ b/internal/web/style.css
@@ -0,0 +1,82 @@
+/* Shared by the dashboard and setup pages. */
+:root {
+ --bg:#f6f6f4; --card:#ffffff; --fg:#1b1b1b; --muted:#6b6b6b; --line:#e4e4e0;
+ --accent:#3d6fc4; --accent-soft:#e8eefa; --ok:#2e8b57; --bad:#c0392b; --code:#f2f2ef;
+}
+@media (prefers-color-scheme: dark) {
+ :root {
+ --bg:#121212; --card:#1b1b1b; --fg:#e8e8e8; --muted:#9a9a9a; --line:#2c2c2c;
+ --accent:#7aa2ea; --accent-soft:#1e2a40; --ok:#5cc28a; --bad:#e2685a; --code:#232323;
+ }
+}
+* { box-sizing:border-box; }
+body { margin:0; background:var(--bg); color:var(--fg); font:15px/1.5 system-ui, sans-serif; }
+main { max-width:800px; margin:0 auto; padding:0 16px 56px; }
+a { color:var(--accent); }
+
+/* ---- top bar ---- */
+.topbar { display:flex; align-items:center; gap:20px; padding:16px 0; margin-bottom:8px; border-bottom:1px solid var(--line); }
+.brand { font-weight:650; font-size:17px; }
+.tabs { display:flex; gap:4px; }
+.tabs a { color:var(--muted); text-decoration:none; padding:5px 10px; border-radius:6px; }
+.tabs a:hover { color:var(--fg); }
+.tabs a[aria-current="page"] { color:var(--fg); background:var(--accent-soft); }
+
+/* ---- controls ---- */
+input, select, button { font:inherit; color:inherit; background:var(--card); border:1px solid var(--line); border-radius:6px; padding:5px 10px; }
+button { cursor:pointer; }
+button:hover { border-color:var(--muted); }
+button.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
+button.primary:hover { filter:brightness(1.08); }
+button.small { padding:2px 8px; font-size:13px; }
+button:disabled { opacity:.6; cursor:default; }
+:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
+
+/* ---- layout pieces ---- */
+.row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
+.spread { justify-content:space-between; }
+.card { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:16px; margin-top:16px; }
+.card > h2:first-child, .card > .row:first-child h2 { margin-top:0; }
+h1 { font-size:20px; margin:16px 0 0; }
+h2 { font-size:15px; margin:0 0 10px; }
+h3 { font-size:14px; margin:16px 0 6px; }
+.muted { color:var(--muted); }
+.small-text { font-size:13px; }
+.ok { color:var(--ok); } .bad, .err { color:var(--bad); }
+.badge { display:inline-block; font-size:12px; padding:1px 7px; border-radius:999px; background:var(--accent-soft); color:var(--accent); white-space:nowrap; }
+
+.tiles { display:grid; grid-template-columns:repeat(auto-fit, minmax(160px, 1fr)); gap:12px; margin-top:16px; }
+.tile { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:12px 14px; }
+.tile .k { font-size:13px; color:var(--muted); }
+.tile .v { font-size:22px; font-weight:650; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
+
+/* ---- tables ---- */
+.tablewrap { overflow-x:auto; }
+table { width:100%; border-collapse:collapse; }
+th, td { padding:7px 8px 7px 0; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
+tr:last-child td { border-bottom:0; }
+th { font-weight:600; font-size:13px; color:var(--muted); }
+td.num { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; padding-left:12px; padding-right:0; }
+td.label { overflow-wrap:anywhere; width:100%; }
+td.time { white-space:nowrap; color:var(--muted); font-variant-numeric:tabular-nums; }
+.bar { height:4px; background:var(--accent); border-radius:2px; margin-top:4px; opacity:.85; }
+
+/* ---- code ---- */
+code, pre { font:13px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; background:var(--code); border-radius:6px; }
+code { padding:1px 5px; overflow-wrap:anywhere; }
+pre { padding:10px 12px; overflow-x:auto; margin:0; }
+.codeblock { position:relative; margin:8px 0; }
+.codeblock .copy { position:absolute; top:6px; right:6px; }
+ol, ul { padding-left:22px; margin:8px 0; }
+li { margin:6px 0; }
+
+/* ---- setup ---- */
+.keybox { margin-top:12px; padding:12px; border:1px solid var(--ok); border-radius:8px; }
+.keybox pre { margin:8px 0; }
+details.collector { background:var(--card); border:1px solid var(--line); border-radius:10px; margin-top:12px; }
+details.collector > summary { cursor:pointer; padding:14px 16px; list-style:none; display:flex; gap:10px; align-items:baseline; }
+details.collector > summary::-webkit-details-marker { display:none; }
+details.collector > summary::before { content:"▸"; color:var(--muted); }
+details.collector[open] > summary::before { content:"▾"; }
+details.collector > summary b { font-size:15px; }
+details.collector > .body { padding:0 16px 16px; }
diff --git a/internal/web/web.go b/internal/web/web.go
index a53d39e..b49d774 100644
--- a/internal/web/web.go
+++ b/internal/web/web.go
@@ -18,8 +18,18 @@ var (
Setup []byte
//go:embed tracker.user.js
userScript []byte
+ //go:embed style.css
+ style []byte
)
+// Style serves the stylesheet the pages share. It's public: the login
+// redirect doesn't use it, but there's nothing private in it either.
+func Style(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Content-Type", "text/css; charset=utf-8")
+ w.Header().Set("Cache-Control", "no-cache")
+ w.Write(style)
+}
+
// Page serves a static HTML page.
func Page(page []byte) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
+
+
+
+
+
+ Desktop time
–
Browser time
–
Top site or app
–
Goals met
–