mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-03 04:25:21 +02:00
Account Activity View + Account Forms (#1406)
* Remove balance mode, sketch out refactor * Activity view checkpoint * Entry partials, checkpoint * Finish txn partial * Give entries context when editing for different turbo responses * Calculate change of balance for each entry * Account tabs consolidation * Translations, linting, brakeman updates * Account actions concern * Finalize forms, get account system tests passing * Get tests passing * Lint, rubocop, schema updates * Improve routing and stream responses * Fix broken routes * Add import option for adding accounts * Fix system test * Fix test specificity * Fix sparklines * Improve account redirects
This commit is contained in:
parent
12e4f1067d
commit
65db49273c
216 changed files with 2043 additions and 1620 deletions
5
app/views/investments/_cash_tab.html.erb
Normal file
5
app/views/investments/_cash_tab.html.erb
Normal file
|
@ -0,0 +1,5 @@
|
|||
<%# locals: (account:) %>
|
||||
|
||||
<%= turbo_frame_tag dom_id(account, :cash), src: account_cashes_path(account) do %>
|
||||
<%= render "account/entries/loading" %>
|
||||
<% end %>
|
1
app/views/investments/_chart.html.erb
Normal file
1
app/views/investments/_chart.html.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<%# locals: (account:) %>
|
7
app/views/investments/_form.html.erb
Normal file
7
app/views/investments/_form.html.erb
Normal file
|
@ -0,0 +1,7 @@
|
|||
<%# locals: (account:, url:) %>
|
||||
|
||||
<%= render "accounts/form", account: account, url: url do |form| %>
|
||||
<%= form.select :subtype,
|
||||
Investment::SUBTYPES,
|
||||
{ label: true, prompt: t("investments.form.subtype_prompt"), include_blank: t("investments.form.none") } %>
|
||||
<% end %>
|
5
app/views/investments/_holdings_tab.html.erb
Normal file
5
app/views/investments/_holdings_tab.html.erb
Normal file
|
@ -0,0 +1,5 @@
|
|||
<%# locals: (account:) %>
|
||||
|
||||
<%= turbo_frame_tag dom_id(account, :holdings), src: account_holdings_path(account) do %>
|
||||
<%= render "account/entries/loading" %>
|
||||
<% end %>
|
26
app/views/investments/_value_tooltip.html.erb
Normal file
26
app/views/investments/_value_tooltip.html.erb
Normal file
|
@ -0,0 +1,26 @@
|
|||
<%# locals: (value:, cash:) %>
|
||||
|
||||
<div data-controller="tooltip" data-tooltip-placement-value="right" data-tooltip-offset-value=10 data-tooltip-cross-axis-value=50>
|
||||
<%= lucide_icon("info", class: "w-4 h-4 shrink-0 text-gray-500") %>
|
||||
<div role="tooltip" data-tooltip-target="tooltip" class="tooltip bg-gray-700 text-sm p-2 rounded w-64">
|
||||
<div class="text-white">
|
||||
<%= t(".total_value_tooltip") %>
|
||||
</div>
|
||||
<div class="flex pt-3">
|
||||
<div class="text-gray-300">
|
||||
<%= t(".holdings") %>
|
||||
</div>
|
||||
<div class="text-white ml-auto">
|
||||
<%= tag.p format_money(value, precision: 0) %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex">
|
||||
<div class="text-gray-300">
|
||||
<%= t(".cash") %>
|
||||
</div>
|
||||
<div class="text-white ml-auto">
|
||||
<%= tag.p format_money(cash, precision: 0) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
3
app/views/investments/edit.html.erb
Normal file
3
app/views/investments/edit.html.erb
Normal file
|
@ -0,0 +1,3 @@
|
|||
<%= modal_form_wrapper title: t(".edit", account: @account.name) do %>
|
||||
<%= render "investments/form", account: @account, url: investment_path(@account) %>
|
||||
<% end %>
|
7
app/views/investments/new.html.erb
Normal file
7
app/views/investments/new.html.erb
Normal file
|
@ -0,0 +1,7 @@
|
|||
<% if params[:step] == "method_select" %>
|
||||
<%= render "accounts/new/method_selector", path: new_investment_path(institution_id: params[:institution_id], return_to: params[:return_to]) %>
|
||||
<% else %>
|
||||
<%= modal_form_wrapper title: t(".title") do %>
|
||||
<%= render "investments/form", account: @account, url: investments_path %>
|
||||
<% end %>
|
||||
<% end %>
|
24
app/views/investments/show.html.erb
Normal file
24
app/views/investments/show.html.erb
Normal file
|
@ -0,0 +1,24 @@
|
|||
<%= turbo_stream_from @account %>
|
||||
|
||||
<%= turbo_frame_tag dom_id(@account) do %>
|
||||
<%= tag.div class: "space-y-4" do %>
|
||||
<%= render "accounts/show/header", account: @account %>
|
||||
|
||||
<%= render "accounts/show/chart",
|
||||
account: @account,
|
||||
title: t(".chart_title"),
|
||||
tooltip: render(
|
||||
"investments/value_tooltip",
|
||||
value: @account.value,
|
||||
cash: @account.balance_money
|
||||
) %>
|
||||
|
||||
<div class="min-h-[800px]">
|
||||
<%= render "accounts/show/tabs", account: @account, tabs: [
|
||||
{ key: "activity", contents: render("accounts/show/activity", account: @account) },
|
||||
{ key: "holdings", contents: render("investments/holdings_tab", account: @account) },
|
||||
{ key: "cash", contents: render("investments/cash_tab", account: @account) }
|
||||
] %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
Loading…
Add table
Add a link
Reference in a new issue