mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-05 05:25:24 +02:00
57 lines
2.9 KiB
Text
57 lines
2.9 KiB
Text
<%# locals: (valuation_series:) %>
|
|
<% valuation_series.values.reverse_each.with_index do |valuation, index| %>
|
|
<% valuation_styles = trend_styles(valuation.trend) %>
|
|
<%= turbo_frame_tag dom_id(valuation.original) do %>
|
|
<div class="p-4 flex items-center">
|
|
<div class="w-16">
|
|
<div class="w-8 h-8 rounded-full p-1.5 flex items-center justify-center <%= valuation_styles[:bg_class] %>">
|
|
<%= lucide_icon(valuation_styles[:icon], class: "w-4 h-4 #{valuation_styles[:text_class]}") %>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-center justify-between grow">
|
|
<div class="text-sm">
|
|
<p><%= valuation.date %></p>
|
|
<%# TODO: Add descriptive name of valuation %>
|
|
<p class="text-gray-500">Manually entered</p>
|
|
</div>
|
|
<div class="flex text-sm font-medium text-right"><%= format_money valuation.value %></div>
|
|
</div>
|
|
<div class="flex w-56 justify-end text-right text-sm font-medium">
|
|
<% if valuation.trend.value == 0 %>
|
|
<span class="text-gray-500">No change</span>
|
|
<% else %>
|
|
<span class="<%= valuation_styles[:text_class] %>"><%= valuation_styles[:symbol] %><%= format_money valuation.trend.value.abs %></span>
|
|
<span class="<%= valuation_styles[:text_class] %>">(<%= lucide_icon(valuation_styles[:icon], class: "w-4 h-4 align-text-bottom inline") %> <%= valuation.trend.percent %>%)</span>
|
|
<% end %>
|
|
</div>
|
|
<div class="relative w-[72px]" data-controller="menu">
|
|
<button
|
|
data-menu-target="button"
|
|
class="ml-auto flex items-center justify-center hover:bg-gray-50 w-8 h-8 rounded-lg">
|
|
<%= lucide_icon("more-horizontal", class: "w-5 h-5 text-gray-500") %>
|
|
</button>
|
|
<div
|
|
data-menu-target="content"
|
|
class="absolute min-w-[200px] z-10 top-10 right-0 bg-white p-1 rounded-sm shadow-xs border border-alpha-black-25 w-fit">
|
|
<%= link_to edit_valuation_path(valuation.original),
|
|
class: "flex gap-1 items-center hover:bg-gray-50 rounded-md p-2" do %>
|
|
<%= lucide_icon("pencil-line", class: "w-5 h-5 text-gray-500 shrink-0") %>
|
|
<span class="text-gray-900 text-sm">Edit entry</span>
|
|
<% end %>
|
|
<%= link_to valuation_path(valuation.original),
|
|
data: { turbo_method: :delete,
|
|
turbo_confirm: { title: t(".confirm_title"),
|
|
body: t(".confirm_body_html"),
|
|
accept: t(".confirm_accept") } },
|
|
class: "text-red-600 flex gap-1 items-center hover:bg-gray-50 rounded-md p-2" do %>
|
|
<%= lucide_icon("trash-2", class: "w-5 h-5 shrink-0") %>
|
|
<span class="text-sm">Delete entry</span>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% unless index == valuation_series.values.size - 1 %>
|
|
<div class="h-px bg-alpha-black-50 ml-20 mr-4"></div>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|