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
+33 -22
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,31 +49,41 @@ 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 {
out.Title = "Featured Communities"
} else {
out.Title = "Your Communities"
}
var l []*database.Community
l, err = database.AmGetCommunitiesForUser(uid)
var g *database.Globals
g, err = database.AmGlobals()
if err == nil {
out.Items = make([]RenderedSideboxItem, len(l))
for i, c := range l {
out.Items[i].Text = c.Name
lk := fmt.Sprintf("/comm/%s/profile", c.Alias)
out.Items[i].Link = &lk
out.Items[i].Flags = make(map[string]bool)
var level uint16
level, err = database.AmGetCommunityAccessLevel(uid, c.Id)
if err == nil && database.AmTestPermission("Community.ShowAdmin", level) {
out.Items[i].Flags["admin"] = true
}
if user.IsAnon {
out.Title = "Featured Communities"
} else {
out.Title = "Your Communities"
}
var l []*database.Community
l, err = database.AmGetCommunitiesForUser(uid)
if err == nil {
out.Items = make([]RenderedSideboxItem, len(l))
for i, c := range l {
out.Items[i].Text = c.Name
lk := fmt.Sprintf("/comm/%s/profile", c.Alias)
out.Items[i].Link = &lk
out.Items[i].Flags = make(map[string]bool)
var level uint16
level, err = database.AmGetCommunityAccessLevel(uid, c.Id)
if err == nil && database.AmTestPermission("Community.ShowAdmin", level) {
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"
}
out.TemplateName = "sb_ftrcomm.jet"
}
}
_ = in
+8 -6
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 }}
@@ -124,4 +126,4 @@
</div>
</div>
</body>
</html>
</html>
+15 -6
View File
@@ -26,11 +26,20 @@
<div class="text-small">You are not a member of any communities.</div>
{{ end }}
</div>
<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> ]
</span>
</div>
{{ if sb.Flags["canManage"] || sb.Flags["canCreate"] }}
<div class="mt-3 text-center">
<span class="text-black text-xs font-bold">
[
{{ 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>