feat(savings_goals/new): deterministic account avatar color via name hash

Replace the hardcoded var(--color-blue-500) on every funding-account
row's avatar with a deterministic pick from Category::COLORS based on
the account name's hash. Rows now read at a glance instead of melting
into one blue column.
This commit is contained in:
Guillem Arias
2026-05-11 15:00:28 +02:00
parent e3dd1c4c1e
commit bcae1afc24

View File

@@ -69,7 +69,7 @@
account_subtype: account.subtype || subtype,
account_balance: account.balance
} %>
<%= render Savings::GoalAvatarComponent.new(name: account.name, color: "var(--color-blue-500)", size: "md") %>
<%= render Savings::GoalAvatarComponent.new(name: account.name, color: Category::COLORS[account.name.hash.abs % Category::COLORS.size], size: "md") %>
<div class="flex-1 min-w-0">
<p class="text-sm font-medium text-primary truncate"><%= account.name %></p>
<p class="text-xs text-secondary"><%= (account.subtype || subtype).titleize %></p>