diff --git a/appview/knots/knots.go b/appview/knots/knots.go --- a/appview/knots/knots.go +++ b/appview/knots/knots.go @@ -39,6 +39,19 @@ Logger *slog.Logger Knotstream *eventconsumer.Consumer } +type tab = map[string]any + +var ( + knotsTabs []tab = []tab{ + {"Name": "profile", "Icon": "user"}, + {"Name": "keys", "Icon": "key"}, + {"Name": "emails", "Icon": "mail"}, + {"Name": "notifications", "Icon": "bell"}, + {"Name": "knots", "Icon": "volleyball"}, + {"Name": "spindles", "Icon": "spool"}, + } +) + func (k *Knots) Router() http.Handler { r := chi.NewRouter() @@ -70,6 +83,8 @@ k.Pages.Knots(w, pages.KnotsParams{ LoggedInUser: user, Registrations: registrations, + Tabs: knotsTabs, + Tab: "knots", }) } @@ -132,6 +147,8 @@ Registration: ®istration, Members: members, Repos: repoMap, IsOwner: true, + Tabs: knotsTabs, + Tab: "knots", }) } @@ -596,7 +613,7 @@ return } // success - k.Pages.HxRedirect(w, fmt.Sprintf("/knots/%s", domain)) + k.Pages.HxRedirect(w, fmt.Sprintf("/settings/knots/%s", domain)) } func (k *Knots) removeMember(w http.ResponseWriter, r *http.Request) { diff --git a/appview/pages/pages.go b/appview/pages/pages.go --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -407,6 +407,8 @@ type KnotsParams struct { LoggedInUser *oauth.User Registrations []models.Registration + Tabs []map[string]any + Tab string } func (p *Pages) Knots(w io.Writer, params KnotsParams) error { @@ -419,6 +421,8 @@ Registration *models.Registration Members []string Repos map[string][]models.Repo IsOwner bool + Tabs []map[string]any + Tab string } func (p *Pages) Knot(w io.Writer, params KnotParams) error { @@ -436,6 +440,8 @@ type SpindlesParams struct { LoggedInUser *oauth.User Spindles []models.Spindle + Tabs []map[string]any + Tab string } func (p *Pages) Spindles(w io.Writer, params SpindlesParams) error { @@ -444,6 +450,8 @@ } type SpindleListingParams struct { models.Spindle + Tabs []map[string]any + Tab string } func (p *Pages) SpindleListing(w io.Writer, params SpindleListingParams) error { @@ -455,6 +463,8 @@ LoggedInUser *oauth.User Spindle models.Spindle Members []string Repos map[string][]models.Repo + Tabs []map[string]any + Tab string } func (p *Pages) SpindleDashboard(w io.Writer, params SpindleDashboardParams) error { diff --git a/appview/pages/templates/knots/dashboard.html b/appview/pages/templates/knots/dashboard.html --- a/appview/pages/templates/knots/dashboard.html +++ b/appview/pages/templates/knots/dashboard.html @@ -1,9 +1,25 @@ -{{ define "title" }}{{ .Registration.Domain }} · knots{{ end }} +{{ define "title" }}{{ .Registration.Domain }} · {{ .Tab }} settings{{ end }} {{ define "content" }} -
+
+

Settings

+
+
+
+
+ {{ template "user/settings/fragments/sidebar" . }} +
+
+ {{ template "knotDash" . }} +
+
+
+{{ end }} + +{{ define "knotDash" }} +
-

{{ .Registration.Domain }}

+

{{ .Tab }} · {{ .Registration.Domain }}

{{ $style := "px-2 py-1 rounded flex items-center flex-shrink-0 gap-2" }} {{ $isOwner := and .LoggedInUser (eq .LoggedInUser.Did .Registration.ByDid) }} @@ -35,7 +51,7 @@
{{ if .Members }} -
+
{{ block "member" . }} {{ end }}
@@ -79,7 +95,7 @@ {{ define "deleteButton" }}
-

A knot hosts repository data. Learn how to register your own knot.

+

A knot hosts repository data. Learn how to register your own knot.

diff --git a/appview/pages/templates/repo/new.html b/appview/pages/templates/repo/new.html --- a/appview/pages/templates/repo/new.html +++ b/appview/pages/templates/repo/new.html @@ -165,7 +165,7 @@ {{ end }}

A knot hosts repository data and handles Git operations. - You can also register your own knot. + You can also register your own knot.

{{ end }} diff --git a/appview/pages/templates/spindles/dashboard.html b/appview/pages/templates/spindles/dashboard.html --- a/appview/pages/templates/spindles/dashboard.html +++ b/appview/pages/templates/spindles/dashboard.html @@ -1,9 +1,25 @@ -{{ define "title" }}{{.Spindle.Instance}} · spindles{{ end }} +{{ define "title" }}{{.Spindle.Instance}} · {{ .Tab }} settings{{ end }} {{ define "content" }} -
+
+

Settings

+
+
+
+
+ {{ template "user/settings/fragments/sidebar" . }} +
+
+ {{ template "spindleDash" . }} +
+
+
+{{ end }} + +{{ define "spindleDash" }} +
-

{{ .Spindle.Instance }}

+

{{ .Tab }} · {{ .Spindle.Instance }}

{{ $style := "px-2 py-1 rounded flex items-center flex-shrink-0 gap-2" }} {{ $isOwner := and .LoggedInUser (eq .LoggedInUser.Did .Spindle.Owner) }} @@ -71,7 +87,7 @@ {{ define "deleteButton" }} -
+
+

