The personal finance app for everyone (by everyone)
Ruby
feat(providers): show Brandfetch logos on Bank Sync and Accounts (#3527)
Justin McBride38be19fa7d38
diff --git a/app/components/DS/filled_icon.html.erb b/app/components/DS/filled_icon.html.erbindex 9721a26b61..fae4e39b22 100644--- a/app/components/DS/filled_icon.html.erb+++ b/app/components/DS/filled_icon.html.erb@@ -6,6 +6,6 @@<% if icon %><%= helpers.icon(icon, size: icon_size, color: "current") %><% elsif text %>- <%= tag.span text.first, class: text_classes %>+ <%= tag.span text.first(text_length), class: text_classes %><% end %><% end %>diff --git a/app/components/DS/filled_icon.rb b/app/components/DS/filled_icon.rbindex 19ed2e5fa4..82eb30d576 100644--- a/app/components/DS/filled_icon.rb+++ b/app/components/DS/filled_icon.rb@@ -1,5 +1,5 @@class DS::FilledIcon < DesignSystemComponent- attr_reader :icon, :text, :hex_color, :size, :rounded, :variant, :description, :aria_hidden+ attr_reader :icon, :text, :hex_color, :size, :rounded, :variant, :description, :aria_hidden, :text_length, :class_nameVARIANTS = %i[default text surface container inverse].freeze@@ -35,7 +35,7 @@ class DS::FilledIcon < DesignSystemComponent# "Apple" → "A"). The single letter is decorative — relying on AT# users to infer "Apple" from "A" is broken. Use `description:` to# surface the full label, or ensure the adjacent text node carries it.- def initialize(variant: :default, icon: nil, text: nil, hex_color: nil, size: "md", rounded: false, description: nil, aria_hidden: nil)+ def initialize(variant: :default, icon: nil, text: nil, hex_color: nil, size: "md", rounded: false, description: nil, aria_hidden: nil, text_length: 1, class_name: nil)@variant = variant.to_sym@icon = icon@text = text@@ -44,6 +44,8 @@ class DS::FilledIcon < DesignSystemComponent@rounded = rounded@description = description.presence@aria_hidden = aria_hidden.nil? ? @description.blank? : aria_hidden+ @text_length = text_length+ @class_name = class_nameenddef container_classes@@ -51,7 +53,8 @@ class DS::FilledIcon < DesignSystemComponent"flex justify-center items-center shrink-0",size_classes,radius_classes,- transparent? ? "border" : solid_bg_class+ transparent? ? "border" : solid_bg_class,+ class_name)enddiff --git a/app/components/provider_logo.html.erb b/app/components/provider_logo.html.erbnew file mode 100644index 0000000000..02efd980a7--- /dev/null+++ b/app/components/provider_logo.html.erb@@ -0,0 +1,15 @@+<%= tag.span class: class_names("relative block overflow-hidden shrink-0", class_name) do %>+ <%= tag.span class: "absolute inset-0", aria: { hidden: true } do %>+ <%= render DS::FilledIcon.new(+ icon: fallback_icon,+ text: fallback_text,+ text_length: 2,+ hex_color: fallback_color,+ rounded: rounded?,+ class_name: class_names("w-full h-full", rounded? ? "rounded-full" : "rounded-lg")+ ) %>+ <% end %>+ <% if (url = brand_url) %>+ <%= helpers.image_tag url, class: "absolute inset-0 w-full h-full bg-container", alt: "", loading: "lazy", onerror: ProviderLogo::REMOVE_ON_ERROR %>+ <% end %>+<% end %>diff --git a/app/components/provider_logo.rb b/app/components/provider_logo.rbnew file mode 100644index 0000000000..da2bed6352--- /dev/null+++ b/app/components/provider_logo.rb@@ -0,0 +1,43 @@+# Renders a sync provider's own logo, falling back in order:+# 1. the provider's brand icon from Brandfetch (needs a domain and a client ID)+# 2. the provider's generic icon (`logo_icon`), for providers with no brand+# 3. the provider's initials (`logo_text`)+#+# The fallback is always rendered and the Brandfetch image is laid over it on an+# opaque background. Brandfetch is asked for a 404 rather than its lettermark+# when it doesn't know the brand, and a failed image removes itself to reveal+# the fallback.+class ProviderLogo < ApplicationComponent+ REMOVE_ON_ERROR = "this.remove()".freeze++ def initialize(provider_key:, class_name: "w-8 h-8 rounded-full")+ @provider_key = provider_key+ @class_name = class_name+ end++ attr_reader :class_name++ def brand_url+ Provider::Metadata.logo_url(@provider_key)+ end++ def metadata+ @metadata ||= Provider::Metadata.for(@provider_key)+ end++ def fallback_icon+ metadata[:logo_icon]+ end++ def fallback_text+ metadata[:logo_text]+ end++ def fallback_color+ metadata[:logo_color]+ end++ def rounded?+ class_name.to_s.include?("rounded-full")+ end+enddiff --git a/app/components/settings/provider_card.html.erb b/app/components/settings/provider_card.html.erbindex 6d0210a175..f1f40355ee 100644--- a/app/components/settings/provider_card.html.erb+++ b/app/components/settings/provider_card.html.erb@@ -2,9 +2,7 @@class: "bg-container shadow-border-xs hover:bg-surface-inset rounded-xl p-4 flex flex-col gap-2.5 text-primary transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-alpha-black-300",data: { turbo_frame: "drawer", turbo_prefetch: "false" }.merge(filter_data) do %><div class="flex items-start gap-2.5">- <div class="w-9 h-9 rounded-lg flex items-center justify-center shrink-0 <%= logo_bg %>">- <span class="text-xs font-bold text-inverse"><%= logo_text %></span>- </div>+ <%= render ProviderLogo.new(provider_key: provider_key, class_name: "w-9 h-9 rounded-lg") %><div class="flex-1 min-w-0"><div class="flex items-center gap-2 flex-wrap"><span class="text-sm font-medium text-primary"><%= name %></span>diff --git a/app/components/settings/provider_card.rb b/app/components/settings/provider_card.rbindex a7773d0e99..4a739bfb78 100644--- a/app/components/settings/provider_card.rb+++ b/app/components/settings/provider_card.rb@@ -9,8 +9,7 @@ class Settings::ProviderCard < ApplicationComponentI18n.t(key) if keyend- def initialize(provider_key:, name:, tagline: nil, region: nil, kinds: nil, tier: nil,- maturity: :stable, logo_bg: "bg-gray-500", logo_text: nil)+ def initialize(provider_key:, name:, tagline: nil, region: nil, kinds: nil, tier: nil, maturity: :stable)@provider_key = provider_key@name = name@tagline = tagline@@ -18,11 +17,9 @@ class Settings::ProviderCard < ApplicationComponent@kinds = Array(kinds).compact@tier = tier@maturity = maturity.to_sym- @logo_bg = logo_bg- @logo_text = logo_text || name.first(2).upcaseend- attr_reader :name, :tagline, :logo_bg, :logo_text+ attr_reader :provider_key, :name, :taglinedef maturity_labelself.class.maturity_label(@maturity)diff --git a/app/models/provider/metadata.rb b/app/models/provider/metadata.rbindex e7042bd234..45de6147c5 100644--- a/app/models/provider/metadata.rb+++ b/app/models/provider/metadata.rb@@ -1,34 +1,42 @@class Providermodule MetadataREGISTRY = {- akahu: { region: "NZ", kinds: %w[Bank Investment], maturity: :beta, logo_text: "AK", logo_bg: "bg-emerald-600" },- simplefin: { region: "US", kinds: %w[Bank Investment], maturity: :stable, logo_text: "SF", logo_bg: "bg-blue-600" },- lunchflow: { region: "Global", kinds: %w[Bank], maturity: :stable, logo_text: "LF", logo_bg: "bg-orange-500" },- up: { region: "AU", kinds: %w[Bank], maturity: :beta, logo_text: "UP", logo_bg: "bg-orange-600" },- monobank: { region: "UA", kinds: %w[Bank], maturity: :alpha, logo_text: "MB", logo_bg: "bg-inverse" },- enable_banking: { region: "EU", kinds: %w[Bank], maturity: :beta, logo_text: "EB", logo_bg: "bg-purple-600" },- coinstats: { region: "Global", kinds: %w[Crypto], maturity: :beta, logo_text: "CS", logo_bg: "bg-pink-600" },- wise: { region: "Global", kinds: %w[Bank], maturity: :beta, logo_text: "WI", logo_bg: "bg-green-500" },- mercury: { region: "US", kinds: %w[Bank], maturity: :beta, logo_text: "ME", logo_bg: "bg-cyan-600" },- brex: { region: "US", kinds: %w[Bank], maturity: :beta, logo_text: "BX", logo_bg: "bg-emerald-600" },- coinbase: { region: "Global", kinds: %w[Crypto], maturity: :beta, logo_text: "CB", logo_bg: "bg-blue-500" },- binance: { region: "Global", kinds: %w[Crypto], maturity: :beta, logo_text: "BI", logo_bg: "bg-yellow-600" },- kraken: { region: "Global", kinds: %w[Crypto], maturity: :beta, logo_text: "KR", logo_bg: "bg-violet-600" },- snaptrade: { region: "US / CA", kinds: %w[Investment], maturity: :beta, logo_text: "ST", logo_bg: "bg-green-600" },- ibkr: { region: "Global", kinds: %w[Investment], maturity: :beta, logo_text: "IB", logo_bg: "bg-red-600" },- indexa_capital: { region: "ES", kinds: %w[Investment], maturity: :alpha, logo_text: "IC", logo_bg: "bg-red-600" },- sophtron: { region: "US", kinds: %w[Bank Investment], maturity: :alpha, logo_text: "SO", logo_bg: "bg-teal-600" },- trading212: { region: "EU", kinds: %w[Investment], maturity: :alpha, logo_text: "T2", logo_bg: "bg-teal-600" },- trade_republic: { region: "EU", kinds: %w[Bank Investment], maturity: :beta, logo_text: "TR", logo_bg: "bg-primary" },- plaid: { region: "US", kinds: %w[Bank], maturity: :stable, logo_text: "PL", logo_bg: "bg-indigo-600", tier: "Paid" },- plaid_eu: { region: "EU", kinds: %w[Bank], maturity: :stable, logo_text: "PL", logo_bg: "bg-indigo-600", tier: "Paid", name: "Plaid EU" },- questrade: { region: "CA", kinds: %w[Investment], maturity: :beta, logo_text: "QT", logo_bg: "bg-teal-600" },- redbark: { region: "AU", kinds: %w[Bank], maturity: :beta, logo_text: "RB", logo_bg: "bg-red-700" },- onchain_wallet: { region: "Global", kinds: %w[Crypto], maturity: :alpha, logo_text: "OC", logo_bg: "bg-amber-600", name: "On-chain wallets" }+ akahu: { region: "NZ", kinds: %w[Bank Investment], maturity: :beta, logo_text: "AK", logo_color: "#059669", domain: "akahu.nz" },+ simplefin: { region: "US", kinds: %w[Bank Investment], maturity: :stable, logo_text: "SF", logo_color: "#2563eb", domain: "simplefin.org" },+ lunchflow: { region: "Global", kinds: %w[Bank], maturity: :stable, logo_text: "LF", logo_color: "#f97316", domain: "lunchflow.app" },+ up: { region: "AU", kinds: %w[Bank], maturity: :beta, logo_text: "UP", logo_color: "#ea580c", domain: "up.com.au" },+ monobank: { region: "UA", kinds: %w[Bank], maturity: :alpha, logo_text: "MB", logo_color: "#111827", domain: "monobank.ua" },+ enable_banking: { region: "EU", kinds: %w[Bank], maturity: :beta, logo_text: "EB", logo_color: "#9333ea", domain: "enablebanking.com" },+ coinstats: { region: "Global", kinds: %w[Crypto], maturity: :beta, logo_text: "CS", logo_color: "#db2777", domain: "coinstats.app" },+ wise: { region: "Global", kinds: %w[Bank], maturity: :beta, logo_text: "WI", logo_color: "#22c55e", domain: "wise.com" },+ mercury: { region: "US", kinds: %w[Bank], maturity: :beta, logo_text: "ME", logo_color: "#0891b2", domain: "mercury.com" },+ brex: { region: "US", kinds: %w[Bank], maturity: :beta, logo_text: "BX", logo_color: "#059669", domain: "brex.com" },+ coinbase: { region: "Global", kinds: %w[Crypto], maturity: :beta, logo_text: "CB", logo_color: "#3b82f6", domain: "coinbase.com" },+ binance: { region: "Global", kinds: %w[Crypto], maturity: :beta, logo_text: "BI", logo_color: "#ca8a04", domain: "binance.com" },+ kraken: { region: "Global", kinds: %w[Crypto], maturity: :beta, logo_text: "KR", logo_color: "#7c3aed", domain: "kraken.com" },+ snaptrade: { region: "US / CA", kinds: %w[Investment], maturity: :beta, logo_text: "ST", logo_color: "#16a34a", domain: "snaptrade.com" },+ ibkr: { region: "Global", kinds: %w[Investment], maturity: :beta, logo_text: "IB", logo_color: "#dc2626", domain: "interactivebrokers.com" },+ indexa_capital: { region: "ES", kinds: %w[Investment], maturity: :alpha, logo_text: "IC", logo_color: "#dc2626", domain: "indexacapital.com" },+ sophtron: { region: "US", kinds: %w[Bank Investment], maturity: :alpha, logo_text: "SO", logo_color: "#0d9488", domain: "sophtron.com" },+ trading212: { region: "EU", kinds: %w[Investment], maturity: :alpha, logo_text: "T2", logo_color: "#0d9488", domain: "trading212.com" },+ trade_republic: { region: "EU", kinds: %w[Bank Investment], maturity: :beta, logo_text: "TR", logo_color: nil, domain: "traderepublic.com" },+ plaid: { region: "US", kinds: %w[Bank], maturity: :stable, logo_text: "PL", logo_color: "#4f46e5", domain: "plaid.com", tier: "Paid" },+ plaid_eu: { region: "EU", kinds: %w[Bank], maturity: :stable, logo_text: "PL", logo_color: "#4f46e5", domain: "plaid.com", tier: "Paid", name: "Plaid EU" },+ questrade: { region: "CA", kinds: %w[Investment], maturity: :beta, logo_text: "QT", logo_color: "#0d9488", domain: "questrade.com" },+ redbark: { region: "AU", kinds: %w[Bank], maturity: :beta, logo_text: "RB", logo_color: "#b91c1c", domain: "redbark.com" },+ onchain_wallet: { region: "Global", kinds: %w[Crypto], maturity: :alpha, logo_text: "OC", logo_color: "#d97706", domain: nil, logo_icon: "wallet", name: "On-chain wallets" }}.freezedef self.for(provider_key)- REGISTRY[provider_key.to_sym] || { logo_text: provider_key.to_s.first(2).upcase, logo_bg: "bg-gray-500" }+ REGISTRY[provider_key.to_sym] || { logo_text: provider_key.to_s.first(2).upcase, logo_color: nil }+ end++ # Brandfetch icon URL for the provider's own brand, or nil when the provider+ # has no domain or Brandfetch isn't configured. Unknown brands 404 instead of+ # returning Brandfetch's lettermark, so ProviderLogo keeps its own fallback.+ def self.logo_url(provider_key)+ domain = self.for(provider_key)[:domain]+ Setting.brand_fetch_icon_url(domain, fallback: "404")endendenddiff --git a/app/models/security.rb b/app/models/security.rbindex 053997b44e..6f567f4ab9 100644--- a/app/models/security.rb+++ b/app/models/security.rb@@ -31,9 +31,8 @@ class Security < ApplicationRecorddef self.brandfetch_crypto_url(base_asset)return nil if base_asset.blank?return nil unless base_asset.to_s.match?(SAFE_CRYPTO_SYMBOL)- return nil unless Setting.brand_fetch_client_id.present?- size = Setting.brand_fetch_logo_size- "https://cdn.brandfetch.io/crypto/#{base_asset}/icon/fallback/lettermark/w/#{size}/h/#{size}?c=#{Setting.brand_fetch_client_id}"++ Setting.brand_fetch_icon_url(base_asset, namespace: "crypto")endbefore_validation :upcase_symbols@@ -142,17 +141,10 @@ class Security < ApplicationRecordenddef brandfetch_icon_url(width: nil, height: nil)- return nil unless Setting.brand_fetch_client_id.present?-- w = width || Setting.brand_fetch_logo_size- h = height || Setting.brand_fetch_logo_size-identifier = extract_domain(website_url) if website_url.present?identifier ||= ticker- return nil unless identifier.present?-- "https://cdn.brandfetch.io/#{identifier}/icon/fallback/lettermark/w/#{w}/h/#{h}?c=#{Setting.brand_fetch_client_id}"+ Setting.brand_fetch_icon_url(identifier, width: width, height: height)endprivatediff --git a/app/models/setting.rb b/app/models/setting.rbindex 7e6217ed0b..4ecc98e212 100644--- a/app/models/setting.rb+++ b/app/models/setting.rb@@ -56,6 +56,16 @@ class Setting < RailsSettings::Baseurl.gsub(BRAND_FETCH_URL_PATTERN, "\\1w/#{size}/h/#{size}\\2")end+ def self.brand_fetch_icon_url(identifier, fallback: "lettermark", namespace: nil, width: nil, height: nil)+ return nil if identifier.blank? || brand_fetch_client_id.blank?++ w = width || brand_fetch_logo_size+ h = height || brand_fetch_logo_size+ path = [ namespace, identifier ].compact_blank.join("/")++ "https://cdn.brandfetch.io/#{path}/icon/fallback/#{fallback}/w/#{w}/h/#{h}?c=#{brand_fetch_client_id}"+ end+# Provider selectionfield :exchange_rate_provider, type: :string, default: ENV.fetch("EXCHANGE_RATE_PROVIDER", "twelve_data")field :securities_provider, type: :string, default: ENV.fetch("SECURITIES_PROVIDER", "twelve_data")diff --git a/app/views/akahu_items/_akahu_item.html.erb b/app/views/akahu_items/_akahu_item.html.erbindex 7f2c36d402..1e8838b06b 100644--- a/app/views/akahu_items/_akahu_item.html.erb+++ b/app/views/akahu_items/_akahu_item.html.erb@@ -7,9 +7,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 bg-surface rounded-full">- <p class="text-primary text-xs font-medium"><%= akahu_item.name.to_s.first.to_s.upcase %></p>- </div>+ <%= render ProviderLogo.new(provider_key: :akahu) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/binance_items/_binance_item.html.erb b/app/views/binance_items/_binance_item.html.erbindex 0fd356f3d0..9c3894b922 100644--- a/app/views/binance_items/_binance_item.html.erb+++ b/app/views/binance_items/_binance_item.html.erb@@ -6,11 +6,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 rounded-full" style="background-color: rgba(240, 185, 11, 0.15);">- <div class="flex items-center justify-center">- <%= icon "coins", size: "sm", class: "text-[#F0B90B]" %>- </div>- </div>+ <%= render ProviderLogo.new(provider_key: :binance) %><div class="pl-1 text-sm flex-1"><div class="flex items-center gap-2">diff --git a/app/views/brex_items/_brex_item.html.erb b/app/views/brex_items/_brex_item.html.erbindex 293813b107..5fcaf6271f 100644--- a/app/views/brex_items/_brex_item.html.erb+++ b/app/views/brex_items/_brex_item.html.erb@@ -18,15 +18,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 bg-container-inset rounded-full">- <% if brex_item.logo.attached? %>- <%= image_tag brex_item.logo, class: "rounded-full h-full w-full", loading: "lazy" %>- <% else %>- <div class="flex items-center justify-center">- <%= tag.p brex_item.name.first.upcase, class: "text-primary text-xs font-medium" %>- </div>- <% end %>- </div>+ <%= render ProviderLogo.new(provider_key: :brex) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/coinbase_items/_coinbase_item.html.erb b/app/views/coinbase_items/_coinbase_item.html.erbindex 5d1262888b..e488248f6b 100644--- a/app/views/coinbase_items/_coinbase_item.html.erb+++ b/app/views/coinbase_items/_coinbase_item.html.erb@@ -22,11 +22,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 rounded-full" style="background-color: rgba(0, 82, 255, 0.1);">- <div class="flex items-center justify-center">- <%= icon "bitcoin", size: "sm", class: "text-[#0052FF]" %>- </div>- </div>+ <%= render ProviderLogo.new(provider_key: :coinbase) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/coinstats_items/_coinstats_item.html.erb b/app/views/coinstats_items/_coinstats_item.html.erbindex aae9b65ef0..c6dfd8873f 100644--- a/app/views/coinstats_items/_coinstats_item.html.erb+++ b/app/views/coinstats_items/_coinstats_item.html.erb@@ -7,11 +7,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 bg-success/10 rounded-full">- <div class="flex items-center justify-center">- <%= tag.p coinstats_item.institution_display_name.first.upcase, class: "text-success text-xs font-medium" %>- </div>- </div>+ <%= render ProviderLogo.new(provider_key: :coinstats) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/enable_banking_items/_enable_banking_item.html.erb b/app/views/enable_banking_items/_enable_banking_item.html.erbindex 2e3af279ba..5e5f648304 100644--- a/app/views/enable_banking_items/_enable_banking_item.html.erb+++ b/app/views/enable_banking_items/_enable_banking_item.html.erb@@ -7,15 +7,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 bg-success/10 rounded-full">- <% if enable_banking_item.logo.attached? %>- <%= image_tag enable_banking_item.logo, class: "rounded-full h-full w-full", loading: "lazy" %>- <% else %>- <div class="flex items-center justify-center">- <%= tag.p enable_banking_item.institution_display_name.first.upcase, class: "text-success text-xs font-medium" %>- </div>- <% end %>- </div>+ <%= render ProviderLogo.new(provider_key: :enable_banking) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/ibkr_items/_ibkr_item.html.erb b/app/views/ibkr_items/_ibkr_item.html.erbindex f65e9b4110..13dd98b89f 100644--- a/app/views/ibkr_items/_ibkr_item.html.erb+++ b/app/views/ibkr_items/_ibkr_item.html.erb@@ -9,9 +9,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 rounded-full bg-[#D32F2F]/10">- <span class="text-[#D32F2F] text-xs font-medium">IB</span>- </div>+ <%= render ProviderLogo.new(provider_key: :ibkr) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/indexa_capital_items/_indexa_capital_item.html.erb b/app/views/indexa_capital_items/_indexa_capital_item.html.erbindex d03c2ffb1a..b2f0d05c52 100644--- a/app/views/indexa_capital_items/_indexa_capital_item.html.erb+++ b/app/views/indexa_capital_items/_indexa_capital_item.html.erb@@ -9,11 +9,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 bg-container-inset rounded-full">- <div class="flex items-center justify-center">- <%= tag.p indexa_capital_item.name.first.upcase, class: "text-primary text-xs font-medium" %>- </div>- </div>+ <%= render ProviderLogo.new(provider_key: :indexa_capital) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/kraken_items/_kraken_item.html.erb b/app/views/kraken_items/_kraken_item.html.erbindex 784ee1715f..70045af049 100644--- a/app/views/kraken_items/_kraken_item.html.erb+++ b/app/views/kraken_items/_kraken_item.html.erb@@ -6,9 +6,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 rounded-full bg-surface-inset">- <%= icon "waves", size: "sm", class: "text-primary" %>- </div>+ <%= render ProviderLogo.new(provider_key: :kraken) %><div class="pl-1 text-sm flex-1"><div class="flex items-center gap-2">diff --git a/app/views/lunchflow_items/_lunchflow_item.html.erb b/app/views/lunchflow_items/_lunchflow_item.html.erbindex a4db679b2a..3c550d9354 100644--- a/app/views/lunchflow_items/_lunchflow_item.html.erb+++ b/app/views/lunchflow_items/_lunchflow_item.html.erb@@ -7,15 +7,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 bg-orange-600/10 rounded-full">- <% if lunchflow_item.logo.attached? %>- <%= image_tag lunchflow_item.logo, class: "rounded-full h-full w-full", loading: "lazy" %>- <% else %>- <div class="flex items-center justify-center">- <%= tag.p lunchflow_item.name.first.upcase, class: "text-orange-600 text-xs font-medium" %>- </div>- <% end %>- </div>+ <%= render ProviderLogo.new(provider_key: :lunchflow) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/mercury_items/_mercury_item.html.erb b/app/views/mercury_items/_mercury_item.html.erbindex 9fb8f79230..851091c421 100644--- a/app/views/mercury_items/_mercury_item.html.erb+++ b/app/views/mercury_items/_mercury_item.html.erb@@ -7,15 +7,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 bg-blue-600/10 rounded-full">- <% if mercury_item.logo.attached? %>- <%= image_tag mercury_item.logo, class: "rounded-full h-full w-full", loading: "lazy" %>- <% else %>- <div class="flex items-center justify-center">- <%= tag.p mercury_item.name.first.upcase, class: "text-blue-600 text-xs font-medium" %>- </div>- <% end %>- </div>+ <%= render ProviderLogo.new(provider_key: :mercury) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/monobank_items/_monobank_item.html.erb b/app/views/monobank_items/_monobank_item.html.erbindex 85ba32c1e1..50ef26ec89 100644--- a/app/views/monobank_items/_monobank_item.html.erb+++ b/app/views/monobank_items/_monobank_item.html.erb@@ -7,9 +7,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 bg-surface rounded-full">- <p class="text-primary text-xs font-medium"><%= monobank_item.name.to_s.first.to_s.upcase %></p>- </div>+ <%= render ProviderLogo.new(provider_key: :monobank) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/onchain_wallet_items/_wallet_card.html.erb b/app/views/onchain_wallet_items/_wallet_card.html.erbindex 6ae5db610c..ff7e665c9c 100644--- a/app/views/onchain_wallet_items/_wallet_card.html.erb+++ b/app/views/onchain_wallet_items/_wallet_card.html.erb@@ -7,9 +7,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 rounded-full bg-surface-inset shrink-0">- <%= icon "wallet", size: "sm", class: "text-primary" %>- </div>+ <%= render ProviderLogo.new(provider_key: :onchain_wallet) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/plaid_items/_plaid_item.html.erb b/app/views/plaid_items/_plaid_item.html.erbindex 75731c95b6..9e6a7badcb 100644--- a/app/views/plaid_items/_plaid_item.html.erb+++ b/app/views/plaid_items/_plaid_item.html.erb@@ -7,15 +7,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 bg-blue-600/10 rounded-full">- <% if plaid_item.logo.attached? %>- <%= image_tag plaid_item.logo, class: "rounded-full h-full w-full", loading: "lazy" %>- <% else %>- <div class="flex items-center justify-center">- <%= tag.p plaid_item.name.first.upcase, class: "text-blue-600 text-xs font-medium" %>- </div>- <% end %>- </div>+ <%= render ProviderLogo.new(provider_key: :plaid) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">@@ -24,6 +16,7 @@<p class="text-destructive text-sm animate-pulse"><%= t(".deletion_in_progress") %></p><% end %></div>+ <p class="text-xs text-secondary"><%= t(".provider_name") %></p><% if plaid_item.syncing? %><div class="text-secondary flex items-center gap-1"><%= icon "loader", size: "sm", class: "animate-pulse" %>diff --git a/app/views/questrade_items/_questrade_item.html.erb b/app/views/questrade_items/_questrade_item.html.erbindex 50d67e2aa6..6536fecb92 100644--- a/app/views/questrade_items/_questrade_item.html.erb+++ b/app/views/questrade_items/_questrade_item.html.erb@@ -7,13 +7,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 bg-surface rounded-full">- <% if questrade_item.logo.attached? %>- <%= image_tag questrade_item.logo, class: "rounded-full h-full w-full", loading: "lazy" %>- <% else %>- <%= tag.p "Q", class: "text-primary text-xs font-medium" %>- <% end %>- </div>+ <%= render ProviderLogo.new(provider_key: :questrade) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/redbark_items/_redbark_item.html.erb b/app/views/redbark_items/_redbark_item.html.erbindex 9f30e86d57..b1e940ee5a 100644--- a/app/views/redbark_items/_redbark_item.html.erb+++ b/app/views/redbark_items/_redbark_item.html.erb@@ -7,11 +7,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 bg-primary/10 rounded-full">- <div class="flex items-center justify-center">- <%= tag.p redbark_item.name.first.upcase, class: "text-primary text-xs font-medium" %>- </div>- </div>+ <%= render ProviderLogo.new(provider_key: :redbark) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/settings/providers/_akahu_panel.html.erb b/app/views/settings/providers/_akahu_panel.html.erbindex 216a31806d..ffb90bf961 100644--- a/app/views/settings/providers/_akahu_panel.html.erb+++ b/app/views/settings/providers/_akahu_panel.html.erb@@ -20,9 +20,7 @@<% disclosure.with_summary_content do %><div class="flex items-center justify-between gap-2 w-full"><div class="flex items-center gap-3">- <div class="flex items-center justify-center h-8 w-8 bg-surface rounded-full">- <p class="text-primary text-xs font-medium"><%= item.name.to_s.first.to_s.upcase %></p>- </div>+ <%= render ProviderLogo.new(provider_key: :akahu) %><div><p class="font-medium text-primary"><%= item.name %></p><p class="text-xs text-secondary"><%= item.sync_status_summary %></p>diff --git a/app/views/settings/providers/_binance_panel.html.erb b/app/views/settings/providers/_binance_panel.html.erbindex 1b329f160c..738501b370 100644--- a/app/views/settings/providers/_binance_panel.html.erb+++ b/app/views/settings/providers/_binance_panel.html.erb@@ -39,9 +39,7 @@<% items.each do |item| %><div class="flex items-center justify-between p-3 bg-container-inset rounded-lg border border-primary"><div class="flex items-center gap-3">- <div class="w-10 h-10 rounded-full flex items-center justify-center" style="background-color: rgba(240, 185, 11, 0.15);">- <%= icon "coins", size: "md", class: "text-[#F0B90B]" %>- </div>+ <%= render ProviderLogo.new(provider_key: :binance, class_name: "w-10 h-10 rounded-full") %><div><p class="font-medium text-primary"><%= item.name %></p><p class="text-xs text-secondary">diff --git a/app/views/settings/providers/_brex_panel.html.erb b/app/views/settings/providers/_brex_panel.html.erbindex 35e2ef0691..0607a55f3d 100644--- a/app/views/settings/providers/_brex_panel.html.erb+++ b/app/views/settings/providers/_brex_panel.html.erb@@ -30,9 +30,7 @@<% disclosure.with_summary_content do %><div class="flex items-center justify-between gap-2 w-full"><div class="flex items-center gap-3">- <div class="flex items-center justify-center h-8 w-8 bg-container-inset rounded-full">- <p class="text-primary text-xs font-medium"><%= item.name.to_s.first.to_s.upcase %></p>- </div>+ <%= render ProviderLogo.new(provider_key: :brex) %><div><p class="font-medium text-primary"><%= item.name %></p><p class="text-xs text-secondary"><%= item.sync_status_summary %></p>diff --git a/app/views/settings/providers/_coinbase_panel.html.erb b/app/views/settings/providers/_coinbase_panel.html.erbindex 82cb7d473a..f9c48a642f 100644--- a/app/views/settings/providers/_coinbase_panel.html.erb+++ b/app/views/settings/providers/_coinbase_panel.html.erb@@ -18,9 +18,7 @@<% items.each do |item| %><div class="flex items-center justify-between p-3 bg-container-inset rounded-lg border border-primary"><div class="flex items-center gap-3">- <div class="w-10 h-10 rounded-full bg-[#0052FF] flex items-center justify-center">- <%= icon "bitcoin", size: "md", class: "text-white" %>- </div>+ <%= render ProviderLogo.new(provider_key: :coinbase, class_name: "w-10 h-10 rounded-full") %><div><p class="font-medium text-primary"><%= item.name %></p><p class="text-xs text-secondary">diff --git a/app/views/settings/providers/_connection_row.html.erb b/app/views/settings/providers/_connection_row.html.erbindex d0542225fa..dfe88ea0da 100644--- a/app/views/settings/providers/_connection_row.html.erb+++ b/app/views/settings/providers/_connection_row.html.erb@@ -22,6 +22,7 @@<%= icon "chevron-right", size: "sm", class: "!w-3.5 !h-3.5 text-secondary group-open:rotate-90 transition-transform" %><div class="flex items-center flex-wrap gap-2 min-w-0 flex-1"><div class="flex items-center gap-2 shrink-0 flex-1">+ <%= render ProviderLogo.new(provider_key: entry[:provider_key], class_name: "w-7 h-7 rounded-lg") %><h3 class="text-sm font-medium text-primary"><%= entry[:title] %></h3><%= render "settings/providers/maturity_badge", label: maturity_lbl %></div>diff --git a/app/views/settings/providers/_drawer_header.html.erb b/app/views/settings/providers/_drawer_header.html.erbindex 20c3eb611e..3ccb473ba5 100644--- a/app/views/settings/providers/_drawer_header.html.erb+++ b/app/views/settings/providers/_drawer_header.html.erb@@ -3,10 +3,8 @@<% maturity_label = meta ? Settings::ProviderCard.maturity_label(meta[:maturity]) : nil %><div class="flex items-center justify-between gap-2"><div class="flex items-center gap-2 min-w-0">- <% if meta && meta[:logo_bg].present? %>- <span class="w-7 h-7 rounded-lg flex items-center justify-center shrink-0 <%= meta[:logo_bg] %>">- <span class="text-xs font-bold text-inverse"><%= meta[:logo_text] %></span>- </span>+ <% if meta %>+ <%= render ProviderLogo.new(provider_key: provider_key, class_name: "w-7 h-7 rounded-lg") %><% end %><h2 class="text-lg font-medium text-primary truncate"><%= title %></h2><%= render "settings/providers/maturity_badge", label: maturity_label %>diff --git a/app/views/settings/providers/_kraken_panel.html.erb b/app/views/settings/providers/_kraken_panel.html.erbindex 39719602ca..e658926416 100644--- a/app/views/settings/providers/_kraken_panel.html.erb+++ b/app/views/settings/providers/_kraken_panel.html.erb@@ -28,9 +28,7 @@<% disclosure.with_summary_content do %><div class="flex items-center justify-between gap-3 w-full"><div class="flex items-center gap-3 min-w-0">- <div class="flex items-center justify-center h-8 w-8 rounded-full bg-surface-inset">- <%= icon "waves", size: "sm", class: "text-primary" %>- </div>+ <%= render ProviderLogo.new(provider_key: :kraken) %><div class="min-w-0"><p class="font-medium text-primary truncate"><%= item.name %></p><p class="text-xs text-secondary">diff --git a/app/views/settings/providers/_mercury_panel.html.erb b/app/views/settings/providers/_mercury_panel.html.erbindex 3d90fa76db..af5c855d84 100644--- a/app/views/settings/providers/_mercury_panel.html.erb+++ b/app/views/settings/providers/_mercury_panel.html.erb@@ -23,9 +23,7 @@<% disclosure.with_summary_content do %><div class="flex items-center justify-between gap-2 w-full"><div class="flex items-center gap-3">- <div class="flex items-center justify-center h-8 w-8 bg-surface rounded-full">- <p class="text-primary text-xs font-medium"><%= item.name.to_s.first.to_s.upcase %></p>- </div>+ <%= render ProviderLogo.new(provider_key: :mercury) %><div><p class="font-medium text-primary"><%= item.name %></p><p class="text-xs text-secondary"><%= item.sync_status_summary %></p>diff --git a/app/views/settings/providers/_monobank_panel.html.erb b/app/views/settings/providers/_monobank_panel.html.erbindex 768cfaa782..54795d0ebe 100644--- a/app/views/settings/providers/_monobank_panel.html.erb+++ b/app/views/settings/providers/_monobank_panel.html.erb@@ -22,9 +22,7 @@<% disclosure.with_summary_content do %><div class="flex items-center justify-between gap-2 w-full"><div class="flex items-center gap-3">- <div class="flex items-center justify-center h-8 w-8 bg-surface rounded-full">- <p class="text-primary text-xs font-medium"><%= item.name.to_s.first.to_s.upcase %></p>- </div>+ <%= render ProviderLogo.new(provider_key: :monobank) %><div><p class="font-medium text-primary"><%= item.name %></p><p class="text-xs text-secondary"><%= item.sync_status_summary %></p>diff --git a/app/views/settings/providers/_up_panel.html.erb b/app/views/settings/providers/_up_panel.html.erbindex e11604811d..da37258135 100644--- a/app/views/settings/providers/_up_panel.html.erb+++ b/app/views/settings/providers/_up_panel.html.erb@@ -20,9 +20,7 @@<% disclosure.with_summary_content do %><div class="flex items-center justify-between gap-2 w-full"><div class="flex items-center gap-3">- <div class="flex items-center justify-center h-8 w-8 bg-surface rounded-full">- <p class="text-primary text-xs font-medium"><%= item.name.to_s.first.to_s.upcase %></p>- </div>+ <%= render ProviderLogo.new(provider_key: :up) %><div><p class="font-medium text-primary"><%= item.name %></p><p class="text-xs text-secondary"><%= item.sync_status_summary %></p>diff --git a/app/views/settings/providers/_wise_panel.html.erb b/app/views/settings/providers/_wise_panel.html.erbindex c76f1ab47e..148b803f28 100644--- a/app/views/settings/providers/_wise_panel.html.erb+++ b/app/views/settings/providers/_wise_panel.html.erb@@ -25,9 +25,7 @@<% disclosure.with_summary_content do %><div class="flex items-center justify-between gap-2 w-full"><div class="flex items-center gap-3">- <div class="flex items-center justify-center h-8 w-8 bg-container-inset rounded-full">- <p class="text-primary text-xs font-medium">WI</p>- </div>+ <%= render ProviderLogo.new(provider_key: :wise) %><div><p class="font-medium text-primary"><%= item.name %></p><p class="text-xs text-secondary"><%= item.sync_status_summary %></p>diff --git a/app/views/settings/providers/show.html.erb b/app/views/settings/providers/show.html.erbindex df6ca436d6..df97f2fe38 100644--- a/app/views/settings/providers/show.html.erb+++ b/app/views/settings/providers/show.html.erb@@ -80,9 +80,7 @@region: meta[:region],kinds: meta[:kinds],tier: meta[:tier],- maturity: meta[:maturity] || :stable,- logo_bg: meta[:logo_bg],- logo_text: meta[:logo_text]+ maturity: meta[:maturity] || :stable) %><% end %></div>diff --git a/app/views/simplefin_items/_simplefin_item.html.erb b/app/views/simplefin_items/_simplefin_item.html.erbindex 93dc2dcfe4..5ddcdf040f 100644--- a/app/views/simplefin_items/_simplefin_item.html.erb+++ b/app/views/simplefin_items/_simplefin_item.html.erb@@ -24,15 +24,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 bg-success/10 rounded-full">- <% if simplefin_item.logo.attached? %>- <%= image_tag simplefin_item.logo, class: "rounded-full h-full w-full", loading: "lazy" %>- <% else %>- <div class="flex items-center justify-center">- <%= tag.p simplefin_item.name.first.upcase, class: "text-success text-xs font-medium" %>- </div>- <% end %>- </div>+ <%= render ProviderLogo.new(provider_key: :simplefin) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/snaptrade_items/_snaptrade_item.html.erb b/app/views/snaptrade_items/_snaptrade_item.html.erbindex 441ec8e36b..56d722a68e 100644--- a/app/views/snaptrade_items/_snaptrade_item.html.erb+++ b/app/views/snaptrade_items/_snaptrade_item.html.erb@@ -13,15 +13,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 bg-success/10 rounded-full">- <% if snaptrade_item.logo.attached? %>- <%= image_tag snaptrade_item.logo, class: "rounded-full h-full w-full", loading: "lazy" %>- <% else %>- <div class="flex items-center justify-center">- <%= tag.p snaptrade_item.name.first.upcase, class: "text-success text-xs font-medium" %>- </div>- <% end %>- </div>+ <%= render ProviderLogo.new(provider_key: :snaptrade) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/sophtron_items/_sophtron_item.html.erb b/app/views/sophtron_items/_sophtron_item.html.erbindex a000d23b81..faa4d14513 100644--- a/app/views/sophtron_items/_sophtron_item.html.erb+++ b/app/views/sophtron_items/_sophtron_item.html.erb@@ -10,15 +10,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 bg-orange-600/10 rounded-full">- <% if sophtron_item.logo.attached? %>- <%= image_tag sophtron_item.logo, class: "rounded-full h-full w-full", loading: "lazy" %>- <% else %>- <div class="flex items-center justify-center">- <%= tag.p provider_display_name.first.upcase, class: "text-orange-600 text-xs font-medium" %>- </div>- <% end %>- </div>+ <%= render ProviderLogo.new(provider_key: :sophtron) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/trade_republic_items/_trade_republic_item.html.erb b/app/views/trade_republic_items/_trade_republic_item.html.erbindex 0569891bb2..e188d962b3 100644--- a/app/views/trade_republic_items/_trade_republic_item.html.erb+++ b/app/views/trade_republic_items/_trade_republic_item.html.erb@@ -9,9 +9,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 rounded-full bg-surface-inset">- <span class="text-primary text-xs font-medium">TR</span>- </div>+ <%= render ProviderLogo.new(provider_key: :trade_republic) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/trading212_items/_trading212_item.html.erb b/app/views/trading212_items/_trading212_item.html.erbindex 62f26dde76..2fb8365283 100644--- a/app/views/trading212_items/_trading212_item.html.erb+++ b/app/views/trading212_items/_trading212_item.html.erb@@ -9,9 +9,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 rounded-full bg-teal-600/10">- <span class="text-teal-600 text-xs font-medium">T2</span>- </div>+ <%= render ProviderLogo.new(provider_key: :trading212) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/up_items/_up_item.html.erb b/app/views/up_items/_up_item.html.erbindex ddd637c9fe..e2365d60f2 100644--- a/app/views/up_items/_up_item.html.erb+++ b/app/views/up_items/_up_item.html.erb@@ -7,9 +7,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 bg-surface rounded-full">- <p class="text-primary text-xs font-medium"><%= up_item.name.to_s.first.to_s.upcase %></p>- </div>+ <%= render ProviderLogo.new(provider_key: :up) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/app/views/wise_items/_wise_item.html.erb b/app/views/wise_items/_wise_item.html.erbindex be8b4be244..544307a15c 100644--- a/app/views/wise_items/_wise_item.html.erb+++ b/app/views/wise_items/_wise_item.html.erb@@ -7,9 +7,7 @@<div class="flex items-center gap-2"><%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>- <div class="flex items-center justify-center h-8 w-8 bg-container-inset rounded-full">- <p class="text-primary text-xs font-bold">WI</p>- </div>+ <%= render ProviderLogo.new(provider_key: :wise) %><div class="pl-1 text-sm"><div class="flex items-center gap-2">diff --git a/config/locales/views/plaid_items/en.yml b/config/locales/views/plaid_items/en.ymlindex d0d07ad148..f7801213f3 100644--- a/config/locales/views/plaid_items/en.yml+++ b/config/locales/views/plaid_items/en.yml@@ -25,6 +25,7 @@ en:no_accounts_description: We could not load any accounts from this financialinstitution.no_accounts_title: No accounts found+ provider_name: Plaidrequires_update: Reconnectstatus: Last synced %{timestamp} agostatus_never: Requires data syncdiff --git a/test/components/DS/filled_icon_test.rb b/test/components/DS/filled_icon_test.rbnew file mode 100644index 0000000000..44cbc2d23c--- /dev/null+++ b/test/components/DS/filled_icon_test.rb@@ -0,0 +1,22 @@+require "test_helper"++class DS::FilledIconTest < ViewComponent::TestCase+ test "text fallback renders one letter by default" do+ render_inline(DS::FilledIcon.new(text: "Example"))++ assert_text "E"+ assert_no_text "Ex"+ end++ test "text fallback can render multiple initials when requested" do+ render_inline(DS::FilledIcon.new(text: "EX", text_length: 2))++ assert_text "EX"+ end++ test "accepts extra container classes" do+ render_inline(DS::FilledIcon.new(text: "EX", text_length: 2, class_name: "w-full h-full"))++ assert_selector ".w-full.h-full", text: "EX"+ end+enddiff --git a/test/components/provider_logo_test.rb b/test/components/provider_logo_test.rbnew file mode 100644index 0000000000..a4d2f49b0b--- /dev/null+++ b/test/components/provider_logo_test.rb@@ -0,0 +1,69 @@+require "test_helper"++class ProviderLogoTest < ViewComponent::TestCase+ setup do+ Setting.stubs(:brand_fetch_client_id).returns("test-client-id")+ Setting.stubs(:brand_fetch_logo_size).returns(40)+ end++ test "lays the brand icon over the fallback when the provider has a domain" do+ stub_metadata(domain: "example.com", logo_icon: "wallet", logo_text: "EX", logo_color: "#6b7280")++ render_inline(ProviderLogo.new(provider_key: :example))++ assert_selector "img[src='https://cdn.brandfetch.io/example.com/icon/fallback/404/w/40/h/40?c=test-client-id']"+ assert_selector "img[onerror='#{ProviderLogo::REMOVE_ON_ERROR}']"+ assert_selector "span[aria-hidden='true'] + img"+ end++ test "renders only the fallback when the provider has no domain" do+ stub_metadata(logo_icon: "wallet", logo_text: "EX", logo_color: "#6b7280")++ render_inline(ProviderLogo.new(provider_key: :example))++ assert_no_selector "img"+ assert_selector "[aria-hidden='true'] svg"+ end++ test "renders only the fallback when Brandfetch is not configured" do+ Setting.stubs(:brand_fetch_client_id).returns(nil)+ stub_metadata(domain: "example.com", logo_icon: "wallet", logo_text: "EX", logo_color: "#6b7280")++ render_inline(ProviderLogo.new(provider_key: :example))++ assert_no_selector "img"+ assert_selector "[aria-hidden='true'] svg"+ end++ test "prefers the icon over the initials in the fallback" do+ stub_metadata(logo_icon: "wallet", logo_text: "EX", logo_color: "#6b7280")++ render_inline(ProviderLogo.new(provider_key: :example))++ assert_selector "[aria-hidden='true'] svg"+ assert_no_text "EX"+ end++ test "falls back to the initials when there is no icon" do+ stub_metadata(logo_text: "EX", logo_color: "#6b7280")++ render_inline(ProviderLogo.new(provider_key: :example))++ assert_no_selector "svg"+ assert_selector "[aria-hidden='true']", text: "EX"+ end++ test "applies the size and shape classes to the container" do+ stub_metadata(domain: "example.com", logo_text: "EX", logo_color: "#6b7280")++ render_inline(ProviderLogo.new(provider_key: :example, class_name: "w-9 h-9 rounded-lg"))++ assert_selector "span.w-9.h-9.rounded-lg > span[aria-hidden='true']"+ assert_selector "span.w-9.h-9.rounded-lg > img"+ end++ private+ def stub_metadata(**metadata)+ Provider::Metadata.stubs(:for).with(:example).returns(metadata)+ end+enddiff --git a/test/models/provider/metadata_test.rb b/test/models/provider/metadata_test.rbindex 84ca5ded90..5e12ae90fb 100644--- a/test/models/provider/metadata_test.rb+++ b/test/models/provider/metadata_test.rb@@ -17,4 +17,32 @@ class Provider::MetadataTest < ActiveSupport::TestCaserefute metadata.key?(:kind)endend++ test "registered provider metadata keeps fallback colors out of raw tailwind classes" do+ Provider::Metadata::REGISTRY.each_value do |metadata|+ refute metadata.key?(:logo_bg)+ assert_match(/\A#[0-9a-f]{6}\z/i, metadata[:logo_color]) if metadata[:logo_color].present?+ end+ end++ test "logo_url builds a Brandfetch URL from the provider domain" do+ Setting.stubs(:brand_fetch_client_id).returns("test-client-id")+ Setting.stubs(:brand_fetch_logo_size).returns(40)++ assert_equal "https://cdn.brandfetch.io/wise.com/icon/fallback/404/w/40/h/40?c=test-client-id",+ Provider::Metadata.logo_url(:wise)+ end++ test "logo_url is nil when Brandfetch is not configured" do+ Setting.stubs(:brand_fetch_client_id).returns(nil)++ assert_nil Provider::Metadata.logo_url(:wise)+ end++ test "logo_url is nil for providers without a domain" do+ Setting.stubs(:brand_fetch_client_id).returns("test-client-id")++ assert_nil Provider::Metadata.logo_url(:onchain_wallet)+ assert_nil Provider::Metadata.logo_url(:unknown_provider)+ endenddiff --git a/test/models/setting_test.rb b/test/models/setting_test.rbindex ea63d7d032..9528b97f58 100644--- a/test/models/setting_test.rb+++ b/test/models/setting_test.rb@@ -132,6 +132,34 @@ class SettingTest < ActiveSupport::TestCaseassert_equal "test-model", Setting.openai_modelend+ test "brand_fetch_icon_url builds a logo URL with the requested fallback" do+ Setting.stubs(:brand_fetch_client_id).returns("test-client-id")+ Setting.stubs(:brand_fetch_logo_size).returns(40)++ assert_equal(+ "https://cdn.brandfetch.io/example.com/icon/fallback/404/w/40/h/40?c=test-client-id",+ Setting.brand_fetch_icon_url("example.com", fallback: "404")+ )+ end++ test "brand_fetch_icon_url supports namespaced routes and explicit dimensions" do+ Setting.stubs(:brand_fetch_client_id).returns("test-client-id")+ Setting.stubs(:brand_fetch_logo_size).returns(40)++ assert_equal(+ "https://cdn.brandfetch.io/crypto/BTC/icon/fallback/lettermark/w/80/h/80?c=test-client-id",+ Setting.brand_fetch_icon_url("BTC", namespace: "crypto", width: 80, height: 80)+ )+ end++ test "brand_fetch_icon_url returns nil without an identifier or client id" do+ Setting.stubs(:brand_fetch_client_id).returns("test-client-id")+ assert_nil Setting.brand_fetch_icon_url(nil)++ Setting.stubs(:brand_fetch_client_id).returns(nil)+ assert_nil Setting.brand_fetch_icon_url("example.com")+ end+test "enabled_securities_providers falls back to twelve_data when nothing is configured" dowith_env_overrides("SECURITIES_PROVIDERS" => nil, "SECURITIES_PROVIDER" => nil) doassert_equal [ "twelve_data" ], Setting.enabled_securities_providers