visual improvements in frame and communities sidebox

This commit is contained in:
2025-10-17 13:38:05 -06:00
parent be5b3a426d
commit 7a755aac77
3 changed files with 56 additions and 34 deletions
+15 -4
View File
@@ -37,6 +37,7 @@ type RenderedSidebox struct {
Title string
Subtext *string
Items []RenderedSideboxItem
Flags map[string]bool
}
/* buildCommunitiesSidebox creates the data for the "My/Featured Communities" sidebox.
@@ -48,11 +49,12 @@ type RenderedSidebox struct {
* Standard Go error status.
*/
func buildCommunitiesSidebox(uid int32, out *RenderedSidebox, in *database.Sidebox) error {
var err error
var anon bool
anon, err = database.AmIsUserAnon(uid)
user, err := database.AmGetUser(uid)
if err == nil {
if anon {
var g *database.Globals
g, err = database.AmGlobals()
if err == nil {
if user.IsAnon {
out.Title = "Featured Communities"
} else {
out.Title = "Your Communities"
@@ -72,9 +74,18 @@ func buildCommunitiesSidebox(uid int32, out *RenderedSidebox, in *database.Sideb
out.Items[i].Flags["admin"] = true
}
}
out.Flags = make(map[string]bool)
if user.IsAnon {
out.Flags["canManage"] = false
out.Flags["canCreate"] = false
} else {
out.Flags["canManage"] = true
out.Flags["canCreate"] = user.BaseLevel >= uint16(g.CommunityCreateLevel)
}
out.TemplateName = "sb_ftrcomm.jet"
}
}
}
_ = in
return err
}
+7 -5
View File
@@ -26,9 +26,9 @@
<div class="flex items-center justify-between px-2 py-2">
<!-- Site Logo -->
<div class="w-1/5">
<a href="https://git.erbosoft.com/amy/amsterdam">
<a href="/">
<img src="/img/builtin/powered-by-amsterdam.png"
alt="Amsterdam Test"
alt="{{ GlobalConfig.Site.Title }}"
class="w-35 h-20 mx-2 my-2">
</a>
</div>
@@ -36,9 +36,7 @@
<!-- Navigation Links -->
<div class="w-2/5 text-center">
<div class="text-white font-bold text-base mb-2">
<a href="/" class="text-yellow-300 hover:text-yellow-400">
Front Page
</a>
<a href="/" class="text-yellow-300 hover:text-yellow-400">Front Page</a>
</div>
<div class="text-white font-bold text-base">
<a href="/TODO/help" class="text-yellow-300 hover:text-yellow-400">Help</a>
@@ -69,6 +67,10 @@
{{ if !isset(amsterdam_suppressLogin) || !amsterdam_suppressLogin }}
<span class="mx-2">-</span>
<a href="/logout" class="text-yellow-300 hover:text-yellow-400">Log Out</a>
{{ if !.CurrentUser().VerifyEMail }}
<span class="mx-2">|</span>
<a href="/verify" class="text-yellow-300 hover:text-yellow-400">Verify E-Mail</a>
{{ end }}
<span class="mx-2">|</span>
<a href="/profile" class="text-yellow-300 hover:text-yellow-400">Profile</a>
{{ end }}
+11 -2
View File
@@ -26,11 +26,20 @@
<div class="text-small">You are not a member of any communities.</div>
{{ end }}
</div>
{{ if sb.Flags["canManage"] || sb.Flags["canCreate"] }}
<div class="mt-3 text-center">
<span class="text-black text-xs font-bold">
[ <a href="/TODO/manage_comms" class="text-blue-700 hover:text-blue-900">Manage</a> |
<a href="/TODO/create_comm" class="text-blue-700 hover:text-blue-900">Create New</a> ]
[
{{ if sb.Flags["canManage"] }}
<a href="/TODO/manage_comms" class="text-blue-700 hover:text-blue-900">Manage</a>
{{ if sb.Flags["canCreate"] }}|{{ end }}
{{ end }}
{{ if sb.Flags["canCreate"] }}
<a href="/TODO/create_comm" class="text-blue-700 hover:text-blue-900">Create New</a>
{{ end }}
]
</span>
</div>
{{ end }}
</div>
</div>