diff --git a/appview/pages/funcmap.go b/appview/pages/funcmap.go index 8232deb4..79113204 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") }, @@ -543,15 +544,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", "Label": "Profile", "Icon": "user"}, - {"Name": "keys", "Label": "Keys", "Icon": "key"}, - {"Name": "emails", "Label": "Emails", "Icon": "mail"}, - {"Name": "notifications", "Label": "Notifications", "Icon": "bell"}, - {"Name": "knots", "Label": "Knots", "Icon": "volleyball"}, - {"Name": "spindles", "Label": "Spindles", "Icon": "spool"}, - {"Name": "sites", "Label": "Sites", "Icon": "globe"}, - }, + "UserSettingsTabs": func() []tab { + tabs := []tab{ + {"Name": "profile", "Label": "Profile", "Icon": "user"}, + {"Name": "keys", "Label": "Keys", "Icon": "key"}, + {"Name": "emails", "Label": "Emails", "Icon": "mail"}, + {"Name": "notifications", "Label": "Notifications", "Icon": "bell"}, + {"Name": "knots", "Label": "Knots", "Icon": "volleyball"}, + {"Name": "spindles", "Label": "Spindles", "Icon": "spool"}, + } + if !p.projectMode { + tabs = append(tabs, tab{"Name": "sites", "Label": "Sites", "Icon": "globe"}) + } + return tabs + }(), "RepoSettingsTabs": []tab{ {"Name": "general", "Label": "General", "Icon": "sliders-horizontal"}, {"Name": "access", "Label": "Access", "Icon": "users"}, diff --git a/appview/pages/pages.go b/appview/pages/pages.go index 5c0353ab..22cce4b5 100644 --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -76,6 +76,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 @@ -97,6 +98,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 0238a731..75604aa9 100644 --- a/appview/pages/templates/layouts/fragments/topbar.html +++ b/appview/pages/templates/layouts/fragments/topbar.html @@ -17,10 +17,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 9dff87f3..77324a59 100644 --- a/appview/pages/templates/repo/issues/fragments/newComment.html +++ b/appview/pages/templates/repo/issues/fragments/newComment.html @@ -112,10 +112,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 a2d84335..15c8497b 100644 --- a/appview/pages/templates/repo/pulls/pull.html +++ b/appview/pages/templates/repo/pulls/pull.html @@ -602,10 +602,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 2fcffec7..0a555b2f 100644 --- a/appview/pages/templates/user/login.html +++ b/appview/pages/templates/user/login.html @@ -109,9 +109,11 @@ {{ end }} + {{ if not projectMode }}

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

+ {{ end }}

{{ end }}