mirror of
https://github.com/we-promise/sure.git
synced 2026-04-08 14:54:49 +00:00
* Add investment tracking to expenses Add new sections to dashboard and reporting around investments. * Create investment-integration-assessment.md * Delete .claude/settings.local.json Signed-off-by: soky srm <sokysrm@gmail.com> * Category trades * Simplify * Simplification and test fixes * FIX merge * Update views * Update 20251125141213_add_category_to_trades.rb * FIX tests * FIX statements and account status * cleanup * Add default cat for csv imports * Delete docs/roadmap/investment-integration-assessment.md Signed-off-by: soky srm <sokysrm@gmail.com> * Update trend calculation Use already existing column cost basis for trend calculation - Current value: qty * price (already stored as amount) - Cost basis total: qty * cost_basis - Unrealized gain: current value - cost basis total Fixes N+1 query also --------- Signed-off-by: soky srm <sokysrm@gmail.com>
86 lines
3.6 KiB
Plaintext
86 lines
3.6 KiB
Plaintext
<% content_for :page_header do %>
|
|
<div class="space-y-1 mb-6 flex gap-4 justify-between items-center lg:items-start">
|
|
<div class="space-y-1">
|
|
<h1 class="text-xl lg:text-3xl font-medium text-primary">
|
|
<%= t("pages.dashboard.welcome", name: Current.user.first_name) %>
|
|
</h1>
|
|
<p class="text-sm lg:text-base text-secondary">
|
|
<%= t("pages.dashboard.subtitle") %>
|
|
</p>
|
|
</div>
|
|
|
|
<%= render DS::Link.new(
|
|
icon: "plus",
|
|
text: t("pages.dashboard.new"),
|
|
href: new_account_path,
|
|
frame: :modal,
|
|
class: "hidden lg:inline-flex"
|
|
) %>
|
|
|
|
<%= render DS::Link.new(
|
|
variant: "icon-inverse",
|
|
icon: "plus",
|
|
href: new_account_path,
|
|
frame: :modal,
|
|
class: "rounded-full lg:hidden"
|
|
) %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="w-full space-y-6 pb-24" data-controller="dashboard-sortable" data-action="dragover->dashboard-sortable#dragOver drop->dashboard-sortable#drop" role="list" aria-label="Dashboard sections">
|
|
<% if Current.family.accounts.any? %>
|
|
<% @dashboard_sections.each do |section| %>
|
|
<% next unless section[:visible] %>
|
|
<section
|
|
class="bg-container rounded-xl shadow-border-xs transition-all group focus:outline-none focus-visible:ring-2 focus-visible:ring-gray-900 focus-visible:ring-offset-2"
|
|
data-dashboard-sortable-target="section"
|
|
data-section-key="<%= section[:key] %>"
|
|
data-controller="dashboard-section"
|
|
data-dashboard-section-section-key-value="<%= section[:key] %>"
|
|
data-dashboard-section-collapsed-value="<%= Current.user.dashboard_section_collapsed?(section[:key]) %>"
|
|
draggable="true"
|
|
tabindex="0"
|
|
role="listitem"
|
|
aria-grabbed="false"
|
|
aria-label="<%= t(section[:title]) %> section. Press Enter or Space to grab for reordering, then use arrow keys to move."
|
|
data-action="
|
|
dragstart->dashboard-sortable#dragStart
|
|
dragend->dashboard-sortable#dragEnd
|
|
touchstart->dashboard-sortable#touchStart
|
|
touchmove->dashboard-sortable#touchMove
|
|
touchend->dashboard-sortable#touchEnd
|
|
keydown->dashboard-sortable#handleKeyDown">
|
|
<div class="px-4 py-2 flex items-center justify-between">
|
|
<div class="flex items-center gap-2">
|
|
<button
|
|
type="button"
|
|
class="text-secondary hover:text-primary transition-colors p-0.5"
|
|
data-action="click->dashboard-section#toggle keydown->dashboard-section#handleToggleKeydown"
|
|
data-dashboard-section-target="button"
|
|
aria-label="<%= t("pages.dashboard.toggle_section") %>"
|
|
aria-expanded="<%= !Current.user.dashboard_section_collapsed?(section[:key]) %>">
|
|
<%= icon("chevron-down", size: "sm", class: "transition-transform", data: { dashboard_section_target: "chevron" }) %>
|
|
</button>
|
|
<h2 class="text-base font-medium">
|
|
<%= t(section[:title]) %>
|
|
</h2>
|
|
</div>
|
|
<button
|
|
type="button"
|
|
class="cursor-grab active:cursor-grabbing text-secondary hover:text-primary transition-colors p-0.5 opacity-0 group-hover:opacity-100"
|
|
aria-label="<%= t("pages.dashboard.drag_to_reorder") %>">
|
|
<%= icon("grip-vertical", size: "sm") %>
|
|
</button>
|
|
</div>
|
|
<div class="py-4" data-dashboard-section-target="content">
|
|
<%= render partial: section[:partial], locals: section[:locals] %>
|
|
</div>
|
|
</section>
|
|
<% end %>
|
|
<% else %>
|
|
<section>
|
|
<%= render "pages/dashboard/no_accounts_graph_placeholder" %>
|
|
</section>
|
|
<% end %>
|
|
</div>
|