29 lines
1.0 KiB
Ruby
29 lines
1.0 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module Settings
|
|
class NostrEditProfileComponent < ViewComponent::Base
|
|
def initialize(user:, profile_event:)
|
|
if profile_event.present?
|
|
@user = user
|
|
@profile_event = profile_event
|
|
@profile = JSON.parse(profile_event["content"])
|
|
@display_name = @profile["display_name"] || @profile["displayName"]
|
|
|
|
if @profile["nip05"].present? && @profile["nip05"] == @user.address
|
|
# "Your profile's Nostr address is set to <strong>#{ user_address }</strong>"
|
|
else
|
|
# "Your profile's Nostr address is not set to <strong>#{ user_address }</strong> yet"
|
|
end
|
|
|
|
if @profile["lud16"].present? && @profile["lud16"] == @user.address
|
|
# "Your profile's Lightning address is set to <strong>#{ user_address }</strong>"
|
|
else
|
|
# "Your profile's Lightning address is not set to <strong>#{ user_address }</strong> yet"
|
|
end
|
|
else
|
|
# "We could not find a profile for your public key"
|
|
end
|
|
end
|
|
end
|
|
end
|