diff --git a/internal/core/templates/dashboard.html b/internal/core/templates/dashboard.html index 3716284..46d35dc 100644 --- a/internal/core/templates/dashboard.html +++ b/internal/core/templates/dashboard.html @@ -69,41 +69,8 @@
- -
- - {{if .Owned}} -
- {{range .Owned}} -
- {{template "icon-antenna" ""}} -
- {{.Name}} - {{$c := index $.ShareCounts .ID}} -
{{if or $c.Users $c.Orgs}}Shared with {{$c.Users}} user{{if ne $c.Users 1}}s{{end}} · {{$c.Orgs}} org{{if ne $c.Orgs 1}}s{{end}}{{else}}Not shared{{end}}
-
- {{template "repstatus" .}} - {{template "icon-terminal" "me-1"}}Console -
- {{end}} -
- {{else}} -
-
-
{{template "icon-antenna" ""}}
-

No repeaters yet

-

Add one to grant MeshTender access and test it with a modem.

- -
-
- {{end}} -
- -
+

Recent activity

{{if .Recent}}
diff --git a/internal/core/templates/repeaters.html b/internal/core/templates/repeaters.html index 32a1299..ce4dbdd 100644 --- a/internal/core/templates/repeaters.html +++ b/internal/core/templates/repeaters.html @@ -13,59 +13,38 @@ {{define "content"}} {{if .Error}}{{end}} -{{if or .Owned .Shared}} -{{if .Shared}}

Your repeaters

{{end}} -{{if .Owned}} +{{if .Repeaters}}
- {{range .Owned}} + {{range .Repeaters}}
-
+
{{template "icon-antenna" ""}}
-

{{.Name}}

+

{{.Name}}

+ {{if .Shared}}Shared{{else}}Owned{{end}} {{template "repstatus" .}}
{{slice .PublicKeyHex 0 8}}… - · - {{template "sharetext" (index $.ShareCounts .ID)}} -
-
-
- {{if and .Confirmed .AccessKnown (not .IsAdmin)}} + {{if and (not .Shared) .Confirmed .AccessKnown (not .IsAdmin)}}
MeshTender only has guest access here. Guest is available to anyone with a blank password, so there's no point operating at this level — re-run setperm <your key> 3 on the repeater to grant admin, then re-test.
{{end}}
-
+
{{end}}
{{else}} -
-
You haven't added any of your own repeaters yet.
-
-{{end}} -{{else}}
{{template "icon-antenna" ""}}

No repeaters yet

@@ -75,39 +54,6 @@
{{end}} - -{{if .Shared}} -

Shared with you

-
- {{range .Shared}} -
-
-
-
- {{template "icon-antenna" ""}} -
-
-

{{.Name}}

- {{template "repstatus" .}} -
-
- {{slice .PublicKeyHex 0 8}}… - - · - Shared by {{.OwnerName}} -
-
- -
-
-
-
- {{end}} -
-{{end}} {{end}} {{/* sharetext renders a repeater's sharing summary as plain text: e.g. diff --git a/internal/core/web.go b/internal/core/web.go index ddbb4d0..87f2725 100644 --- a/internal/core/web.go +++ b/internal/core/web.go @@ -198,8 +198,8 @@ func (s *Handlers) pageHome(w http.ResponseWriter, r *http.Request) { s.pageDashboard(w, r) } -// pageRepeaters lists every repeater the user owns or has been shared, split -// into owned and shared sections. +// pageRepeaters lists every repeater the user owns or has been shared as one +// combined list, owned first, each tagged owned/shared in the template. func (s *Handlers) pageRepeaters(w http.ResponseWriter, r *http.Request) { uid := s.Auth.CurrentUserID(r.Context()) repeaters, err := s.Store.ListRepeatersForUser(r.Context(), uid) @@ -213,9 +213,11 @@ func (s *Handlers) pageRepeaters(w http.ResponseWriter, r *http.Request) { return } owned, shared := splitOwnedShared(repeaters) + combined := make([]*store.Repeater, 0, len(owned)+len(shared)) + combined = append(combined, owned...) + combined = append(combined, shared...) s.Render(w, r, "repeaters.html", map[string]any{ - "Owned": owned, - "Shared": shared, + "Repeaters": combined, "ShareCounts": shareCounts, "Error": r.URL.Query().Get("error"), }) @@ -244,11 +246,6 @@ func (s *Handlers) pageDashboard(w http.ResponseWriter, r *http.Request) { http.Error(w, "could not load activity", http.StatusInternalServerError) return } - shareCounts, err := s.Store.RepeaterSharingCounts(ctx, uid) - if err != nil { - http.Error(w, "could not load sharing", http.StatusInternalServerError) - return - } confirmed, unconfirmed := 0, 0 var mapped []*store.Repeater @@ -269,11 +266,8 @@ func (s *Handlers) pageDashboard(w http.ResponseWriter, r *http.Request) { "OrgCount": len(orgs), "Confirmed": confirmed, "Unconfirmed": unconfirmed, - "Owned": first(owned, 5), - "Shared": first(shared, 5), "Mapped": mapped, "Recent": recent, - "ShareCounts": shareCounts, "Error": r.URL.Query().Get("error"), }) } @@ -290,14 +284,6 @@ func splitOwnedShared(repeaters []*store.Repeater) (owned, shared []*store.Repea return owned, shared } -// first returns the first n elements of s, or all of them if there are fewer. -func first[T any](s []T, n int) []T { - if len(s) > n { - return s[:n] - } - return s -} - // handleLogout signs the user out of the app host, then chains to the auth host's // /logout to clear the SSO session too — otherwise the surviving SSO session // would silently re-authenticate on the next request. diff --git a/internal/marketing/templates/orgs.html b/internal/marketing/templates/orgs.html index 4080087..dd878ca 100644 --- a/internal/marketing/templates/orgs.html +++ b/internal/marketing/templates/orgs.html @@ -14,14 +14,14 @@ htmx "load more" fragment so appended pages match the first. */}} {{define "org-rows"}} {{range .All}} -
+
- {{.Name}} + {{.Name}} {{if .Region}}{{.Region}}{{end}}
{{if .Description}}

{{.Description}}

{{end}}
{{.MemberCount}} member{{if ne .MemberCount 1}}s{{end}} · {{.RepeaterCount}} repeater{{if ne .RepeaterCount 1}}s{{end}}
-
+ {{end}} {{end}} diff --git a/internal/web/templates/org_repeaters.html b/internal/web/templates/org_repeaters.html index cea8998..7e9cc27 100644 --- a/internal/web/templates/org_repeaters.html +++ b/internal/web/templates/org_repeaters.html @@ -11,17 +11,24 @@ htmx "show more" fragment so appended pages match the first. */}} {{define "rep-rows"}} {{range .Reps.Repeaters}} +{{if $.Reps.Full}} + + {{template "icon-antenna" ""}} +
+ {{.Name}} +
owner {{.OwnerName}}
+
+
+{{else}}
{{template "icon-antenna" ""}}
- {{if $.Reps.Full}}{{.Name}} -
owner {{.OwnerName}}
- {{else}}{{.Name}}{{end}} + {{.Name}}
- {{if $.Reps.Full}}{{template "icon-terminal" "me-1"}}Console{{end}}
{{end}} {{end}} +{{end}} {{/* rep-more is the public list's "show more" control; replaces itself with the next page's rows + a fresh control (the cursor carries the keyset position). */}}