Files
sure/app/components/settings/provider_card.rb
Brad 1b8b21760b feat(provider): Akahu integration (#1921)
* First pass of Akahu

* fix up sync all

* conflicts

* fix db migration issue? - fix auto selection of akahu account type

* Address Akahu PR feedback

* Complete provider metadata

* Fix PR 1921 CI tests

* PR feedback

* PR feedback

* post merge

---------

Co-authored-by: failing <failing@users.noreply.github.com>
Co-authored-by: Juan José Mata <jjmata@jjmata.com>
Co-authored-by: sure-admin <sure-admin@splashblot.com>
2026-06-02 21:44:57 +02:00

48 lines
1.3 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, kinds: nil, tier: nil,
maturity: :stable, logo_bg: "bg-gray-500", logo_text: nil)
@provider_key = provider_key
@name = name
@tagline = tagline
@region = region
@kinds = Array(kinds).compact
@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, @kinds.join(" / "), @tier ].compact_blank.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: @kinds.map { |kind| kind.to_s.downcase }.join(" ")
}
end
end