%# Keys are absolute: a relative `t(".x")` here would resolve against this
component's own path, not the goal page these strings belong to. %>
<% case panel %>
<% when :inactive %>
<%= render DS::Card.new(class: "items-center justify-center text-center") do %>
<%= helpers.icon(inactive_icon, size: "2xl") %>
<%= t("goals.show.#{inactive_heading_key}") %>
<%= t("goals.show.inactive.body", saved: goal.current_balance_money.format(precision: 0), target: goal.target_amount_money.format(precision: 0)) %>
<% end %>
<% when :celebration %>
<%= render DS::Card.new(class: "items-center justify-center text-center") do %>
<%= helpers.icon(celebration_icon, size: "2xl", color: "success") %>
<%= t("goals.show.#{celebration_heading_key}") %>
<%= t("goals.show.#{celebration_body_key}",
saved: goal.current_balance_money.format(precision: 0),
target: goal.target_amount_money.format(precision: 0)) %>
<% if show_frozen_note? %>
<%= t("goals.show.celebration.frozen",
date: l(goal.completed_at.to_date, format: :long),
amount: goal.current_balance_money.format(precision: 0)) %>
<% end %>
<% case celebration_action %>
<% when :close %>
<%# Same confirmation as the menu action: closing releases the goal's
earmarked money, and a one-click release is not a gesture to make
reversible-by-apology. %>
<%= render DS::Button.new(
text: t("goals.show.celebration.close_cta"),
href: helpers.complete_goal_path(goal),
variant: "primary",
size: "sm",
method: :patch,
confirm: helpers.goal_complete_confirm(goal)
) %>
<%= t("goals.show.celebration.close_hint") %>
<% when :archive %>
<%= render DS::Button.new(
text: t("goals.show.celebration.archive_cta"),
href: helpers.archive_goal_path(goal),
variant: "outline",
size: "sm",
method: :patch
) %>
<% end %>
<% end %>
<% when :reserve_shortfall %>
<%= render DS::Card.new(class: "items-center justify-center text-center") do %>
<%= helpers.icon("shield-alert", size: "2xl", color: "warning") %>
<%= t("goals.show.reserve_shortfall.heading") %>
<%= t("goals.show.reserve_shortfall.body",
saved: goal.current_balance_money.format(precision: 0),
target: goal.target_amount_money.format(precision: 0),
missing: goal.remaining_amount_money.format(precision: 0)) %>
<% end %>
<% when :empty %>
<%# No movement yet on the linked account: an inline "make your first
transfer" card instead of a flat-at-zero chart that looks broken. %>
<%= render DS::Card.new(class: "items-center justify-center text-center") do %>
<%= helpers.icon("piggy-bank", size: "2xl") %>
<%= t("goals.show.empty.heading") %>
<%= t("goals.show.empty.body") %>
<%= render DS::Link.new(
text: t("goals.show.record_pledge_cta"),
variant: "primary",
size: "sm",
href: helpers.new_goal_pledge_path(goal),
icon: "plus",
frame: :modal
) %>
<% end %>
<% else %>
<%= render DS::Card.new do %>
<%= t("goals.show.projection.heading") %>
<%= helpers.sanitize goal.projection_summary %>
<% if show_catch_up? %>
<%= t("goals.show.catch_up.body", avg: goal.pace_money.format(precision: 0), required: Money.new(goal.monthly_target_amount, goal.currency).format(precision: 0)) %>
<% end %>
<%# Swatches are bordered spans rather than inline SVG. The projection one
keeps the chart's own colour variables in an inline style rather than
taking `border-success` / `border-warning`: a legend that does not
match the line it describes is worse than the markup it saves, and
the chart hard-codes green-600 / yellow-600. %>
<%= t("goals.show.projection.legend_saved") %>
<% if show_projection_legend? %>
<%= t("goals.show.projection.legend_projection") %>
<% if show_required_legend? %>
<%= t("goals.show.projection.legend_required") %>
<% end %>
<% end %>
"
data-goal-projection-chart-aria-description-value="<%= helpers.strip_tags(goal.projection_summary) %>"
data-goal-projection-chart-today-label-value="<%= t("goals.show.projection.today_marker") %>"
data-goal-projection-chart-projected-template-value="<%= t("goals.show.projection.tooltip_projected", amount: "{amount}") %>"
data-goal-projection-chart-saved-template-value="<%= t("goals.show.projection.tooltip_saved", amount: "{amount}") %>"
data-goal-projection-chart-target-relation-template-value="<%= t("goals.show.projection.tooltip_target_relation", percent: "{percent}", target: "{target}") %>">
<% if goal.target_date.nil? %>
<%= helpers.icon("calendar-plus", size: "sm") %>
<%= t("goals.show.no_target_date.body") %>
<%= helpers.link_to t("goals.show.no_target_date.cta"),
helpers.edit_goal_path(goal),
data: { turbo_frame: :modal },
class: "font-medium text-primary underline-offset-2 hover:underline" %>
<% end %>
<% end %>
<% end %>