<%= t(".title") %>

<%= t(".subtitle") %>

<% if @counts["all"].zero? && @savings_accounts.empty? %> <%= render "empty_state", linkable_account_count: @linkable_account_count %> <% else %> <%# Hero card %>

<%= t(".hero.total_in_savings") %>

<%= @hero[:total_savings_money].format %>

<% delta = @hero[:delta] %> <% if delta[:direction] != :flat %>

mt-1 tabular-nums"> <%= t("savings_goals.index.hero.delta_#{delta[:direction]}", amount: @hero[:delta_amount_money].format, percent: delta[:percent].abs) %>

<% end %>

<%= t(".hero.accounts") %>

<%= @hero[:accounts_count] %>

<%= t(".hero.active_goals") %>

<%= @hero[:active_goals_count] %>

<%= t(".hero.saved_toward_goals") %>

<%= @hero[:saved_toward_goals_money].format %>

<% if @hero[:sparkline_series].size >= 2 %>
<% end %>
<%# Accounts section %> <% if @savings_accounts.any? %>

<%= t(".accounts_section.heading") %>

<%= t(".accounts_section.subtitle") %>

<% @savings_accounts.each do |account| %> <%= render Savings::AccountCardComponent.new(account: account, goals_count: @account_goal_counts[account.id] || 0) %> <% end %>
<% end %> <%# Goals section %>

<%= t(".goals_section.heading") %>

<%= t(".goals_section.subtitle") %>

<% if @linkable_account_count > 0 %> <%= render DS::Link.new( text: t(".new_goal"), variant: "primary", href: new_savings_goal_path, icon: "plus", frame: :modal ) %> <% end %>
<% if @show_search %>
" placeholder="<%= t(".search.placeholder") %>" class="block w-full border border-secondary rounded-md py-2.5 pl-10 pr-3 bg-container focus:ring-gray-500 sm:text-sm">
<%= icon "search", class: "text-secondary" %>
<% %w[all on_track behind no_target_date].each do |status| %> <% active = status == "all" %> <% end %>
<% end %> <% if @active_goals.any? %>
<%= t(".ongoing_section.heading") %> · <%= @active_goals.size %>
<% @active_goals.each do |goal| %> <%= render Savings::GoalCardComponent.new(goal: goal) %> <% end %>
<% else %>

<%= t(".empty_filtered") %>

<% end %>
<% if @completed_goals.any? %>
<%= t(".completed_section.heading") %> · <%= @completed_goals.size %>
<% @completed_goals.each do |goal| %> <%= render Savings::GoalCardComponent.new(goal: goal) %> <% end %>
<% end %> <% end %>