Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

Merge main: resolve grid layout conflicts, add missing privacy-sensitive coverage

sokiee9693477761e3
diff --cc app/views/layouts/shared/_head.html.erb
index 560bece5da,d908a5d0a3..91ea7910db
--- a/app/views/layouts/shared/_head.html.erb
+++ b/app/views/layouts/shared/_head.html.erb
@@@ -8,10 -8,8 +8,9 @@@
<%= combobox_style_tag %>
- <%= yield :plaid_link %>
<%= javascript_importmap_tags %>
<%= render "layouts/dark_mode_check" %>
+ <%= render "layouts/privacy_mode_check" %>
<%= turbo_refreshes_with method: :morph, scroll: :preserve %>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover">
diff --cc app/views/pages/dashboard/_cashflow_sankey.html.erb
index fe15a4fdcb,fe15a4fdcb..5ec8de5ee1
--- a/app/views/pages/dashboard/_cashflow_sankey.html.erb
+++ b/app/views/pages/dashboard/_cashflow_sankey.html.erb
@@@ -15,7 -15,7 +15,7 @@@
data-controller="sankey-chart"
data-sankey-chart-data-value="<%= sankey_data.to_json %>"
data-sankey-chart-currency-symbol-value="<%= sankey_data[:currency_symbol] %>"
-- class="w-full h-full"></div>
++ class="w-full h-full privacy-sensitive"></div>
</div>
<%= render DS::Dialog.new(id: "cashflow-expanded-dialog", auto_open: false, width: "custom", disable_frame: true, content_class: "!w-[96vw] max-w-[1650px]", data: { action: "close->cashflow-expand#restore" }) do |dialog| %>
<% dialog.with_header(title: t("pages.dashboard.cashflow_sankey.title")) %>
@@@ -25,7 -25,7 +25,7 @@@
data-controller="sankey-chart"
data-sankey-chart-data-value="<%= sankey_data.to_json %>"
data-sankey-chart-currency-symbol-value="<%= sankey_data[:currency_symbol] %>"
-- class="w-full h-full"></div>
++ class="w-full h-full privacy-sensitive"></div>
</div>
<% end %>
<% end %>
diff --cc app/views/pages/dashboard/_investment_summary.html.erb
index b6e39afeff,c6396e1dd2..ef5d7222ef
--- a/app/views/pages/dashboard/_investment_summary.html.erb
+++ b/app/views/pages/dashboard/_investment_summary.html.erb
@@@ -27,50 -27,52 +27,52 @@@
<% holdings = investment_statement.top_holdings(limit: 5) %>
<% if holdings.any? %>
- <div class="bg-container-inset rounded-xl p-1 mx-4">
- <div class="px-4 py-2 flex items-center uppercase text-xs font-medium text-secondary">
- <div class="flex-1"><%= t(".holding") %></div>
- <div class="w-20 text-right"><%= t(".weight") %></div>
- <div class="w-28 text-right"><%= t(".value") %></div>
- <div class="w-24 text-right"><%= t(".return") %></div>
- </div>
+ <div class="bg-container-inset rounded-xl p-1 mx-4 overflow-x-auto">
+ <div class="w-max sm:w-full">
+ <div class="px-4 py-2 grid grid-cols-4 items-center uppercase text-xs font-medium text-secondary">
+ <div class="flex-1"><%= t(".holding") %></div>
+ <div class="text-right"><%= t(".weight") %></div>
+ <div class="text-right"><%= t(".value") %></div>
+ <div class="text-right"><%= t(".return") %></div>
+ </div>
- <div class="shadow-border-xs rounded-lg bg-container font-medium text-sm">
- <% holdings.each_with_index do |holding, idx| %>
- <div class="p-4 flex items-center <%= idx < holdings.size - 1 ? "border-b border-primary" : "" %>">
- <div class="flex-1 flex items-center gap-3">
- <% if holding.security.logo_url.present? %>
- <img src="<%= holding.security.logo_url %>" alt="<%= holding.ticker %>" class="w-8 h-8 rounded-full">
- <% else %>
- <div class="w-8 h-8 rounded-full bg-container-inset flex items-center justify-center text-xs font-medium text-secondary">
- <%= holding.ticker[0..1] %>
+ <div class="shadow-border-xs rounded-lg bg-container font-medium text-sm">
+ <% holdings.each_with_index do |holding, idx| %>
+ <div class="p-4 grid grid-cols-4 items-center <%= idx < holdings.size - 1 ? "border-b border-primary" : "" %>">
+ <div class="flex-1 flex items-center gap-3">
+ <% if holding.security.logo_url.present? %>
+ <img src="<%= holding.security.logo_url %>" alt="<%= holding.ticker %>" class="w-8 h-8 rounded-full">
+ <% else %>
+ <div class="w-8 h-8 rounded-full bg-container-inset flex items-center justify-center text-xs font-medium text-secondary">
+ <%= holding.ticker.to_s.first(2).presence || "—" %>
+ </div>
+ <% end %>
+ <div class="max-w-32">
+ <p class="font-medium truncate"><%= holding.ticker %></p>
+ <p class="text-xs text-secondary"><%= truncate(holding.name, length: 20) %></p>
</div>
- <% end %>
- <div>
- <p class="font-medium"><%= holding.ticker %></p>
- <p class="text-xs text-secondary"><%= truncate(holding.name, length: 20) %></p>
</div>
- </div>
- <div class="w-20 text-right text-secondary privacy-sensitive">
- <%= number_to_percentage(holding.weight || 0, precision: 1) %>
- </div>
- <div class="text-right text-secondary">
++ <div class="text-right text-secondary privacy-sensitive">
+ <%= number_to_percentage(holding.weight || 0, precision: 1) %>
+ </div>
- <div class="w-28 text-right privacy-sensitive">
- <%= format_money(holding.amount_money) %>
- </div>
- <div class="text-right">
++ <div class="text-right privacy-sensitive">
+ <%= format_money(holding.amount_money) %>
+ </div>
- <div class="w-24 text-right">
- <% if holding.trend %>
- <span class="privacy-sensitive" style="color: <%= holding.trend.color %>">
- <%= holding.trend.percent_formatted %>
- </span>
- <% else %>
- <span class="text-secondary">-</span>
- <% end %>
+ <div class="text-right">
+ <% if holding.trend %>
- <span style="color: <%= holding.trend.color %>">
++ <span class="privacy-sensitive" style="color: <%= holding.trend.color %>">
+ <%= holding.trend.percent_formatted %>
+ </span>
+ <% else %>
+ <span class="text-secondary">-</span>
+ <% end %>
+ </div>
</div>
- </div>
- <% end %>
+ <% end %>
+ </div>
</div>
</div>
<% end %>
diff --cc app/views/reports/_investment_performance.html.erb
index a3c5145539,88fa6f9793..e50c2b8ea1
--- a/app/views/reports/_investment_performance.html.erb
+++ b/app/views/reports/_investment_performance.html.erb
@@@ -58,48 -58,49 +58,49 @@@
<% if investment_metrics[:top_holdings].any? %>
<div class="space-y-3">
<h4 class="text-lg font-medium"><%= t("reports.investment_performance.top_holdings") %></h4>
-
<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="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="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? %>
- <img src="<%= Setting.transform_brand_fetch_url(holding.security.logo_url) %>" alt="<%= holding.ticker %>" class="w-6 h-6 rounded-full">
- <% else %>
- <div class="w-8 h-8 rounded-full bg-container-inset flex items-center justify-center text-xs font-medium text-secondary">
- <%= holding.ticker[0..1] %>
+ <div class="w-max sm:w-full">
+ <div role="columnheader" class="grid grid-cols-4 items-center uppercase text-xs font-medium text-secondary px-4 py-2">
+ <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="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? %>
+ <img src="<%= Setting.transform_brand_fetch_url(holding.security.logo_url) %>" alt="<%= holding.ticker %>" class="w-6 h-6 rounded-full">
+ <% else %>
+ <div class="w-8 h-8 rounded-full bg-container-inset flex items-center justify-center text-xs font-medium text-secondary">
+ <%= holding.ticker[0..1] %>
+ </div>
+ <% end %>
+ <div>
+ <p class="font-medium text-primary"><%= holding.ticker %></p>
+ <p class="text-xs text-secondary"><%= truncate(holding.name, length: 25) %></p>
</div>
- <% end %>
- <div>
- <p class="font-medium text-primary"><%= holding.ticker %></p>
- <p class="text-xs text-secondary"><%= truncate(holding.name, length: 25) %></p>
+ </div>
+ <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 font-medium text-primary privacy-sensitive"><%= format_money(holding.amount_money) %></div>
+ <div class="text-right">
+ <% if holding.trend %>
+ <span style="color: <%= holding.trend.color %>">
+ <%= holding.trend.percent_formatted %>
+ </span>
+ <% else %>
+ <span class="text-secondary"><%= t("reports.investment_performance.no_data") %></span>
+ <% end %>
</div>
</div>
- <div class="text-right text-secondary"><%= number_to_percentage(holding.weight || 0, precision: 1) %></div>
- <div class="text-right font-medium text-primary privacy-sensitive"><%= format_money(holding.amount_money) %></div>
- <div class="text-right">
- <% if holding.trend %>
- <span style="color: <%= holding.trend.color %>">
- <%= holding.trend.percent_formatted %>
- </span>
- <% else %>
- <span class="text-secondary"><%= t("reports.investment_performance.no_data") %></span>
- <% end %>
- </div>
- </div>
- <% if idx < investment_metrics[:top_holdings].size - 1 %>
- <%= render "shared/ruler", classes: "mx-3 lg:mx-4" %>
+ <% if idx < investment_metrics[:top_holdings].size - 1 %>
+ <%= render "shared/ruler", classes: "mx-3 lg:mx-4" %>
+ <% end %>
<% end %>
- <% end %>
+ </div>
</div>
</div>
</div>
diff --cc app/views/transactions/_header.html.erb
index a64898ddaf,48cec8e871..f91f5d0ee7
--- a/app/views/transactions/_header.html.erb
+++ b/app/views/transactions/_header.html.erb
@@@ -2,7 -2,7 +2,7 @@@
<div class="flex items-start justify-between gap-4" id="<%= dom_id(entry, :header) %>">
<div>
<h3 class="font-medium flex items-center gap-2">
-- <span class="text-2xl text-primary">
++ <span class="text-2xl text-primary privacy-sensitive">
<%= format_money -entry.amount_money %>
</span>
<span class="text-lg text-secondary">
diff --cc app/views/transactions/_transaction.html.erb
index d7993c6691,d7993c6691..c2e4293e9f
--- a/app/views/transactions/_transaction.html.erb
+++ b/app/views/transactions/_transaction.html.erb
@@@ -157,7 -157,7 +157,7 @@@
<% end %>
<%= content_tag :p,
transaction.transfer? && view_ctx == "global" ? "+/- #{format_money(entry.amount_money.abs)}" : format_money(-entry.amount_money),
-- class: ["text-green-600": entry.amount.negative?] %>
++ class: ["privacy-sensitive", "text-green-600": entry.amount.negative?] %>
</div>
</div>
<% end %>