From 844910a54bf493ded4a034df4294f15c89103554 Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sun, 22 Feb 2026 19:06:18 -0500 Subject: [PATCH] refactor(templates): complete admin header extraction - Add theme.js to admin_users page for proper theme support - Pass currentUser to Header instead of hardcoded Admin user - Fix currentUserID reference bug (use currentUser.ID) - Remove duplicate theme loading script (now in Header) - Complete header refactoring for admin_users page --- templates/admin_users.templ | 13 ++++--------- templates/register_templ.go | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/templates/admin_users.templ b/templates/admin_users.templ index c2a6313..562905e 100644 --- a/templates/admin_users.templ +++ b/templates/admin_users.templ @@ -1,6 +1,6 @@ package templates -templ AdminUsers(users []User, adminCount int, currentUserID string) { +templ AdminUsers(currentUser User, users []User, adminCount int) { @@ -9,10 +9,11 @@ templ AdminUsers(users []User, adminCount int, currentUserID string) { + - @Header(User{Username: "Admin", Role: "admin"}, "/admin/users") + @Header(currentUser, "/admin/users") @@ -43,7 +44,7 @@ templ AdminUsers(users []User, adminCount int, currentUserID string) {
{user.Username}
- if user.ID == currentUserID { + if user.ID == currentUser.ID { You }
@@ -135,12 +136,6 @@ templ AdminUsers(users []User, adminCount int, currentUserID string) {
- - } diff --git a/templates/register_templ.go b/templates/register_templ.go index 161fbba..23aba5d 100644 --- a/templates/register_templ.go +++ b/templates/register_templ.go @@ -29,7 +29,7 @@ func Register() templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "Register

Register for Bookhoard

Already have an account? Login

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "Register

Register for Bookhoard

Password Requirements:

  • At least 8 characters
  • One uppercase letter
  • One lowercase letter
  • One number
  • One special character
  • Passwords match

Already have an account? Login

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }