From b19b9bf58578b2bd11e3378fc2ca8baab110e071 Mon Sep 17 00:00:00 2001 From: Jonathon Leight Date: Thu, 2 Jul 2026 21:06:27 -0400 Subject: [PATCH] Clean up user profile --- internal/marketing/templates/user_public.html | 77 +++++++++++++------ internal/marketing/users.go | 6 ++ 2 files changed, 58 insertions(+), 25 deletions(-) diff --git a/internal/marketing/templates/user_public.html b/internal/marketing/templates/user_public.html index dc0b5ab..b464597 100644 --- a/internal/marketing/templates/user_public.html +++ b/internal/marketing/templates/user_public.html @@ -9,47 +9,74 @@ {{end}} {{define "content"}} +{{$hasSidebar := or .Links .MeshKeys}}
-
+ +

About

- {{if .Location}}
{{template "icon-map-pin" "me-1"}}{{.Location}}
{{end}} - {{if .Callsign}}
Callsign: {{.Callsign}}
{{end}} - {{if .Bio}}

{{.Bio}}

{{end}} - {{if not .HasDetails}}

This person hasn't added any profile details yet.

{{end}} - - {{if .Links}} -
Links
-
- {{range .Links}} - {{if .Href}} - {{template "link-icon" .Platform}}{{.Display}}{{if .IsPrimary}} Primary{{end}} - {{else}} - {{template "link-icon" .Platform}}{{.URL}}{{if .IsPrimary}} Primary{{end}} - {{end}} - {{end}} + {{if or .Location .Callsign}} +
+ {{if .Location}}{{template "icon-map-pin" "me-1"}}{{.Location}}{{end}} + {{if .Callsign}}{{template "icon-world" "me-1"}}{{.Callsign}}{{end}}
{{end}} + + {{if .Bio}}

{{.Bio}}

{{end}} + + {{if not .HasDetails}}

This person hasn't added any profile details yet.

{{end}}
- {{if .MeshKeys}} + + {{if $hasSidebar}}
+ {{if .Links}}
-

MeshCore

-
- {{range .MeshKeys}} -
- {{if .QR}}
MeshCore contact QR for {{.Label}}
{{end}} -
{{.Label}}
- {{.Key}} +

Links

+
+ {{range .Links}} + {{if .Href}} + + {{template "link-icon" .Platform}} + {{.Display}} + {{if .IsPrimary}}Primary{{end}} + {{template "icon-arrow-right" ""}} + + {{else}} +
+
+ {{template "link-icon" .Platform}} + {{.Display}} + {{if .IsPrimary}}Primary{{end}} +
+
{{.URL}}
{{end}} -

Scan to add this contact in the MeshCore app.

+ {{end}}
+ {{end}} + + {{if .MeshKeys}} +
+
+

MeshCore

+
Scan to add this contact in the MeshCore app.
+
+
+ {{range $i, $mk := .MeshKeys}} +
+ {{if $mk.QR}}
MeshCore contact QR for {{$mk.Label}}
{{end}} +
{{$mk.Label}}
+ {{$mk.Key}} +
+ {{end}} +
+
+ {{end}}
{{end}}
diff --git a/internal/marketing/users.go b/internal/marketing/users.go index 854d36f..009a441 100644 --- a/internal/marketing/users.go +++ b/internal/marketing/users.go @@ -4,6 +4,7 @@ import ( "errors" "html/template" "net/http" + "sort" "github.com/go-chi/chi/v5" meshcore "github.com/meshcore-go/meshcore-go" @@ -54,6 +55,11 @@ func (s *Handlers) pageUserPublic(w http.ResponseWriter, r *http.Request) { } webLinks = append(webLinks, l) } + // Surface the primary contact first (it's how people are meant to reach this + // person); keep the editor's order otherwise. + sort.SliceStable(webLinks, func(i, j int) bool { + return webLinks[i].IsPrimary && !webLinks[j].IsPrimary + }) // Whether there's anything beyond the name to show — drives an empty-state hint. hasDetails := u.Bio != "" || u.Location != "" || u.Callsign != "" || len(webLinks) > 0 || len(meshKeys) > 0 s.Render(w, r, "user_public.html", map[string]any{