diff --git a/appview/pages/funcmap.go b/appview/pages/funcmap.go index f1d6b6e2..bd0dc734 100644 --- a/appview/pages/funcmap.go +++ b/appview/pages/funcmap.go @@ -42,6 +42,7 @@ type tab map[string]string func (p *Pages) funcMap() template.FuncMap { return template.FuncMap{ + "projectMode": func() bool { return p.projectMode }, "split": func(s string) []string { return strings.Split(s, "\n") }, @@ -486,15 +487,20 @@ func (p *Pages) funcMap() template.FuncMap { return map[string]any{ "OrderedReactionKinds": models.OrderedReactionKinds, // would be great to have ordered maps right about now - "UserSettingsTabs": []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"}, - {"Name": "sites", "Icon": "globe"}, - }, + "UserSettingsTabs": func() []tab { + tabs := []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"}, + } + if !p.projectMode { + tabs = append(tabs, tab{"Name": "sites", "Icon": "globe"}) + } + return tabs + }(), "RepoSettingsTabs": []tab{ {"Name": "general", "Icon": "sliders-horizontal"}, {"Name": "access", "Icon": "users"}, diff --git a/appview/pages/pages.go b/appview/pages/pages.go index 2c7038a9..391499dc 100644 --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -48,6 +48,7 @@ type Pages struct { db *db.DB rdb *cache.Cache dev bool + projectMode bool embedFS fs.FS templateDir string // Path to templates on disk for dev mode rctx *markup.RenderContext @@ -69,6 +70,7 @@ func NewPages(config *config.Config, res *idresolver.Resolver, database *db.DB, mu: sync.RWMutex{}, cache: NewTmplCache[string, *template.Template](), dev: config.Core.Dev, + projectMode: config.Project.Enabled, avatar: config.Avatar, pdsCfg: config.Pds, rctx: rctx, diff --git a/appview/pages/templates/layouts/fragments/topbar.html b/appview/pages/templates/layouts/fragments/topbar.html index 794a9131..ee76c1bd 100644 --- a/appview/pages/templates/layouts/fragments/topbar.html +++ b/appview/pages/templates/layouts/fragments/topbar.html @@ -16,10 +16,12 @@
{{ block "profileDropdown" . }} {{ end }}
{{ else }} login + {{ if not projectMode }} or join now {{ i "arrow-right" "size-4" }} + {{ end }} {{ end }} diff --git a/appview/pages/templates/repo/issues/fragments/newComment.html b/appview/pages/templates/repo/issues/fragments/newComment.html index e6038136..1361efc2 100644 --- a/appview/pages/templates/repo/issues/fragments/newComment.html +++ b/appview/pages/templates/repo/issues/fragments/newComment.html @@ -129,10 +129,12 @@ {{ else }}
+ {{ if not projectMode }} sign up or + {{ end }} login to add to the discussion
diff --git a/appview/pages/templates/repo/pulls/pull.html b/appview/pages/templates/repo/pulls/pull.html index 23a9cf56..c7b17505 100644 --- a/appview/pages/templates/repo/pulls/pull.html +++ b/appview/pages/templates/repo/pulls/pull.html @@ -656,10 +656,12 @@ {{ define "loginPrompt" }}
+ {{ if not projectMode }} sign up or + {{ end }} login to add to the discussion
diff --git a/appview/pages/templates/user/login.html b/appview/pages/templates/user/login.html index b9533c57..9e2851e8 100644 --- a/appview/pages/templates/user/login.html +++ b/appview/pages/templates/user/login.html @@ -108,9 +108,11 @@ {{ end }} + {{ if not projectMode }}

Don't have an account? Create an account on Tangled now!

+ {{ end }}

{{ end }}