register a spindle

+

Enter the hostname of your spindle to get started.

+ +
+ + +
-
- +
+ + +
+{{ end }} - +{{ define "docsButton" }} + +{{ i "book" "size-4" }} +docs + +
+
{{ end }} diff --git a/appview/settings/settings.go b/appview/settings/settings.go --- a/appview/settings/settings.go +++ b/appview/settings/settings.go @@ -43,6 +43,8 @@ {"Name": "profile", "Icon": "user"}, {"Name": "keys", "Icon": "key"}, {"Name": "emails", "Icon": "mail"}, {"Name": "notifications", "Icon": "bell"}, + {"Name": "knots", "Icon": "volleyball"}, + {"Name": "spindles", "Icon": "spool"}, } ) diff --git a/appview/spindles/spindles.go b/appview/spindles/spindles.go --- a/appview/spindles/spindles.go +++ b/appview/spindles/spindles.go @@ -38,6 +38,19 @@ IdResolver *idresolver.Resolver Logger *slog.Logger } +type tab = map[string]any + +var ( + spindlesTabs []tab = []tab{ + {"Name": "profile", "Icon": "user"}, + {"Name": "keys", "Icon": "key"}, + {"Name": "emails", "Icon": "mail"}, + {"Name": "notifications", "Icon": "bell"}, + {"Name": "knots", "Icon": "volleyball"}, + {"Name": "spindles", "Icon": "spool"}, + } +) + func (s *Spindles) Router() http.Handler { r := chi.NewRouter() @@ -69,6 +82,8 @@ s.Pages.Spindles(w, pages.SpindlesParams{ LoggedInUser: user, Spindles: all, + Tabs: spindlesTabs, + Tab: "spindles", }) } @@ -127,6 +142,8 @@ LoggedInUser: user, Spindle: spindle, Members: members, Repos: repoMap, + Tabs: spindlesTabs, + Tab: "spindles", }) } @@ -365,7 +382,7 @@ } shouldRedirect := r.Header.Get("shouldRedirect") if shouldRedirect == "true" { - s.Pages.HxRedirect(w, "/spindles") + s.Pages.HxRedirect(w, "/settings/spindles") return } @@ -581,7 +598,7 @@ return } // success - s.Pages.HxRedirect(w, fmt.Sprintf("/spindles/%s", instance)) + s.Pages.HxRedirect(w, fmt.Sprintf("/settings/spindles/%s", instance)) } func (s *Spindles) removeMember(w http.ResponseWriter, r *http.Request) { diff --git a/appview/state/router.go b/appview/state/router.go --- a/appview/state/router.go +++ b/appview/state/router.go @@ -166,8 +166,10 @@ }) r.Mount("/settings", s.SettingsRouter()) r.Mount("/strings", s.StringsRouter(mw)) - r.Mount("/knots", s.KnotsRouter()) - r.Mount("/spindles", s.SpindlesRouter()) + + r.Mount("/settings/knots", s.KnotsRouter()) + r.Mount("/settings/spindles", s.SpindlesRouter()) + r.Mount("/notifications", s.NotificationsRouter(mw)) r.Mount("/signup", s.SignupRouter()) diff --git a/docs/hacking.md b/docs/hacking.md --- a/docs/hacking.md +++ b/docs/hacking.md @@ -121,7 +121,7 @@ This starts a knot on port 6444, a spindle on port 6555 with `ssh` exposed on port 2222. Once the services are running, head to -http://localhost:3000/knots and hit verify. It should +http://localhost:3000/settings/knots and hit verify. It should verify the ownership of the services instantly if everything went smoothly. @@ -146,7 +146,7 @@ ### running a spindle The above VM should already be running a spindle on -`localhost:6555`. Head to http://localhost:3000/spindles and +`localhost:6555`. Head to http://localhost:3000/settings/spindles and hit verify. You can then configure each repository to use this spindle and run CI jobs. diff --git a/docs/knot-hosting.md b/docs/knot-hosting.md --- a/docs/knot-hosting.md +++ b/docs/knot-hosting.md @@ -131,7 +131,7 @@ knot domain. You should now have a running knot server! You can finalize your registration by hitting the `verify` button on the -[/knots](https://tangled.org/knots) page. This simply creates +[/settings/knots](https://tangled.org/settings/knots) page. This simply creates a record on your PDS to announce the existence of the knot. ### custom paths diff --git a/docs/migrations.md b/docs/migrations.md --- a/docs/migrations.md +++ b/docs/migrations.md @@ -14,14 +14,14 @@ For knots: - Upgrade to latest tag (v1.9.0 or above) -- Head to the [knot dashboard](https://tangled.org/knots) and +- Head to the [knot dashboard](https://tangled.org/settings/knots) and hit the "retry" button to verify your knot For spindles: - Upgrade to latest tag (v1.9.0 or above) - Head to the [spindle - dashboard](https://tangled.org/spindles) and hit the + dashboard](https://tangled.org/settings/spindles) and hit the "retry" button to verify your spindle ## Upgrading from v1.7.x @@ -41,7 +41,7 @@ your DID. You can find your DID in the [settings](https://tangled.org/settings) page. - Restart your knot once you have replaced the environment variable -- Head to the [knot dashboard](https://tangled.org/knots) and +- Head to the [knot dashboard](https://tangled.org/settings/knots) and hit the "retry" button to verify your knot. This simply writes a `sh.tangled.knot` record to your PDS.