mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-09 23:45:21 +02:00
Consolidate and simplify trend change between net worth and account charts
This commit is contained in:
parent
373405b16c
commit
18251c4ebf
3 changed files with 7 additions and 18 deletions
|
@ -3,16 +3,7 @@
|
|||
|
||||
<%= turbo_frame_tag dom_id(@account, :chart_details) do %>
|
||||
<div class="px-4">
|
||||
<% if trend.direction.flat? %>
|
||||
<%= tag.span t(".no_change"), class: "text-secondary" %>
|
||||
<% else %>
|
||||
<%= tag.span "#{trend.value.positive? ? "+" : ""}#{format_money(trend.value)}", style: "color: #{trend.color}" %>
|
||||
<% unless trend.percent.infinite? %>
|
||||
<%= tag.span "(#{trend.percent}%)", style: "color: #{trend.color}" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= tag.span @period.comparison_label, class: "text-secondary" %>
|
||||
<%= render partial: "shared/trend_change", locals: { trend: trend, comparison_label: @period.comparison_label } %>
|
||||
</div>
|
||||
|
||||
<div class="h-64 pb-4">
|
||||
|
|
|
@ -8,14 +8,9 @@
|
|||
<%= series.current.format %>
|
||||
</p>
|
||||
<% if series.trend.nil? %>
|
||||
<p class="text-sm text-secondary">Data not available for the selected period</p>
|
||||
<% elsif series.trend.direction.flat? %>
|
||||
<p class="text-sm text-secondary">No change vs. prior period</p>
|
||||
<p class="text-sm text-secondary"><%= t(".data_not_available") %></p>
|
||||
<% else %>
|
||||
<div class="flex items-center gap-2">
|
||||
<%= render partial: "shared/trend_change", locals: { trend: series.trend } %>
|
||||
<span class="text-sm text-secondary"><%= period.comparison_label %></span>
|
||||
</div>
|
||||
<%= render partial: "shared/trend_change", locals: { trend: series.trend, comparison_label: period.comparison_label } %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%# locals: { trend: } %>
|
||||
<%# locals: { trend:, comparison_label: nil } %>
|
||||
|
||||
<p class="text-sm" style="color: <%= trend.color %>">
|
||||
<% if trend.direction.flat? %>
|
||||
|
@ -10,5 +10,8 @@
|
|||
<% unless trend.percent.infinite? %>
|
||||
<span class="font-mono">(<%= lucide_icon(trend.icon, class: "w-4 h-4 align-text-bottom inline") %><%= trend.percent_formatted %>)</span>
|
||||
<% end %>
|
||||
<span class="text-secondary">
|
||||
<%= " #{comparison_label}" if comparison_label.present? %>
|
||||
</span>
|
||||
<% end %>
|
||||
</p>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue