mirror of
https://github.com/we-promise/sure.git
synced 2026-05-21 19:44:55 +00:00
36 lines
1.0 KiB
Ruby
36 lines
1.0 KiB
Ruby
class Settings::ProviderCard < ApplicationComponent
|
|
MATURITY_LABELS = {
|
|
beta: "settings.providers.maturity.beta",
|
|
alpha: "settings.providers.maturity.alpha"
|
|
}.freeze
|
|
|
|
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
|
|
|
|
def maturity_label
|
|
label_key = MATURITY_LABELS[@maturity]
|
|
t(label_key) if label_key
|
|
end
|
|
|
|
def meta_line
|
|
[ @region, @kind, @tier ].compact.join(" · ")
|
|
end
|
|
|
|
def connect_path
|
|
helpers.connect_form_settings_providers_path(provider_key: @provider_key)
|
|
end
|
|
|
|
private
|
|
attr_reader :provider_key, :name, :tagline, :region, :kind, :tier, :maturity, :logo_bg, :logo_text
|
|
end
|