mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-04 04:55:20 +02:00
Build out account sidebar (#391)
* Build out account sidebar * Use detail and summary element instead of controller * Update localisation * Remove redundant code
This commit is contained in:
parent
6254ea9d8a
commit
9284352f06
4 changed files with 42 additions and 18 deletions
30
app/views/accounts/_account_list.html.erb
Normal file
30
app/views/accounts/_account_list.html.erb
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<%# locals: (type:) -%>
|
||||||
|
|
||||||
|
<% accounts = Current.family.accounts.where(accountable_type: type.name) %>
|
||||||
|
|
||||||
|
<details class="text-sm mb-1 group">
|
||||||
|
<summary class="flex gap-4 px-2 py-3 items-center w-full rounded-[10px] font-medium hover:bg-[#f2f2f2]">
|
||||||
|
<%= lucide_icon("chevron-down", class: "hidden group-open:block text-[#737373] w-5 h-5") %>
|
||||||
|
<%= lucide_icon("chevron-right", class: "group-open:hidden text-[#737373] w-5 h-5") %>
|
||||||
|
<div class="text-left"><%= type.model_name.human %></div>
|
||||||
|
<div class="ml-auto"><%= humanized_money_with_symbol accounts.sum(&:balance) %></div>
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
<% accounts.each do |account| %>
|
||||||
|
<div class="flex gap-3 px-2 py-3 items-center w-full mb-1">
|
||||||
|
<div>
|
||||||
|
<p class="font-medium"><%= account.name %></p>
|
||||||
|
<% if account.subtype %>
|
||||||
|
<p class="text-xs text-[#737373]"><%= account.subtype&.humanize %></p>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<p class="ml-auto font-medium"><%= humanized_money_with_symbol account.balance %></p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= link_to new_account_path(step: 'method', type: type.name.demodulize), class: "flex items-center gap-4 px-2 py-3 mb-1 text-[#737373] text-sm font-medium rounded-[10px] hover:bg-[#f2f2f2]", data: { turbo_frame: "modal" } do %>
|
||||||
|
<%= lucide_icon("plus", class: "w-5 h-5") %>
|
||||||
|
<p>New <%= type.model_name.human.downcase %></p>
|
||||||
|
<% end %>
|
||||||
|
</details>
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
</nav>
|
</nav>
|
||||||
<div class="flex flex-col mt-6">
|
<div class="flex flex-col mt-6">
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<%= link_to accounts_path, class: 'text-xs' do%>
|
<%= link_to accounts_path, class: 'text-xs uppercase text-[#737373] font-bold tracking-wide' do%>
|
||||||
<%= t('.accounts') %>
|
<%= t('.accounts') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= link_to new_account_path, class: 'block hover:bg-gray-100 p-2 text-sm font-semibold text-gray-900 flex items-center rounded', title: t('.new_account'), data: { turbo_frame: "modal" } do %>
|
<%= link_to new_account_path, class: 'block hover:bg-gray-100 p-2 text-sm font-semibold text-gray-900 flex items-center rounded', title: t('.new_account'), data: { turbo_frame: "modal" } do %>
|
||||||
|
@ -64,20 +64,15 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
|
||||||
<h2 class="text-sm font-semibold font-display"><%= t('.cash') %></h2>
|
|
||||||
|
|
||||||
<% Current.family.accounts.each do |account| %>
|
<%= link_to new_account_path, class: "flex items-center gap-4 px-2 py-3 mb-1 text-[#737373] text-sm font-medium rounded-[10px] hover:bg-[#f2f2f2]", data: { turbo_frame: "modal" } do %>
|
||||||
<div class="flex items-center justify-between py-2">
|
<%= lucide_icon("plus", class: "w-5 h-5") %>
|
||||||
<div class="flex items-center text-sm">
|
<p><%= t('.new_account') %></p>
|
||||||
<%= account.name %>
|
<% end %>
|
||||||
</div>
|
|
||||||
<p class="text-sm text-right">
|
<% Account.accountable_types.each do |type| %>
|
||||||
<span class="block mb-1"><%= humanized_money_with_symbol account.balance %></span>
|
<%= render 'accounts/account_list', type: type.constantize %>
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<main class="flex-grow py-5 pr-5">
|
<main class="flex-grow py-5 pr-5">
|
||||||
|
|
|
@ -12,8 +12,8 @@ en:
|
||||||
models:
|
models:
|
||||||
account: Account
|
account: Account
|
||||||
account/credit: Credit Card
|
account/credit: Credit Card
|
||||||
account/depository: Bank Accounts
|
account/depository: Bank Account
|
||||||
account/investment: Investments
|
account/investment: Investment
|
||||||
account/loan: Loan
|
account/loan: Loan
|
||||||
account/other_asset: Other Asset
|
account/other_asset: Other Asset
|
||||||
account/other_liability: Other Liability
|
account/other_liability: Other Liability
|
||||||
|
|
|
@ -3,9 +3,8 @@ en:
|
||||||
layouts:
|
layouts:
|
||||||
application:
|
application:
|
||||||
accounts: Accounts
|
accounts: Accounts
|
||||||
cash: Cash
|
|
||||||
dashboard: Dashboard
|
dashboard: Dashboard
|
||||||
new_account: New Account
|
new_account: New account
|
||||||
auth:
|
auth:
|
||||||
or: or
|
or: or
|
||||||
privacy_policy: Privacy Policy
|
privacy_policy: Privacy Policy
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue