fix(goals/show): add Required line to projection legend

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.
This commit is contained in:
Guillem Arias
2026-05-14 20:27:26 +02:00
parent cfdd3c476f
commit 3b2a1fc828
2 changed files with 7 additions and 0 deletions

View File

@@ -243,6 +243,12 @@
<svg width="18" height="6"><line x1="0" y1="3" x2="18" y2="3" stroke="<%= projection_color %>" stroke-width="2" stroke-dasharray="3 3" /></svg>
<%= t(".projection.legend_projection") %>
</span>
<% if @goal.monthly_target_amount.to_d.positive? && @goal.remaining_amount.to_d.positive? %>
<span class="inline-flex items-center gap-1.5">
<svg width="18" height="6" class="text-secondary"><line x1="0" y1="3" x2="18" y2="3" stroke="currentColor" stroke-width="2" stroke-dasharray="2 4" opacity="0.5" /></svg>
<%= t(".projection.legend_required") %>
</span>
<% end %>
<% end %>
</div>
</div>

View File

@@ -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.