refactor: remove unnecessary classes

This commit is contained in:
Alessio Cappa
2026-01-22 23:03:15 +01:00
parent be3e6d6563
commit 68c7e63eb7
4 changed files with 28 additions and 28 deletions

View File

@@ -16,9 +16,9 @@
<div class="bg-container-inset rounded-xl p-1 overflow-x-auto">
<div class="w-max sm:w-full">
<div class="grid grid-cols-4 sm:grid-cols-12 items-center uppercase text-xs font-medium text-secondary px-4 py-2">
<div class="col-span-2 sm:col-span-6 font-medium text-secondary"><%= t("reports.transactions_breakdown.table.category") %></div>
<div class="col-span-1 sm:col-span-3 justify-self-end font-medium text-secondary">
<div class="grid grid-cols-4 items-center uppercase text-xs font-medium text-secondary px-4 py-2">
<div class="col-span-2 font-medium text-secondary"><%= t("reports.transactions_breakdown.table.category") %></div>
<div class="col-span-1 text-right font-medium text-secondary">
<%= link_to reports_path(amount_sort_params), class: "inline-flex items-center gap-1 hover:text-primary" do %>
<%= t("reports.transactions_breakdown.table.amount") %>
<% if current_sort_by == "amount" %>
@@ -26,7 +26,7 @@
<% end %>
<% end %>
</div>
<div class="col-span-1 sm:col-span-3 justify-self-end font-medium text-secondary"><%= t("reports.transactions_breakdown.table.percentage") %></div>
<div class="col-span-1 text-right font-medium text-secondary"><%= t("reports.transactions_breakdown.table.percentage") %></div>
</div>
<div class="bg-container rounded-lg shadow-border-xs">

View File

@@ -3,8 +3,8 @@
is_sub = level == :subcategory
%>
<div class="grid grid-cols-4 sm:grid-cols-12 items-center text-secondary text-sm py-3 px-4 lg:px-6 <%= is_sub ? "pl-7 lg:pl-9" : "" %>">
<div class="col-span-2 sm:col-span-6 flex items-center gap-2">
<div class="grid grid-cols-4 items-center text-secondary text-sm py-3 px-4 lg:px-6 <%= is_sub ? "pl-7 lg:pl-9" : "" %>">
<div class="col-span-2 flex items-center gap-2">
<% if is_sub %>
<div class="text-subdued">
<%= icon "corner-down-right" %>
@@ -36,13 +36,13 @@
</span>
</div>
<div class="col-span-1 sm:col-span-3 justify-self-end">
<div class="col-span-1 text-right">
<span class="text-sm <%= color_class %>">
<%= Money.new(item[:total], Current.family.currency).format %>
</span>
</div>
<div class="col-span-1 sm:col-span-3 justify-self-end">
<div class="col-span-1 text-right">
<span class="text-sm text-secondary">
<%= percentage %>%
</span>

View File

@@ -61,15 +61,15 @@
<div class="bg-container-inset rounded-xl p-1 overflow-x-auto">
<div class="grid grid-cols-4 items-center uppercase text-xs font-medium text-secondary px-4 py-2">
<div class="col-span-1 font-medium text-secondary"><%= t("reports.investment_performance.holding") %></div>
<div class="col-span-1 text-right font-medium text-secondary"><%= t("reports.investment_performance.weight") %></div>
<div class="col-span-1 text-right font-medium text-secondary"><%= t("reports.investment_performance.value") %></div>
<div class="col-span-1 text-right font-medium text-secondary"><%= t("reports.investment_performance.return") %></div>
<div class="font-medium text-secondary"><%= t("reports.investment_performance.holding") %></div>
<div class="text-right font-medium text-secondary"><%= t("reports.investment_performance.weight") %></div>
<div class="text-right font-medium text-secondary"><%= t("reports.investment_performance.value") %></div>
<div class="text-right font-medium text-secondary"><%= t("reports.investment_performance.return") %></div>
</div>
<div class="bg-container rounded-lg shadow-border-xs">
<% investment_metrics[:top_holdings].each_with_index do |holding, idx| %>
<div class="grid grid-cols-4 items-center text-secondary text-sm py-3 px-4 lg:px-6">
<div class="col-span-1 flex items-center gap-3">
<div class="flex items-center gap-3">
<% if holding.security.brandfetch_icon_url.present? %>
<img src="<%= holding.security.brandfetch_icon_url %>" alt="<%= holding.ticker %>" class="w-6 h-6 rounded-full">
<% elsif holding.security.logo_url.present? %>
@@ -84,9 +84,9 @@
<p class="text-xs text-secondary"><%= truncate(holding.name, length: 25) %></p>
</div>
</div>
<div class="col-span-1 text-right text-secondary"><%= number_to_percentage(holding.weight || 0, precision: 1) %></div>
<div class="col-span-1 text-right font-medium text-primary"><%= format_money(holding.amount_money) %></div>
<div class="col-span-1 text-right">
<div class="text-right text-secondary"><%= number_to_percentage(holding.weight || 0, precision: 1) %></div>
<div class="text-right font-medium text-primary"><%= format_money(holding.amount_money) %></div>
<div class="text-right">
<% if holding.trend %>
<span style="color: <%= holding.trend.color %>">
<%= holding.trend.percent_formatted %>

