Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions app/components/settings/health_summary.html.erb

This file was deleted.

38 changes: 0 additions & 38 deletions app/components/settings/health_summary.rb

This file was deleted.

18 changes: 8 additions & 10 deletions app/components/settings/provider_card.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<div class="bg-container shadow-border-xs rounded-xl p-4 flex flex-col gap-3 hover:shadow-border-sm transition-shadow">
<%= link_to connect_path,
class: "bg-container shadow-border-xs rounded-xl p-4 flex flex-col gap-3 text-primary hover:bg-container-hover transition-colors",
data: { turbo_frame: "drawer", turbo_prefetch: "false" } do %>
<div class="flex items-start gap-3">
<div class="w-9 h-9 rounded-lg flex items-center justify-center shrink-0 <%= logo_bg %>">
<span class="text-xs font-bold text-white"><%= logo_text %></span>
<span class="text-xs font-bold text-inverse"><%= logo_text %></span>
</div>
<div class="flex-1 min-w-0">
<div class="flex items-center gap-2 flex-wrap">
Expand All @@ -18,12 +20,8 @@
<% if tagline.present? %>
<p class="text-sm text-secondary grow"><%= tagline %></p>
<% end %>
<div class="flex justify-end">
<%= link_to connect_path,
class: "inline-flex items-center gap-1.5 text-sm font-medium text-primary hover:text-primary/70 transition-colors",
data: { turbo_frame: "drawer", turbo_prefetch: "false" } do %>
<%= t("settings.providers.connect") %>
<%= helpers.icon "arrow-right", class: "w-4 h-4" %>
<% end %>
<div class="flex items-center justify-end gap-1.5 text-sm font-medium text-primary">
<%= t("settings.providers.connect") %>
<%= helpers.icon "arrow-right", class: "w-4 h-4" %>
</div>
</div>
<% end %>
11 changes: 9 additions & 2 deletions app/components/settings/provider_card.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
class Settings::ProviderCard < ApplicationComponent
MATURITY_LABELS = { beta: "Beta", alpha: "Alpha" }.freeze
def self.maturity_label(maturity)
return nil if maturity.blank?

key = maturity.to_sym
return nil if key == :stable

I18n.t("settings.providers.maturity.#{key}", default: nil)
end

def initialize(provider_key:, name:, tagline: nil, region: nil, kind: nil, tier: nil,
maturity: :stable, logo_bg: "bg-gray-500", logo_text: nil)
Expand All @@ -15,7 +22,7 @@ def initialize(provider_key:, name:, tagline: nil, region: nil, kind: nil, tier:
end

def maturity_label
MATURITY_LABELS[@maturity]
self.class.maturity_label(@maturity)
end

def meta_line
Expand Down
7 changes: 0 additions & 7 deletions app/controllers/settings/providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,6 @@ def prepare_show_context
@connected = entries.select { |e| e[:summary][:status] == :ok }
@needs_attention = entries.select { |e| [ :warn, :err ].include?(e[:summary][:status]) }
@available = entries.select { |e| e[:summary][:status] == :off }

@health_counts = {
connected: @connected.size + @needs_attention.size,
needs_attention: @needs_attention.size,
errors: @needs_attention.count { |e| e[:summary][:status] == :err },
accounts_synced: Current.family.accounts.joins(:account_providers).distinct.count
}
end

# Returns a hash mapping provider key → { error:, last_synced_at:, stale: }
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/settings_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def adjacent_setting(current_path, offset)
}
end

def settings_section(title:, subtitle: nil, collapsible: false, open: true, auto_open_param: nil, status: nil, meta: nil, actions: nil, badge: nil, &block)
def settings_section(title:, subtitle: nil, collapsible: false, open: true, auto_open_param: nil, status_pill: nil, meta: nil, actions: nil, badge: nil, &block)
content = capture(&block)
render partial: "settings/section", locals: { title: title, subtitle: subtitle, content: content, collapsible: collapsible, open: open, auto_open_param: auto_open_param, status: status, meta: meta, actions: actions, badge: badge }
render partial: "settings/section", locals: { title: title, subtitle: subtitle, content: content, collapsible: collapsible, open: open, auto_open_param: auto_open_param, status_pill: status_pill, meta: meta, actions: actions, badge: badge }
end

