mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-07 14:35:23 +02:00
Since the very first 0.1.0-alpha.1 release, we've been moving quickly to add new features to the Maybe app. In doing so, some parts of the codebase have become outdated, unnecessary, or overly-complex as a natural result of this feature prioritization. Now that "core" Maybe is complete, we're moving into a second phase of development where we'll be working hard to improve the accuracy of existing features and build additional features on top of "core". This PR is a quick overhaul of the existing codebase aimed to: - Establish the brand new and simplified dashboard view (pictured above) - Establish and move towards the conventions introduced in Cursor rules and project design overview #1788 - Consolidate layouts and improve the performance of layout queries - Organize the core models of the Maybe domain (i.e. Account::Entry, Account::Transaction, etc.) and break out specific traits of each model into dedicated concerns for better readability - Remove stale / dead code from codebase - Remove overly complex code paths in favor of simpler ones
105 lines
4.1 KiB
Text
105 lines
4.1 KiB
Text
<%= drawer do %>
|
|
<header class="mb-4 space-y-1">
|
|
<div class="flex items-center gap-4">
|
|
<h3 class="font-medium">
|
|
<span class="text-2xl">
|
|
<%= format_money @transfer.amount_abs %>
|
|
</span>
|
|
|
|
<span class="text-lg text-secondary">
|
|
<%= @transfer.amount_abs.currency.iso_code %>
|
|
</span>
|
|
</h3>
|
|
|
|
<%= lucide_icon "arrow-left-right", class: "text-secondary mt-1 w-5 h-5" %>
|
|
</div>
|
|
|
|
<span class="text-sm text-secondary">
|
|
<%= @transfer.name %>
|
|
</span>
|
|
</header>
|
|
|
|
<div class="space-y-2">
|
|
<!-- Overview Section -->
|
|
<%= disclosure t(".overview") do %>
|
|
<div class="pb-4 px-3 pt-2 text-sm space-y-3 text-primary">
|
|
<div class="space-y-3">
|
|
<dl class="flex items-center gap-2 justify-between">
|
|
<dt class="text-secondary">From</dt>
|
|
<dd class="flex items-center gap-2 font-medium">
|
|
<%= render "accounts/logo", account: @transfer.from_account, size: "sm" %>
|
|
<%= link_to @transfer.from_account.name, account_path(@transfer.from_account), data: { turbo_frame: "_top" } %>
|
|
</dd>
|
|
</dl>
|
|
|
|
<dl class="flex items-center gap-2 justify-between">
|
|
<dt class="text-secondary">Date</dt>
|
|
<dd class="font-medium"><%= l(@transfer.outflow_transaction.entry.date, format: :long) %></dd>
|
|
</dl>
|
|
|
|
<dl class="flex items-center gap-2 justify-between">
|
|
<dt class="text-secondary">Amount</dt>
|
|
<dd class="font-medium text-red-500"><%= format_money @transfer.outflow_transaction.entry.amount_money * -1 %></dd>
|
|
</dl>
|
|
</div>
|
|
|
|
<div class="bg-alpha-black-100 h-px my-2"></div>
|
|
|
|
<div class="space-y-3">
|
|
<dl class="flex items-center gap-2 justify-between">
|
|
<dt class="text-secondary">To</dt>
|
|
<dd class="flex items-center gap-2 font-medium">
|
|
<%= render "accounts/logo", account: @transfer.to_account, size: "sm" %>
|
|
<%= link_to @transfer.to_account.name, account_path(@transfer.to_account), data: { turbo_frame: "_top" } %>
|
|
</dd>
|
|
</dl>
|
|
|
|
<dl class="flex items-center gap-2 justify-between">
|
|
<dt class="text-secondary">Date</dt>
|
|
<dd class="font-medium"><%= l(@transfer.inflow_transaction.entry.date, format: :long) %></dd>
|
|
</dl>
|
|
|
|
<dl class="flex items-center gap-2 justify-between">
|
|
<dt class="text-secondary">Amount</dt>
|
|
<dd class="font-medium text-green-500">+<%= format_money @transfer.inflow_transaction.entry.amount_money * -1 %></dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
|
|
<!-- Details Section -->
|
|
<%= disclosure t(".details") do %>
|
|
<%= styled_form_with model: @transfer,
|
|
data: { controller: "auto-submit-form" }, class: "space-y-2" do |f| %>
|
|
<% if @transfer.categorizable? %>
|
|
<%= f.collection_select :category_id, @categories.alphabetically, :id, :name, { label: "Category", include_blank: "Uncategorized", selected: @transfer.outflow_transaction.category&.id }, "data-auto-submit-form-target": "auto" %>
|
|
<% end %>
|
|
|
|
<%= f.text_area :notes,
|
|
label: t(".note_label"),
|
|
placeholder: t(".note_placeholder"),
|
|
rows: 5,
|
|
"data-auto-submit-form-target": "auto" %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<!-- Settings Section -->
|
|
<%= disclosure t(".settings") do %>
|
|
<div class="pb-4">
|
|
<div class="flex items-center justify-between gap-2 p-3">
|
|
<div class="text-sm space-y-1">
|
|
<h4 class="text-primary"><%= t(".delete_title") %></h4>
|
|
<p class="text-secondary"><%= t(".delete_subtitle") %></p>
|
|
</div>
|
|
|
|
<%= button_to t(".delete"),
|
|
transfer_path(@transfer),
|
|
method: :delete,
|
|
class: "rounded-lg px-3 py-2 whitespace-nowrap text-red-500 text-sm
|
|
font-medium border border-secondary",
|
|
data: { turbo_confirm: true, turbo_frame: "_top" } %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|