package pages import ( "fmt" "atmoquest/features/common/layouts" ) // AdminBadgesView is the data for /admin/badges. type AdminBadgesView struct { Badges []AdminBadgeRow } // AdminBadgeRow is one badge definition in the admin list. type AdminBadgeRow struct { ID int Slug string Name string Description string Shape string PrimaryColor string AccentColor string RibbonColor string Label string Trigger string SVGPreview string } // AdminBadgeEditView is the data for /admin/badges/{id}/edit. type AdminBadgeEditView struct { Badge AdminBadgeRow Shapes []string Primary []string Accent []string Ribbon []string Saved bool Error string } templ AdminBadges(v AdminBadgesView) { @layouts.Base("admin · badges", "Manage app-wide badge definitions.") { @adminShell("badges", "") {

App badges

These are the app-wide badge definitions. Click a badge to edit its design.

if len(v.Badges) == 0 {

no badge definitions found.

} else {
for _, b := range v.Badges {
@templ.Raw(b.SVGPreview)
{ b.Name }
{ b.Description }
if b.Trigger != "" {
{ b.Trigger }
}
}
} } } } templ AdminBadgeEdit(v AdminBadgeEditView) { @layouts.Base("admin · edit badge", "Edit a badge definition.") { @adminShell("badges", "") {

edit badge — { v.Badge.Name }

if v.Saved {
✓ badge design saved.
} if v.Error != "" { }
@templ.Raw(v.Badge.SVGPreview)

{ v.Badge.Slug }

if v.Badge.Trigger != "" {

trigger: { v.Badge.Trigger }

}
@colorSwatchField("primary_color", "primary color", v.Primary, v.Badge.PrimaryColor) @colorSwatchField("accent_color", "accent color", v.Accent, v.Badge.AccentColor) @colorSwatchField("ribbon_color", "ribbon color", v.Ribbon, v.Badge.RibbonColor)
← all badges
} } } func badgeIDStr(id int) string { return fmt.Sprintf("%d", id) }