def provider_summary(provider_key)
Expand Down
10 changes: 0 additions & 10 deletions app/models/provider/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,79 +4,69 @@ module Metadata
simplefin: {
region: "US",
kind: "Bank",
tier: "Free",
maturity: :stable,
logo_bg: "bg-blue-600",
logo_text: "SF"
},
lunchflow: {
region: "US",
kind: "Lunch",
tier: "Free",
maturity: :stable,
logo_bg: "bg-orange-500",
logo_text: "LF"
},
enable_banking: {
region: "EU",
kind: "Bank",
tier: "Free",
maturity: :beta,
logo_bg: "bg-purple-600",
logo_text: "EB"
},
coinstats: {
region: "Global",
kind: "Crypto",
tier: "Free",
maturity: :beta,
logo_bg: "bg-yellow-500",
logo_text: "CS"
},
mercury: {
region: "US",
kind: "Bank",
tier: "Free",
maturity: :beta,
logo_bg: "bg-cyan-600",
logo_text: "ME"
},
coinbase: {
region: "Global",
kind: "Crypto",
tier: "Free",
maturity: :beta,
logo_bg: "bg-blue-500",
logo_text: "CB"
},
binance: {
region: "Global",
kind: "Crypto",
tier: "Free",
maturity: :beta,
logo_bg: "bg-yellow-400",
logo_text: "BI"
},
snaptrade: {
region: "US / CA",
kind: "Investment",
tier: "Free",
maturity: :beta,
logo_bg: "bg-green-600",
logo_text: "ST"
},
indexa_capital: {
region: "ES",
kind: "Investment",
tier: "Free",
maturity: :alpha,
logo_bg: "bg-red-600",
logo_text: "IC"
},
sophtron: {
region: "US",
kind: "Bank",
tier: "Free",
maturity: :alpha,
logo_bg: "bg-teal-600",
logo_text: "SO"
Expand Down
6 changes: 3 additions & 3 deletions app/views/settings/_section.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%# locals: (title:, subtitle: nil, content:, collapsible: false, open: true, auto_open_param: nil, status: nil, meta: nil, actions: nil, badge: nil) %>
<%# locals: (title:, subtitle: nil, content:, collapsible: false, open: true, auto_open_param: nil, status_pill: nil, meta: nil, actions: nil, badge: nil) %>
<% if collapsible %>
<details <%= "open" if open %>
class="group bg-container shadow-border-xs rounded-xl p-4"
Expand All @@ -16,12 +16,12 @@
<% end %>
</div>
</div>
<% if status.present? %>
<% if status_pill.present? %>
<div class="flex items-center gap-2 shrink-0 group-open:hidden">
<% if meta.present? %>
<span class="text-xs text-subdued"><%= meta %></span>
<% end %>
<%= render "settings/providers/status_pill", status: status %>
<%= status_pill %>
<%= actions if actions.present? %>
</div>
<% end %>
Expand Down
23 changes: 9 additions & 14 deletions app/views/settings/providers/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= content_for :page_title, "Bank Sync" %>
<%= content_for :page_title, t("settings.providers.show.page_title") %>

<div class="space-y-4">
<% if @encryption_error %>
Expand All @@ -13,9 +13,7 @@
</div>
<% else %>
<div class="flex items-start justify-between gap-4">
<p class="text-secondary">
Connect external accounts so transactions, balances and holdings flow into Sure automatically.
</p>
<p class="text-secondary"><%= t("settings.providers.show.lede") %></p>
<% if @connected.any? || @needs_attention.any? %>
<% sync_all_disabled = Current.family.last_sync_all_attempted_at.present? && Current.family.last_sync_all_attempted_at > 30.seconds.ago %>
<%= button_to sync_all_settings_providers_path,
Expand All @@ -29,28 +27,25 @@
<% end %>
</div>

<%= render Settings::HealthSummary.new(counts: @health_counts) %>

<% all_connections = @needs_attention + @connected %>

<%= render "settings/providers/group_heading",
title: t("settings.providers.groups.your_connections"),
count: all_connections.size %>

<% if all_connections.empty? %>
<p class="text-sm text-secondary px-1 py-2"><%= t("settings.providers.groups.empty_connected") %></p>
<% if all_connections.any? %>
<%= render "settings/providers/group_heading",
title: t("settings.providers.groups.your_connections"),
count: all_connections.size %>
<% end %>

<% all_connections.each do |entry| %>
<% auto_open = [ :warn, :err ].include?(entry[:summary][:status]) || all_connections.size == 1 %>
<% sync_action = entry[:partial].present? ? render("settings/providers/sync_button", provider_key: entry[:provider_key], last_synced_at: entry[:summary][:last_synced_at]) : nil %>
<% maturity_label = Settings::ProviderCard::MATURITY_LABELS[entry[:maturity]] %>
<% maturity_label = Settings::ProviderCard.maturity_label(entry[:maturity]) %>
<% maturity_badge = maturity_label ? content_tag(:span, maturity_label, class: "text-xs font-medium px-1.5 py-0.5 rounded-full bg-alpha-black-50 text-secondary") : nil %>
<% status_pill = render("settings/providers/status_pill", status: entry[:summary][:status]) %>
<%= settings_section title: entry[:title],
collapsible: true,
open: auto_open,
auto_open_param: entry[:auto_open_param],
status: entry[:summary][:status],
status_pill: status_pill,
meta: entry[:summary][:meta],
actions: sync_action,
badge: maturity_badge do %>
Expand Down
13 changes: 6 additions & 7 deletions config/locales/views/settings/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ en:
whats_new_label: What's new
api_keys_label: API Key
appearance_label: Appearance
bank_sync_label: Bank Sync
bank_sync_label: Bank sync
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep Bank sync casing consistent in settings navigation

Changing bank_sync_label to sentence case updates the sidebar/page heading, but the next/previous footer cards still read from SETTINGS_ORDER where this entry remains hard-coded as "Bank Sync" (app/helpers/settings_helper.rb:5). Users will see mixed labels for the same destination depending on which navigation control they use, and localization remains bypassed in that footer path.

Useful? React with 👍 / 👎.

settings_nav_link_large:
next: Next
previous: Back
Expand All @@ -197,13 +197,7 @@ en:
connected: Connected
needs_attention: Action needed
available: Available
empty_connected: Nothing connected yet — pick a provider below to get started.
empty_available: All available providers are connected.
health:
connected: Connected
needs_attention: Action needed
errors: Errors
accounts_synced: Accounts synced
meta:
sync_error: Sync error
no_recent_sync: Sync overdue
Expand Down Expand Up @@ -235,7 +229,12 @@ en:
title: Add another provider
body: Connect a new bank or data source to start syncing accounts.
cta: Browse providers
maturity:
beta: Beta
alpha: Alpha
show:
page_title: Bank sync
lede: Connect external accounts so transactions, balances and holdings flow into Sure automatically.
coinbase_title: Coinbase
encryption_error:
title: Encryption Configuration Required
Expand Down
18 changes: 2 additions & 16 deletions test/system/settings/providers_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,6 @@ class Settings::ProvidersTest < ApplicationSystemTestCase
assert_operator available_y, :<, available_grid_top, "Available heading should appear above the card grid"
end

test "health strip shows four tiles with correct counts" do
SimplefinItem.create!(family: @family, name: "Test SimpleFIN", access_url: "https://bridge.simplefin.org/simplefin/access")

visit settings_providers_path

assert_text "Connected"
assert_text "Action needed"
assert_text "Errors"
assert_text "Accounts synced"
end

test "action needed group is absent when no providers have issues" do
SimplefinItem.create!(family: @family, name: "Test SimpleFIN", access_url: "https://bridge.simplefin.org/simplefin/access")

Expand Down Expand Up @@ -149,14 +138,11 @@ class Settings::ProvidersTest < ApplicationSystemTestCase
end
end

test "clicking a provider card connect link opens the connect drawer" do
test "clicking a provider card opens the connect drawer" do
visit settings_providers_path

within available_provider_cards_container do
card = find(:xpath, ".//div[contains(concat(' ', normalize-space(@class), ' '), ' bg-container ')][.//span[normalize-space()='SimpleFIN']]")
within(card) do
find("a[data-turbo-frame='drawer']", text: "Connect").click
end
find("a[data-turbo-frame='drawer']", text: "SimpleFIN").click
end

assert_selector "dialog[open]"
Expand Down
2 changes: 1 addition & 1 deletion test/system/settings_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class SettingsTest < ApplicationSystemTestCase
# Base settings available to all users
@settings_links = [
[ "Accounts", accounts_path ],
[ "Bank Sync", settings_providers_path ],
[ "Bank sync", settings_providers_path ],
[ "Preferences", settings_preferences_path ],
[ "Profile Info", settings_profile_path ],
[ "Security", settings_security_path ],
Expand Down