oficina / home Public

Use Estilo for shared Home connection presentation

Co-Authored-By: Codex <noreply@openai.com>
Paul Campbell pushed by paul@keymail.dev 5b8d8410775ffd6e4f62c64673347cef3b15d255 parent b7bf63d
7 files changed, +13 −24
  • Makefile +2 −0
  • connect/go.mod +1 −0
  • connect/go.sum +2 −0
  • connect/oauth.go +2 −1
  • connect/templates/home_link.html +0 −9
  • connect/templates/oauth.html +0 −5
  • connect/view.go +6 −9

CI passed — run details

diff --git a/Makefile b/Makefile
index 48b4644..e3638a0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+export GOPRIVATE := $(GOPRIVATE),amadan.net/oficina/estilo.git
+
private_comma := ,
export GOPRIVATE := $(if $(GOPRIVATE),$(GOPRIVATE)$(private_comma))amadan.net/oficina/estilo.git
diff --git a/connect/go.mod b/connect/go.mod
index 5be62a3..de1fbd8 100644
--- a/connect/go.mod
+++ b/connect/go.mod
@@ -3,6 +3,7 @@ module amadan.net/oficina/home/connect
go 1.25.0
require (
+ amadan.net/oficina/estilo.git v0.0.0-20260909234655-dec3908b237c
amadan.net/oficina/home/handoff v0.0.0-20260908102137-481d2d57f489
amadan.net/rastrillo/rastrillo v0.26.1-0.20260908075707-29e4491631bd
github.com/go-json-experiment/json v0.0.0-20250725192818-e39067aee2d2
diff --git a/connect/go.sum b/connect/go.sum
index 4cab028..db96826 100644
--- a/connect/go.sum
+++ b/connect/go.sum
@@ -1,3 +1,5 @@
+amadan.net/oficina/estilo.git v0.0.0-20260909234655-dec3908b237c h1:LgE7WLm6zMG/qZScoAHb4X2gguzorctB4XGjPYavXts=
+amadan.net/oficina/estilo.git v0.0.0-20260909234655-dec3908b237c/go.mod h1:0R45/vCUAT+kpS7S6K/ZxBdE8f7YxFN4HT3HyDJ3nPY=
amadan.net/oficina/home/handoff v0.0.0-20260908102137-481d2d57f489 h1:RPKtyry/71i06o8L+gjAaUyexbmG56kO1YPs601URAM=
amadan.net/oficina/home/handoff v0.0.0-20260908102137-481d2d57f489/go.mod h1:YISpzFJ+iMgrM0rUL032OSzsAQbP4/nozvXLCCOcn1k=
amadan.net/rastrillo/rastrillo v0.26.1-0.20260908075707-29e4491631bd h1:jlFSt95M1ontOg+VePU+kIJpChtWqDQAbnmlxqCnbgc=
diff --git a/connect/oauth.go b/connect/oauth.go
index d306720..c00cc0b 100644
--- a/connect/oauth.go
+++ b/connect/oauth.go
@@ -1,6 +1,7 @@
package connect
import (
+ "amadan.net/oficina/estilo.git/homeconnect"
"bytes"
"net/http"
"net/url"
@@ -84,7 +85,7 @@ func (w *oauthResponse) Write(p []byte) (int, error) {
return w.body.Write(p)
}
-type OAuthData struct{ URL, Title, ActionLabel string }
+type OAuthData = homeconnect.OAuthData
func OAuthPage(destination string) OAuthData {
return OAuthData{URL: destination, Title: "Continue signing in", ActionLabel: "Continue to Keymail"}
diff --git a/connect/templates/home_link.html b/connect/templates/home_link.html
deleted file mode 100644
index 43c9fae..0000000
--- a/connect/templates/home_link.html
+++ /dev/null
@@ -1,9 +0,0 @@
-{{define "home-connect"}}
-<header rst-page-header><div rst-page-header-titles><h1>{{.Title}}</h1></div></header>
-<div rst-box>
- <p>{{.Body}}</p>{{if .Address}}<p style="overflow-wrap: anywhere"><strong>{{.Address}}</strong></p>{{end}}
- {{if .PostAction}}<form method="post" action="{{.Action}}"><button rst-btn="primary" type="submit">{{.ActionLabel}}</button></form>
- {{else}}<a rst-btn="primary" href="{{.Action}}">{{.ActionLabel}}</a>{{end}}
- {{if .CancelLabel}}<a href="/">{{.CancelLabel}}</a>{{end}}
-</div>
-{{end}}
diff --git a/connect/templates/oauth.html b/connect/templates/oauth.html
deleted file mode 100644
index 12aef7a..0000000
--- a/connect/templates/oauth.html
+++ /dev/null
@@ -1,5 +0,0 @@
-{{define "home-oauth-head"}}<meta http-equiv="refresh" content="0;url={{.URL}}">{{end}}
-{{define "home-oauth"}}
-<header rst-page-header><div rst-page-header-titles><h1>{{.Title}}</h1></div></header>
-<div rst-box><a rst-btn="primary" href="{{.URL}}">{{.ActionLabel}}</a></div>
-{{end}}
diff --git a/connect/view.go b/connect/view.go
index 712ded2..ba0eda2 100644
--- a/connect/view.go
+++ b/connect/view.go
@@ -1,16 +1,13 @@
package connect
-import "embed"
+import (
+ "amadan.net/oficina/estilo.git/homeconnect"
+ "embed"
+)
-//go:embed templates/*.html
-var templateFS embed.FS
+func Templates() embed.FS { return homeconnect.Templates() }
-func Templates() embed.FS { return templateFS }
-
-type PageData struct {
- Title, Body, Address, Action, ActionLabel, CancelLabel string
- PostAction bool
-}
+type PageData = homeconnect.PageData
func Page(state, label string, translate ...func(string) string) PageData {
t := func(k string) string { return English[k] }