# 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 #{ user_address }"
else
# "Your profile's Nostr address is not set to #{ user_address } yet"
end
if @profile["lud16"].present? && @profile["lud16"] == @user.address
# "Your profile's Lightning address is set to #{ user_address }"
else
# "Your profile's Lightning address is not set to #{ user_address } yet"
end
else
# "We could not find a profile for your public key"
end
end
end
end