View File

@@ -8,32 +8,32 @@
<% if trends_data.any? %>
<div class="bg-container-inset rounded-xl p-1 overflow-x-auto">
<div class="w-max sm:w-full">
<div class="grid grid-cols-6 sm:grid-cols-10 items-center uppercase text-xs font-medium text-secondary px-4 py-2">
<div class="col-span-2 sm:col-span-2 font-medium text-secondary"><%= t("reports.trends.month") %></div>
<div class="col-span-1 sm:col-span-2 justify-self-end font-medium text-secondary"><%= t("reports.trends.income") %></div>
<div class="col-span-1 sm:col-span-2 justify-self-end font-medium text-secondary"><%= t("reports.trends.expenses") %></div>
<div class="col-span-1 sm:col-span-2 justify-self-end font-medium text-secondary"><%= t("reports.trends.net") %></div>
<div class="col-span-1 sm:col-span-2 justify-self-end font-medium text-secondary"><%= t("reports.trends.savings_rate") %></div>
<div class="grid grid-cols-5 items-center uppercase text-xs font-medium text-secondary px-4 py-2">
<div class="font-medium text-secondary"><%= t("reports.trends.month") %></div>
<div class="text-right font-medium text-secondary"><%= t("reports.trends.income") %></div>
<div class="text-right font-medium text-secondary"><%= t("reports.trends.expenses") %></div>
<div class="text-right font-medium text-secondary"><%= t("reports.trends.net") %></div>
<div class="text-right font-medium text-secondary"><%= t("reports.trends.savings_rate") %></div>
</div>
<div class="bg-container rounded-lg shadow-border-xs">
<% trends_data.each_with_index do |trend, idx| %>
<div class="grid grid-cols-6 sm:grid-cols-10 items-center text-secondary text-sm py-3 px-4 lg:px-6">
<div class="col-span-2 sm:col-span-2 flex items-center gap-2 <%= trend[:is_current_month] ? "font-medium" : "" %>">
<div class="grid grid-cols-5 items-center text-secondary text-sm py-3 px-4 lg:px-6">
<div class="flex items-center gap-2 <%= trend[:is_current_month] ? "font-medium" : "" %>">
<%= trend[:month] %>
<% if trend[:is_current_month] %>
<span class="text-xs text-tertiary">(<%= t("reports.trends.current") %>)</span>
<% end %>
</div>
<div class="col-span-1 sm:col-span-2 justify-self-end">
<div class="text-right">
<%= Money.new(trend[:income], Current.family.currency).format %>
</div>
<div class="col-span-1 sm:col-span-2 justify-self-end">
<div class="text-right">
<%= Money.new(trend[:expenses], Current.family.currency).format %>
</div>
<div class="col-span-1 sm:col-span-2 justify-self-end <%= trend[:net] >= 0 ? "text-success" : "text-destructive" %>">
<div class="text-right <%= trend[:net] >= 0 ? "text-success" : "text-destructive" %>">
<%= Money.new(trend[:net], Current.family.currency).format %>
</div>
<div class="col-span-1 sm:col-span-2 justify-self-end <%= trend[:net] >= 0 ? "text-success" : "text-destructive" %>">
<div class="text-right <%= trend[:net] >= 0 ? "text-success" : "text-destructive" %>">
<% savings_rate = trend[:income] > 0 ? ((trend[:net].to_f / trend[:income].to_f) * 100).round(1) : 0 %>
<%= savings_rate %>%
</div>