diff --git a/app/assets/tailwind/privacy-mode.css b/app/assets/tailwind/privacy-mode.css
index 3702b1525..e57eaa246 100644
--- a/app/assets/tailwind/privacy-mode.css
+++ b/app/assets/tailwind/privacy-mode.css
@@ -2,13 +2,10 @@
html.privacy-mode .privacy-sensitive {
filter: blur(8px);
user-select: none;
+ pointer-events: none;
transition: filter 0.2s ease;
}
-html.privacy-mode .privacy-sensitive:hover {
- filter: blur(4px);
-}
-
html:not(.privacy-mode) .privacy-sensitive {
transition: filter 0.2s ease;
}
\ No newline at end of file
diff --git a/app/javascript/controllers/privacy_mode_controller.js b/app/javascript/controllers/privacy_mode_controller.js
index a2358b064..5d968e6c9 100644
--- a/app/javascript/controllers/privacy_mode_controller.js
+++ b/app/javascript/controllers/privacy_mode_controller.js
@@ -4,8 +4,10 @@ import { Controller } from "@hotwired/stimulus"
// Toggles visibility of financial numbers across the page.
// Elements with class "privacy-sensitive" will be blurred when active.
// State persists in localStorage so it survives page navigations.
+// A synchronous inline script in
pre-applies the class to prevent
+// a flash of unblurred content on first paint (see _privacy_mode_check.html.erb).
export default class extends Controller {
- static targets = ["toggle"]
+ static targets = ["toggle", "iconOn", "iconOff"]
connect() {
this.active = localStorage.getItem("privacyMode") === "true"
@@ -25,8 +27,17 @@ export default class extends Controller {
document.documentElement.classList.remove("privacy-mode")
}
+ // Update button state
this.toggleTargets.forEach((el) => {
el.setAttribute("aria-pressed", this.active.toString())
})
+
+ // Toggle icon visibility: show eye when active (click to reveal), eye-off when inactive
+ this.iconOnTargets.forEach((el) => {
+ el.classList.toggle("hidden", !this.active)
+ })
+ this.iconOffTargets.forEach((el) => {
+ el.classList.toggle("hidden", this.active)
+ })
}
}
\ No newline at end of file
diff --git a/app/views/layouts/_privacy_mode_check.html.erb b/app/views/layouts/_privacy_mode_check.html.erb
new file mode 100644
index 000000000..6e9299901
--- /dev/null
+++ b/app/views/layouts/_privacy_mode_check.html.erb
@@ -0,0 +1,5 @@
+
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index bc2c0ddf8..9d3b97e87 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -54,7 +54,19 @@ end %>
<%= image_tag "logomark-color.svg", class: "w-9 h-9 mx-auto" %>
<% end %>
- <%= render "users/user_menu", user: Current.user, placement: "bottom-end", offset: 12, intro_mode: intro_mode %>
+