The personal finance app for everyone (by everyone)
Ruby
<%# Preview-gated. Gating the whole block (rather than just the
link) also keeps the unread COUNT off every page render for
users who haven't opted in. No preview dot on the icon: the
unread badge already occupies that corner. %>
<% if Current.family && preview_features_enabled? %>
<%# Prefetch disabled: /insights marks insights read on real visits
and deliberately skips prefetch requests, so a prefetched
response served on click would never clear the badge. %>
<%= link_to insights_path,
class: "relative inline-flex items-center justify-center w-9 h-9 pointer-coarse:w-11 pointer-coarse:h-11 rounded-lg text-secondary hover:text-primary hover:bg-container-inset-hover transition-colors focus-ring",
aria: { label: t("layouts.application.insights") },
data: { turbo_prefetch: false } do %>
<%# `as: :span` + `html_class:` so the tooltip trigger fills this
already-focusable link (full hover target). DS::Tooltip
binds keyboard focus on the closest <a>/<summary> ancestor. %>
<%= render DS::Tooltip.new(
text: t("layouts.application.insights"),
icon: "lightbulb",
size: "sm",
as: :span,
html_class: "size-full items-center justify-center"
) %>
<%= render "layouts/shared/insights_badge", count: Current.family.insights.visible.active.count %>
<% end %>
<% end %>