From be3e6d656338771fdf1e9e2ed8354d41c712ccf2 Mon Sep 17 00:00:00 2001 From: Alessio Cappa Date: Thu, 22 Jan 2026 22:49:58 +0100 Subject: [PATCH] feat: align icon sizes and improve investments section --- .../reports/_investment_performance.html.erb | 111 ++++++++---------- app/views/reports/_summary_dashboard.html.erb | 6 +- 2 files changed, 54 insertions(+), 63 deletions(-) diff --git a/app/views/reports/_investment_performance.html.erb b/app/views/reports/_investment_performance.html.erb index b81a0a544..5431ae085 100644 --- a/app/views/reports/_investment_performance.html.erb +++ b/app/views/reports/_investment_performance.html.erb @@ -2,14 +2,12 @@ <% if investment_metrics[:has_investments] %>
-

<%= t("reports.investment_performance.title") %>

- <%# Investment Summary Cards %>
<%# Portfolio Value Card %>
-
- <%= icon("briefcase", class: "w-4 h-4 text-secondary") %> +
+ <%= icon("briefcase", size: "sm") %> <%= t("reports.investment_performance.portfolio_value") %>

@@ -19,8 +17,8 @@ <%# Total Return Card %>

-
- <%= icon("trending-up", class: "w-4 h-4 text-secondary") %> +
+ <%= icon("trending-up", size: "sm") %> <%= t("reports.investment_performance.total_return") %>
<% if investment_metrics[:unrealized_trend] %> @@ -35,8 +33,8 @@ <%# Period Contributions Card %>
-
- <%= icon("arrow-down-to-line", class: "w-4 h-4 text-secondary") %> +
+ <%= icon("arrow-down-to-line", size: "sm") %> <%= t("reports.investment_performance.contributions") %>

@@ -46,8 +44,8 @@ <%# Period Withdrawals Card %>

-
- <%= icon("arrow-up-from-line", class: "w-4 h-4 text-secondary") %> +
+ <%= icon("arrow-up-from-line", size: "sm") %> <%= t("reports.investment_performance.withdrawals") %>

@@ -59,57 +57,50 @@ <%# Top Holdings Table %> <% if investment_metrics[:top_holdings].any? %>

-

<%= t("reports.investment_performance.top_holdings") %>

+

<%= t("reports.investment_performance.top_holdings") %>

-
- - - - - - - - - - - <% investment_metrics[:top_holdings].each do |holding| %> - - - - - - + <% end %> +
+

<%= holding.ticker %>

+

<%= truncate(holding.name, length: 25) %>

+
+ +
<%= number_to_percentage(holding.weight || 0, precision: 1) %>
+
<%= format_money(holding.amount_money) %>
+
+ <% if holding.trend %> + + <%= holding.trend.percent_formatted %> + + <% else %> + <%= t("reports.investment_performance.no_data") %> + <% end %> +
+ + <% if idx < investment_metrics[:top_holdings].size - 1 %> + <%= render "shared/ruler", classes: "mx-3 lg:mx-4" %> <% end %> - -
<%= t("reports.investment_performance.holding") %><%= t("reports.investment_performance.weight") %><%= t("reports.investment_performance.value") %><%= t("reports.investment_performance.return") %>
-
- <% if holding.security.brandfetch_icon_url.present? %> - <%= holding.ticker %> - <% elsif holding.security.logo_url.present? %> - <%= holding.ticker %> - <% else %> -
- <%= holding.ticker[0..1] %> -
- <% end %> -
-

<%= holding.ticker %>

-

<%= truncate(holding.name, length: 25) %>

-
+
+
+
<%= t("reports.investment_performance.holding") %>
+
<%= t("reports.investment_performance.weight") %>
+
<%= t("reports.investment_performance.value") %>
+
<%= t("reports.investment_performance.return") %>
+
+
+ <% investment_metrics[:top_holdings].each_with_index do |holding, idx| %> +
+
+ <% if holding.security.brandfetch_icon_url.present? %> + <%= holding.ticker %> + <% elsif holding.security.logo_url.present? %> + <%= holding.ticker %> + <% else %> +
+ <%= holding.ticker[0..1] %>
-
- <%= number_to_percentage(holding.weight || 0, precision: 1) %> - - <%= format_money(holding.amount_money) %> - - <% if holding.trend %> - - <%= holding.trend.percent_formatted %> - - <% else %> - <%= t("reports.investment_performance.no_data") %> - <% end %> -
+ <% end %> +
<% end %> @@ -117,7 +108,7 @@ <%# Gains by Tax Treatment %> <% if investment_metrics[:gains_by_tax_treatment].present? %>
-

<%= t("reports.investment_performance.gains_by_tax_treatment") %>

+

<%= t("reports.investment_performance.gains_by_tax_treatment") %>

<% investment_metrics[:gains_by_tax_treatment].each do |treatment, data| %> @@ -202,7 +193,7 @@ <%# Investment Accounts Summary %> <% if investment_metrics[:accounts].any? %>
-

<%= t("reports.investment_performance.accounts") %>

+

<%= t("reports.investment_performance.accounts") %>

<% investment_metrics[:accounts].each do |account| %> diff --git a/app/views/reports/_summary_dashboard.html.erb b/app/views/reports/_summary_dashboard.html.erb index 4fff999e3..bc0436174 100644 --- a/app/views/reports/_summary_dashboard.html.erb +++ b/app/views/reports/_summary_dashboard.html.erb @@ -3,7 +3,7 @@
- <%= icon("trending-up", class: "w-5 h-5") %> + <%= icon("trending-up", size: "sm") %>

<%= t("reports.summary.total_income") %>

@@ -18,12 +18,12 @@ <% if metrics[:income_change] %>
<% if metrics[:income_change] >= 0 %> - <%= icon("arrow-up", class: "w-4 h-4 text-success") %> + <%= icon("arrow-up", size: "sm") %> +<%= metrics[:income_change] %>% <% else %> - <%= icon("arrow-down", class: "w-4 h-4 text-destructive") %> + <%= icon("arrow-down", size: "sm") %> <%= metrics[:income_change] %>%