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

Add Live Data to Account Page (#464)

* Add trends, time series, seed data

* Remove test data

* Replace old view values with helpers

* Fix tooltip bugs in D3 chart

* Fix tests

* Fix smoke test

* Add CRUD actions for valuations

* Scaffold out inline editing with Turbo
This commit is contained in:
Zach Gollwitzer 2024-02-20 09:07:55 -05:00 committed by GitHub
parent 298b50a909
commit b5b2d335fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 512 additions and 167 deletions

View file

@ -0,0 +1,15 @@
<%#
Locals:
- f: form object for valuation
- form_icon: string representing the icon to be displayed
- submit_button_text: string representing the text on the submit button
%>
<div class="p-4 flex items-center justify-between w-full">
<div class="shrink-0 w-8 h-8 rounded-full p-1.5 flex items-center justify-center bg-gray-500/5">
<%= lucide_icon(form_icon, class: "w-4 h-4 text-gray-500") %>
</div>
<%= f.date_field :date, class: "border border-alpha-black-200 bg-white rounded-lg shadow-xs min-w-[200px] px-3 py-1.5" %>
<%= f.number_field :value, step: :any, placeholder: number_to_currency(0), in: 0.00..100000000.00, required: 'required', class: "bg-white border border-alpha-black-200 rounded-lg shadow-xs px-3 py-1.5" %>
<%= link_to "Cancel", account_path(@valuation.account), class: "text-sm text-gray-900 hover:text-gray-800 font-medium px-3 py-1.5" %>
<%= f.submit submit_button_text, class: "bg-gray-50 rounded-lg font-medium px-3 py-1.5 cursor-pointer hover:bg-gray-100 text-sm" %>
</div>

View file

@ -0,0 +1,4 @@
<div>
<h1 class="font-bold text-4xl">Valuations#create</h1>
<p>Find me in app/views/valuations/create.html.erb</p>
</div>

View file

@ -0,0 +1,3 @@
<%# TODO: We need a way to determine the order the new valuation needs to be in the array, calculate the trend, and append it to the right spot %>
<%= turbo_stream.update Valuation.new, "" %>
<%= turbo_stream.append "notification-tray", partial: "shared/notification", locals: { type: "success", content: "Valuation created" } %>

View file

@ -0,0 +1,4 @@
<div>
<h1 class="font-bold text-4xl">Valuations#destroy</h1>
<p>Find me in app/views/valuations/destroy.html.erb</p>
</div>

View file

@ -0,0 +1,2 @@
<%= turbo_stream.remove @valuation %>
<%= turbo_stream.append "notification-tray", partial: "shared/notification", locals: { type: "success", content: "Valuation deleted" } %>

View file

@ -0,0 +1,8 @@
<div>
<h1 class="font-bold text-4xl">Edit Valuation: <%= @valuation.type %></h1>
<%= turbo_frame_tag dom_id(@valuation) do %>
<%= form_with model: @valuation, url: valuation_path(@valuation), scope: :valuation do |f| %>
<%= render 'form_row', f: f, form_icon: "pencil-line", submit_button_text: "Update" %>
<% end %>
<% end %>
</div>

View file

@ -0,0 +1,8 @@
<div>
<h1 class="font-bold text-4xl">Add Valuation: <%= @account.name %></h1>
<%= turbo_frame_tag dom_id(Valuation.new) do %>
<%= form_with model: [@account, @valuation], url: account_valuations_path(@account), scope: :valuation do |f| %>
<%= render 'form_row', f: f, form_icon: "plus", submit_button_text: "Add" %>
<% end %>
<% end %>
</div>

View file

@ -0,0 +1,4 @@
<div>
<h1 class="font-bold text-4xl">Valuation: <%= @valuation.type %></h1>
<p>Find me in app/views/valuations/show.html.erb</p>
</div>

View file

@ -0,0 +1,4 @@
<div>
<h1 class="font-bold text-4xl">Valuations#update</h1>
<p>Find me in app/views/valuations/update.html.erb</p>
</div>