ai cooking
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Refactor: Use Style.Colors instead of direct Colors field

Co-authored-by: paulgmiller <1474379+paulgmiller@users.noreply.github.com>

+35 -15
+2 -2
cmd/careme/web.go
··· 78 78 data := struct { 79 79 ClarityScript template.HTML 80 80 User *users.User 81 - Colors seasons.ColorScheme 81 + Style seasons.Style 82 82 }{ 83 83 ClarityScript: clarityScript, 84 84 User: currentUser, 85 - Colors: seasons.GetCurrentColorScheme(), 85 + Style: seasons.GetCurrentStyle(), 86 86 } 87 87 if err := templates.Home.Execute(w, data); err != nil { 88 88 slog.ErrorContext(ctx, "home template execute error", "error", err)
+2 -2
internal/locations/locations.go
··· 137 137 Locations []Location 138 138 Zip string 139 139 ClarityScript template.HTML 140 - Colors seasons.ColorScheme 140 + Style seasons.Style 141 141 }{ 142 142 Locations: locs, 143 143 Zip: zip, 144 144 ClarityScript: l.clarity, 145 - Colors: seasons.GetCurrentColorScheme(), 145 + Style: seasons.GetCurrentStyle(), 146 146 } 147 147 if err := templates.Location.Execute(w, data); err != nil { 148 148 http.Error(w, "template error", http.StatusInternalServerError)
+2 -2
internal/recipes/html.go
··· 57 57 Hash string 58 58 Recipes []ai.Recipe 59 59 ConversationID string 60 - Colors seasons.ColorScheme 60 + Style seasons.Style 61 61 }{ 62 62 Location: *p.Location, 63 63 Date: p.Date.Format("2006-01-02"), ··· 66 66 Hash: p.Hash(), 67 67 Recipes: l.Recipes, 68 68 ConversationID: l.ConversationID, 69 - Colors: seasons.GetCurrentColorScheme(), 69 + Style: seasons.GetCurrentStyle(), 70 70 } 71 71 72 72 return templates.Recipe.Execute(writer, data)
+2 -2
internal/recipes/server.go
··· 215 215 w.Header().Set("Cache-Control", "no-store, no-cache, must-revalidate") 216 216 spinnerData := struct { 217 217 ClarityScript template.HTML 218 - Colors seasons.ColorScheme 218 + Style seasons.Style 219 219 }{ 220 220 ClarityScript: s.clarityScript, 221 - Colors: seasons.GetCurrentColorScheme(), 221 + Style: seasons.GetCurrentStyle(), 222 222 } 223 223 if err := s.spinnerTmpl.Execute(w, spinnerData); err != nil { 224 224 slog.ErrorContext(ctx, "home template execute error", "error", err)
+12
internal/seasons/seasons.go
··· 26 26 C900 string 27 27 } 28 28 29 + // Style represents styling configuration including seasonal colors 30 + type Style struct { 31 + Colors ColorScheme 32 + } 33 + 29 34 // GetSeason determines the season based on the month 30 35 func GetSeason(t time.Time) Season { 31 36 month := t.Month() ··· 123 128 func GetCurrentColorScheme() ColorScheme { 124 129 return GetColorScheme(GetCurrentSeason()) 125 130 } 131 + 132 + // GetCurrentStyle returns the current style configuration 133 + func GetCurrentStyle() Style { 134 + return Style{ 135 + Colors: GetCurrentColorScheme(), 136 + } 137 + }
+8
internal/seasons/seasons_test.go
··· 128 128 t.Errorf("GetCurrentColorScheme() returned empty colors") 129 129 } 130 130 } 131 + 132 + func TestGetCurrentStyle(t *testing.T) { 133 + // Verify it returns a style with valid colors 134 + style := GetCurrentStyle() 135 + if style.Colors.C50 == "" || style.Colors.C500 == "" || style.Colors.C900 == "" { 136 + t.Errorf("GetCurrentStyle() returned empty colors") 137 + } 138 + }
+1 -1
internal/templates/chat.html
··· 20 20 <meta name="twitter:image" content="https://careme.cooking/favicon.ico" /> 21 21 {{end}} 22 22 23 - {{template "tailwind_head" .}} 23 + {{template "tailwind_head" .Style}} 24 24 25 25 {{.ClarityScript}} 26 26 </head>
+1 -1
internal/templates/home.html
··· 5 5 <meta name="viewport" content="width=device-width, initial-scale=1" /> 6 6 <title>Careme</title> 7 7 8 - {{template "tailwind_head" .}} 8 + {{template "tailwind_head" .Style}} 9 9 10 10 {{.ClarityScript}} 11 11 </head>
+1 -1
internal/templates/locations.html
··· 5 5 <meta name="viewport" content="width=device-width, initial-scale=1" /> 6 6 <title>Careme Locations</title> 7 7 8 - {{template "tailwind_head" .}} 8 + {{template "tailwind_head" .Style}} 9 9 10 10 {{.ClarityScript}} 11 11 </head>
+1 -1
internal/templates/spinner.html
··· 8 8 <meta http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate" /> 9 9 <meta http-equiv="Pragma" content="no-cache" /> 10 10 11 - {{template "tailwind_head" .}} 11 + {{template "tailwind_head" .Style}} 12 12 13 13 {{.ClarityScript}} 14 14 </head>
+1 -1
internal/templates/user.html
··· 5 5 <meta name="viewport" content="width=device-width, initial-scale=1" /> 6 6 <title>Careme · User Profile</title> 7 7 8 - {{template "tailwind_head" .}} 8 + {{template "tailwind_head" .Style}} 9 9 10 10 {{.ClarityScript}} 11 11 </head>
+2 -2
internal/users/server.go
··· 147 147 User *User 148 148 Success bool 149 149 FavoriteStoreName string 150 - Colors seasons.ColorScheme 150 + Style seasons.Style 151 151 }{ 152 152 ClarityScript: s.clarityScript, 153 153 User: currentUser, 154 154 Success: success, 155 155 FavoriteStoreName: favoriteStoreName, 156 - Colors: seasons.GetCurrentColorScheme(), 156 + Style: seasons.GetCurrentStyle(), 157 157 } 158 158 if err := s.userTmpl.Execute(w, data); err != nil { 159 159 slog.ErrorContext(ctx, "user template execute error", "error", err)