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

Basic Portfolio Views (#1000)

* Add holdings tab to account view

* Basic portfolio UI

* Cleanup

* Handle missing holding data

* Remove synced at (implemented in separate pr)

* translations

* Tweak post sync streams

* Remove stale methods from merge conflict
This commit is contained in:
Zach Gollwitzer 2024-07-25 16:46:04 -04:00 committed by GitHub
parent ef4be7948a
commit 7c2091b343
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
37 changed files with 582 additions and 86 deletions

View file

@ -1,6 +1,6 @@
<%= turbo_stream_from @account %>
<div class="space-y-4">
<%= tag.div id: dom_id(@account), class: "space-y-4" do %>
<div class="flex justify-between items-center">
<div class="flex items-center gap-3">
<%= image_tag account_logo_url(@account), class: "w-8 h-8" %>
@ -74,22 +74,17 @@
</div>
</div>
<% selected_tab = params[:tab] || "value" %>
<% selected_tab_key, selected_tab_content_path = selected_account_tab(@account).values_at(:key, :content_path) %>
<div class="flex gap-2 text-sm text-gray-900 font-medium mb-4">
<%= link_to t(".value"), account_path(tab: "value"), class: ["px-2 py-1.5 rounded-md border border-transparent", "bg-white shadow-xs border-alpha-black-50": selected_tab == "value"] %>
<%= link_to t(".transactions"), account_path(tab: "transactions"), class: ["px-2 py-1.5 rounded-md border border-transparent", "bg-white shadow-xs border-alpha-black-50": selected_tab == "transactions"] %>
<% account_tabs(@account).each do |tab| %>
<%= link_to tab[:label], tab[:path], class: ["px-2 py-1.5 rounded-md border border-transparent", "bg-white shadow-xs border-alpha-black-50": selected_tab_key == tab[:key]] %>
<% end %>
</div>
<div class="min-h-[800px]">
<% if selected_tab == "transactions" %>
<%= turbo_frame_tag dom_id(@account, "transactions"), src: transaction_account_entries_path(@account) do %>
<%= render "account/entries/loading" %>
<% end %>
<% else %>
<%= turbo_frame_tag dom_id(@account, "valuations"), src: valuation_account_entries_path(@account) do %>
<%= render "account/entries/loading" %>
<% end %>
<%= turbo_frame_tag dom_id(@account, selected_tab_key), src: selected_tab_content_path do %>
<%= render "account/entries/loading" %>
<% end %>
</div>
</div>
<% end %>