From 3b2a1fc8281d2205bf3ea51faf98a6c4e41b1c39 Mon Sep 17 00:00:00 2001 From: Guillem Arias Date: Thu, 14 May 2026 20:27:26 +0200 Subject: [PATCH] fix(goals/show): add Required line to projection legend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dashed neutral line for "the rate needed to hit the target by the target date" was rendered on the chart but absent from the legend. Adds a third legend chip ("Required") that renders only when the line itself renders — i.e. when target_date is set, monthly_target_amount is positive, and there's still ground to cover (remaining_amount > 0). Stroke matches the JS: `text-secondary` currentColor, dasharray 2/4, 0.5 opacity. --- app/views/goals/show.html.erb | 6 ++++++ config/locales/views/goals/en.yml | 1 + 2 files changed, 7 insertions(+) diff --git a/app/views/goals/show.html.erb b/app/views/goals/show.html.erb index 1d0d0c6c2..5d518e3f9 100644 --- a/app/views/goals/show.html.erb +++ b/app/views/goals/show.html.erb @@ -243,6 +243,12 @@ <%= t(".projection.legend_projection") %> + <% if @goal.monthly_target_amount.to_d.positive? && @goal.remaining_amount.to_d.positive? %> + + + <%= t(".projection.legend_required") %> + + <% end %> <% end %> diff --git a/config/locales/views/goals/en.yml b/config/locales/views/goals/en.yml index 584a6bdc6..24c2226c6 100644 --- a/config/locales/views/goals/en.yml +++ b/config/locales/views/goals/en.yml @@ -127,6 +127,7 @@ en: heading: Projection legend_saved: Saved legend_projection: Projection + legend_required: Required reached: Goal reached. Nice work. no_target_date: No target date set. Set one to project a finish line. no_pace: No inflow yet. Make a transfer or update the balance to start a projection.