akkounts/app/components/settings/nostr_relay_status_component.rb
Râu Cao 04a9061663
All checks were successful
continuous-integration/drone/push Build is passing
WIP Render nostr profile and relay status with Ruby
2024-10-18 15:29:43 +02:00

24 lines
738 B
Ruby

# frozen_string_literal: true
module Settings
class NostrRelayStatusComponent < ViewComponent::Base
def initialize(relay_urls:)
if relay_urls.present?
if relay_urls.any? { |r| r.include?("wss://nostr.kosmos.org") }
@text = "You have a relay list, and the Kosmos relay is part of it"
@icon_name = "check-circle"
@icon_color = "emerald-500"
else
@text = "The Kosmos relay is missing from your relay list"
@icon_name = "alert-octagon"
@icon_color = "amber-500"
end
else
@text = "We could not find a relay list for your public key"
@icon_name = "alert-octagon"
@icon_color = "amber-500"
end
end
end
end