1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-05 05:25:24 +02:00

Fix Plaid cash balance double counting (#2222)
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions

* Fix Plaid cash balance double counting

* Fix today's cash balance

* Simplify balance trends in activity view
This commit is contained in:
Zach Gollwitzer 2025-05-08 12:25:53 -04:00 committed by GitHub
parent 42207e487e
commit 1e5edd9f2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 72 additions and 97 deletions

View file

@ -77,10 +77,11 @@
<div>
<div class="rounded-tl-lg rounded-tr-lg bg-container border-alpha-black-25 shadow-xs">
<div class="space-y-4">
<% calculator = Balance::TrendCalculator.for(@entries) %>
<% calculator = Balance::TrendCalculator.new(@account.balances) %>
<%= entries_by_date(@entries) do |entries| %>
<% entries.each do |entry| %>
<%= render entry, balance_trend: calculator&.trend_for(entry), view_ctx: "account" %>
<% entries.each_with_index do |entry, index| %>
<%= render entry, balance_trend: index == 0 ? calculator.trend_for(entry.date) : nil, view_ctx: "account" %>
<% end %>
<% end %>
</div>

View file

@ -28,7 +28,7 @@
Period.as_options,
{ selected: period.key },
data: { "auto-submit-form-target": "auto" },
class: "bg-container border border-secondary font-medium rounded-lg px-3 py-2 text-sm pr-7 cursor-pointer text-primary focus:outline-hidden focus:ring-0" %>
class: "bg-container border border-secondary rounded-lg px-3 py-2 text-sm pr-7 cursor-pointer text-primary focus:outline-hidden focus:ring-0" %>
</div>
<% end %>
</div>

View file

@ -4,12 +4,11 @@
<%= turbo_frame_tag dom_id(entry) do %>
<%= turbo_frame_tag dom_id(transaction) do %>
<div class="grid grid-cols-12 items-center text-primary text-sm font-medium p-4 md:p-4
<div class="grid grid-cols-12 items-center text-primary text-sm font-medium p-4 lg:p-4
<%= @focused_record == entry || @focused_record == transaction ?
"border border-gray-900 rounded-lg" : "" %>">
<div class="pr-4 md:pr-10 flex items-center gap-3 md:gap-4
<%= balance_trend ? "col-span-8 md:col-span-6" : "col-span-8" %>">
<div class="pr-4 lg:pr-10 flex items-center gap-3 lg:gap-4 col-span-8 lg:col-span-6">
<%= check_box_tag dom_id(entry, "selection"),
disabled: transaction.transfer?,
class: "checkbox checkbox--light",
@ -58,7 +57,7 @@
<% end %>
</div>
<div class="text-secondary text-xs font-normal hidden md:block">
<div class="text-secondary text-xs font-normal hidden lg:block">
<% if transaction.transfer? %>
<%= render "transfers/account_links",
transfer: transaction.transfer,
@ -76,26 +75,24 @@
</div>
</div>
<div class="hidden md:flex items-center gap-1 col-span-2">
<div class="hidden lg:flex items-center gap-1 col-span-2">
<%= render "transactions/transaction_category", transaction: transaction %>
</div>
<div class="col-span-4 md:col-span-2 ml-auto text-right">
<div class="col-span-4 lg:col-span-2 ml-auto text-right">
<%= content_tag :p,
transaction.transfer? && view_ctx == "global" ? "+/- #{format_money(entry.amount_money.abs)}" : format_money(-entry.amount_money),
class: ["text-green-600": entry.amount.negative?] %>
</div>
<% if balance_trend %>
<div class="col-span-2 justify-self-end hidden md:block">
<% if balance_trend.trend %>
<%= tag.p format_money(balance_trend.trend.current),
<div class="col-span-2 justify-self-end hidden lg:block">
<% if balance_trend&.trend %>
<%= tag.p format_money(balance_trend.trend.current),
class: "font-medium text-sm text-primary" %>
<% else %>
<%= tag.p "--", class: "font-medium text-sm text-gray-400" %>
<% end %>
</div>
<% end %>
<% else %>
<%= tag.p "--", class: "font-medium text-sm text-gray-400" %>
<% end %>
</div>
</div>
<% end %>
<% end %>

View file

@ -14,9 +14,7 @@
data: { id: entry.id, "bulk-select-target": "row", action: "bulk-select#toggleRowSelection" } %>
<div class="flex items-center gap-3">
<%= tag.div class: "w-6 h-6 rounded-full p-1.5 flex items-center justify-center", style: "color: #{color}" do %>
<%= icon(icon, size: "sm", color: "current") %>
<% end %>
<%= render FilledIconComponent.new(icon: icon, size: "sm", hex_color: color, rounded: true) %>
<div class="truncate text-primary">
<%= link_to entry.name,