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

Fix: Filter categories by transaction type in forms (#2082)
Some checks failed
Publish Docker image / ci (push) Has been cancelled
Publish Docker image / Build docker image (push) Has been cancelled

Changed transaction form to only display relevant categories based on transaction type (income or expense), improving usability and preventing misclassification. Created a shared transaction type tabs component for consistent navigation between expense, income, and transfer forms, providing a better user experience and reducing code duplication.

Signed-off-by: Zach Gollwitzer <zach@maybe.co>
Co-authored-by: Zach Gollwitzer <zach@maybe.co>
This commit is contained in:
Diego Gasparis Escobedo 2025-04-25 08:18:10 -06:00 committed by GitHub
parent ce83418f0b
commit 71bc51ca15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 74 additions and 67 deletions

View file

@ -0,0 +1,24 @@
<fieldset class="bg-gray-50 rounded-lg p-1 grid grid-flow-col justify-stretch gap-x-2">
<% active_tab = local_assigns[:active_tab] || 'expense' %>
<%= link_to new_transaction_path(nature: 'outflow'),
data: { turbo_frame: :modal },
class: "flex px-4 py-1 rounded-lg items-center space-x-2 justify-center text-sm md:text-normal text-subdued #{active_tab == 'expense' ? 'bg-container text-gray-800 shadow-sm' : 'hover:bg-container hover:text-gray-800 hover:shadow-sm'}" do %>
<%= lucide_icon "minus-circle", class: "w-4 h-4 md:w-5 md:h-5" %>
<%= tag.span t("shared.transaction_tabs.expense") %>
<% end %>
<%= link_to new_transaction_path(nature: 'inflow'),
data: { turbo_frame: :modal },
class: "flex px-4 py-1 rounded-lg items-center space-x-2 justify-center text-sm md:text-normal text-subdued #{active_tab == 'income' ? 'bg-container text-gray-800 shadow-sm' : 'hover:bg-container hover:text-gray-800 hover:shadow-sm'}" do %>
<%= lucide_icon "plus-circle", class: "w-4 h-4 md:w-5 md:h-5" %>
<%= tag.span t("shared.transaction_tabs.income") %>
<% end %>
<%= link_to new_transfer_path,
data: { turbo_frame: :modal },
class: "flex px-4 py-1 rounded-lg items-center space-x-2 justify-center text-sm md:text-normal text-subdued #{active_tab == 'transfer' ? 'bg-container text-gray-800 shadow-sm' : 'hover:bg-container hover:text-gray-800 hover:shadow-sm'}" do %>
<%= lucide_icon "arrow-right-left", class: "w-4 h-4 md:w-5 md:h-5" %>
<%= tag.span t("shared.transaction_tabs.transfer") %>
<% end %>
</fieldset>