package templates // adminCreateUserForm renders the (admin-only) account creation form. It // lives behind an explicit toggle on the Users page — never visible by // default — so creation stays available with self-service registration // disabled without dominating the page. templ adminCreateUserForm() {
@Icon("user", "h-4 w-4")

Create User

} // userRoleControl renders the role select (with last-admin protection). // resultSuffix keeps DOM ids unique when the control is rendered twice // (desktop table row + mobile card). templ userRoleControl(user User, adminCount int, resultSuffix string) { if user.Role == "admin" && adminCount == 1 {
} else {
} } // userDeleteButton renders the delete button (with last-admin protection). // idSuffix keeps the swap-target ids unique when the control is rendered // twice (desktop table row + mobile card). templ userDeleteButton(user User, adminCount int, idSuffix string) { if user.Role == "admin" && adminCount == 1 { } else { } } templ AdminUsers(currentUser User, users []User, adminCount int) { Users - Bookhoard Admin @Header(currentUser, "/admin/users")
@Icon("users", "h-5 w-5")

User Management

Manage user accounts and permissions

@adminCreateUserForm()
for _, user := range users {
@Icon("user", "h-4 w-4")
{ user.Username } if user.ID == currentUser.ID { You }
{ user.Email }
Role
@userRoleControl(user, adminCount, "mobile-")
Created
{ FormatInTimezone(user.CreatedAt, currentUser.Timezone) }
@userDeleteButton(user, adminCount, "mobile-")
}
}