mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 14:31:25 +00:00
* Replace text-tertiary with text-subdued in views Replace usages of the text-tertiary utility with text-subdued across several view partials to standardize subdued text styling because text-tertiary does not exist in the design system (reports, doorkeeper auth, simplefin items). Also adjust the net worth empty-liabilities markup to use a grid layout for consistent spacing, and update the related controller test selector to match the new CSS class. * Standardize empty net worth message markup Replace inconsistent markup and classes for empty asset/liability sections in the net worth partial. Swap text-secondary/p-2/text-center for text-subdued with unified padding (py-3 px-4 lg:px-6), and simplify the liabilities block from a grid/div to a single paragraph for consistent styling and spacing.
83 lines
4.1 KiB
Plaintext
83 lines
4.1 KiB
Plaintext
<div class="space-y-8">
|
|
<%# Month-over-Month Trends %>
|
|
<div>
|
|
<h3 class="text-lg font-medium mb-4">
|
|
<%= t("reports.trends.monthly_breakdown") %>
|
|
</h3>
|
|
|
|
<% if trends_data.any? %>
|
|
<div class="bg-container-inset rounded-xl p-1 overflow-x-auto">
|
|
<div class="w-max sm:w-full">
|
|
<div role="columnheader" 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-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-subdued">(<%= t("reports.trends.current") %>)</span>
|
|
<% end %>
|
|
</div>
|
|
<div class="text-right">
|
|
<%= Money.new(trend[:income], Current.family.currency).format %>
|
|
</div>
|
|
<div class="text-right">
|
|
<%= Money.new(trend[:expenses], Current.family.currency).format %>
|
|
</div>
|
|
<div class="text-right <%= trend[:net] >= 0 ? "text-success" : "text-destructive" %>">
|
|
<%= Money.new(trend[:net], Current.family.currency).format %>
|
|
</div>
|
|
<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>
|
|
</div>
|
|
<% if idx < trends_data.size - 1 %>
|
|
<%= render "shared/ruler", classes: "mx-3 lg:mx-4" %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<%# Trend Insights %>
|
|
<div class="mt-6 grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
<% avg_income = trends_data.sum { |t| t[:income] } / trends_data.length %>
|
|
<% avg_expenses = trends_data.sum { |t| t[:expenses] } / trends_data.length %>
|
|
<% avg_net = trends_data.sum { |t| t[:net] } / trends_data.length %>
|
|
|
|
<div class="p-4 bg-surface-inset rounded-lg">
|
|
<p class="text-sm text-secondary mb-1"><%= t("reports.trends.avg_monthly_income") %></p>
|
|
<p class="text-lg font-semibold text-success">
|
|
<%= Money.new(avg_income, Current.family.currency).format %>
|
|
</p>
|
|
</div>
|
|
|
|
<div class="p-4 bg-surface-inset rounded-lg">
|
|
<p class="text-sm text-secondary mb-1"><%= t("reports.trends.avg_monthly_expenses") %></p>
|
|
<p class="text-lg font-semibold text-destructive">
|
|
<%= Money.new(avg_expenses, Current.family.currency).format %>
|
|
</p>
|
|
</div>
|
|
|
|
<div class="p-4 bg-surface-inset rounded-lg">
|
|
<p class="text-sm text-secondary mb-1"><%= t("reports.trends.avg_monthly_savings") %></p>
|
|
<p class="text-lg font-semibold <%= avg_net >= 0 ? "text-success" : "text-destructive" %>">
|
|
<%= Money.new(avg_net, Current.family.currency).format %>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<% else %>
|
|
<div class="text-center py-8 text-subdued">
|
|
<%= t("reports.trends.no_data") %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|