mirror of
https://github.com/we-promise/sure.git
synced 2026-05-30 07:49:01 +00:00
- Sync all: replace the hand-rolled `button_to` with `DS::Link.new(variant: "outline", method: :post)` — same component as the "Identify Patterns" button on the recurring-transactions page. - Search input: switch to the icon-overlay pattern used by the Manage-currencies and transaction filter rows (relative wrapper + absolutely positioned search icon + bordered input with `focus:ring-gray-500`). Brings the keyboard focus state in line with the rest of the app's filterable lists. - SnapTrade panel: restore the "needs registration" status row that the drawer-cleanup pass dropped along with the redundant Configured/Not configured footer. The unregistered case is meaningful state, not redundant chrome. - Move the slim health-strip computation out of the controller and into `SettingsHelper#provider_health_strip` (Convention 2: skinny controllers). - Extract `concise_time_ago` helper so the "drop leading 'about '" trick stops being duplicated 3x. - `Settings::ProviderCard#maturity_label` (instance) now delegates to `.maturity_label` (class) instead of duplicating the lookup. - Drop unused `warn_or_err` local in `_connection_row`. - Replace the `data-controller` string-injection + html_safe in `_connection_row` with `tag.details(data: ...)`; safer and more idiomatic. - Add a system test for the empty-filter message wiring.
48 lines
1.2 KiB
Ruby
48 lines
1.2 KiB
Ruby
class Settings::ProviderCard < ApplicationComponent
|
|
MATURITY_LABELS = {
|
|
beta: "settings.providers.maturity.beta",
|
|
alpha: "settings.providers.maturity.alpha"
|
|
}.freeze
|
|
|
|
def self.maturity_label(maturity)
|
|
key = MATURITY_LABELS[maturity&.to_sym]
|
|
I18n.t(key) if key
|
|
end
|
|
|
|
def initialize(provider_key:, name:, tagline: nil, region: nil, kind: nil, tier: nil,
|
|
maturity: :stable, logo_bg: "bg-gray-500", logo_text: nil)
|
|
@provider_key = provider_key
|
|
@name = name
|
|
@tagline = tagline
|
|
@region = region
|
|
@kind = kind
|
|
@tier = tier
|
|
@maturity = maturity.to_sym
|
|
@logo_bg = logo_bg
|
|
@logo_text = logo_text || name.first(2).upcase
|
|
end
|
|
|
|
attr_reader :name, :tagline, :logo_bg, :logo_text
|
|
|
|
def maturity_label
|
|
self.class.maturity_label(@maturity)
|
|
end
|
|
|
|
def meta_line
|
|
[ @region, @kind, @tier ].compact.join(" · ")
|
|
end
|
|
|
|
def connect_path
|
|
helpers.connect_form_settings_providers_path(provider_key: @provider_key)
|
|
end
|
|
|
|
def filter_data
|
|
{
|
|
providers_filter_target: "card",
|
|
provider_name: @name.to_s.downcase,
|
|
provider_region: @region.to_s.downcase,
|
|
provider_kind: @kind.to_s.downcase
|
|
}
|
|
end
|
|
end
|