mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-05 05:25:24 +02:00
* Placeholder logic for missing prices * Generate holdings properly for "offline" securities * Separate forward and reverse calculators for holdings and balances * Remove unnecessary currency conversion during sync * Clearer sync process * Move price caching logic to dedicated model * Base holding calculator * Base calculator for balances * Finish balance calculators * Better naming * Logs cleanup * Remove stale data type * Remove stale test * Fix price lookup logic for holdings sync * Fix Plaid item sync regression * Remove temp logging * Calculate cash and holdings series * Add holdings, cash, and balance series dropdown for investments
31 lines
1.1 KiB
Text
31 lines
1.1 KiB
Text
<% series = @account.balance_series(period: @period, view: @chart_view) %>
|
|
<% trend = series.trend %>
|
|
|
|
<%= 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" %>
|
|
</div>
|
|
|
|
<div class="h-64 pb-4">
|
|
<% if series.any? %>
|
|
<div
|
|
id="lineChart"
|
|
class="w-full h-full"
|
|
data-controller="time-series-chart"
|
|
data-time-series-chart-data-value="<%= series.to_json %>"></div>
|
|
<% else %>
|
|
<div class="w-full h-full flex items-center justify-center">
|
|
<p class="text-secondary text-sm">No data available for the selected period.</p>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|