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

Dashboard View and Calculations (#521)

* Handle Turbo updates with tabs

Fixes #491

* Add Filterable concern for controllers

* Add trendline chart

* Extract common UI to partials

* Series refactor

* Put placeholders for calculations in

* Add classification generated column to account

* Add basic net worth calculation

* Add net worth tests

* Get net worth graph working

* Fix lint errors

* Implement asset grouping query

* Make trends and series more intuitive

* Fully functional dashboard

* Remove logging
This commit is contained in:
Zach Gollwitzer 2024-03-06 09:56:59 -05:00 committed by GitHub
parent 680a91d807
commit 6f0e410684
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 594 additions and 74 deletions

View file

@ -0,0 +1,51 @@
<%# locals: (account_group:) %>
<% accountable_type, account_details = account_group%>
<% text_class = accountable_text_class(accountable_type) %>
<details class="open:bg-gray-25 group">
<summary class="flex p-4 items-center w-full rounded-lg font-medium hover:bg-gray-50 text-gray-500 text-sm font-medium cursor-pointer">
<%= lucide_icon("chevron-down", class: "hidden group-open:block w-5 h-5") %>
<%= lucide_icon("chevron-right", class: "group-open:hidden w-5 h-5") %>
<div class="ml-4 h-2.5 w-2.5 rounded-full <%= accountable_bg_class(accountable_type) %>"></div>
<p class="text-gray-900 ml-2"><%= to_accountable_title(Accountable.from_type(accountable_type)) %></p>
<span class="mx-1">&middot;</span>
<div ><%= account_details[:accounts].size %></div>
<div class="ml-auto text-right flex items-center gap-10 text-sm font-medium text-gray-900">
<div class="flex items-center justify-end gap-2 w-24">
<%= render partial: "shared/progress_circle", locals: { progress: account_details[:allocation], text_class: text_class } %>
<p><%= account_details[:allocation] %>%</p>
</div>
<div class="w-24">
<p><%= format_currency account_details[:end_balance] %></p>
</div>
<div class="w-40">
<%= render partial: "shared/trend_change", locals: { trend: account_details[:trend] } %>
</div>
</div>
</summary>
<div class="px-4 py-3 space-y-4">
<% account_details[:accounts].map do |account| %>
<div class="flex items-center justify-between text-sm font-medium text-gray-900">
<div class="flex items-center gap-4">
<div class="flex items-center justify-center w-8 h-8 rounded-full <%= text_class %> <%= accountable_bg_transparent_class(accountable_type) %>">
<%= account[:name][0].upcase %>
</div>
<div>
<p><%= account[:name] %></p>
</div>
</div>
<div class="flex gap-10 items-center text-right">
<div class="flex items-center justify-end gap-2 w-24">
<%= render partial: "shared/progress_circle", locals: { progress: account[:allocation], text_class: text_class } %>
<p><%= account[:allocation] %>%</p>
</div>
<div class="w-24">
<p><%= format_currency account[:end_balance] %></p>
</div>
<div class="w-40">
<%= render partial: "shared/trend_change", locals: { trend: account[:trend] } %>
</div>
</div>
</div>
<% end %>
</div>
</details>