Show the bunker URI field in the remote signer connect modal instead of the settings page, and drop its waiting-for-signer placeholder text to keep the modal compact.
This commit is contained in:
4 files changed
+22
-41
No files matched your search
@@ -85,9 +85,7 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<p class="mt-4 <%= text_class %> text-gray-600" data-nostr-signer-connect-target="status">
|
||||
Waiting for your signer…
|
||||
</p>
|
||||
<p class="mt-4 <%= text_class %> text-gray-600" data-nostr-signer-connect-target="status"></p>
|
||||
|
||||
<p class="mt-2 hidden <%= text_class %>" data-nostr-signer-connect-target="authWrapper">
|
||||
<a href="#" target="_blank" rel="noopener noreferrer"
|
||||
@@ -131,22 +129,20 @@
|
||||
form: button_form_options %>
|
||||
</div>
|
||||
|
||||
<% unless @modal %>
|
||||
<details class="mt-4">
|
||||
<summary class="cursor-pointer text-gray-600">Prefer a bunker:// URI?</summary>
|
||||
<%= form_with url: @create_url, method: :post, local: true, class: "mt-3" do %>
|
||||
<p>
|
||||
<%= text_field_tag :bunker_uri, nil,
|
||||
placeholder: "bunker://…",
|
||||
class: "w-full",
|
||||
autocomplete: "off" %>
|
||||
</p>
|
||||
<p class="mt-2">
|
||||
<%= submit_tag "Connect bunker", class: "btn-md btn-gray" %>
|
||||
</p>
|
||||
<% end %>
|
||||
</details>
|
||||
<% end %>
|
||||
<details class="mt-4">
|
||||
<summary class="cursor-pointer text-gray-600">Prefer a bunker:// URI?</summary>
|
||||
<%= form_with url: @create_url, method: :post, local: true, class: "mt-3" do %>
|
||||
<p>
|
||||
<%= text_field_tag :bunker_uri, nil,
|
||||
placeholder: "bunker://…",
|
||||
class: "w-full",
|
||||
autocomplete: "off" %>
|
||||
</p>
|
||||
<p class="mt-2">
|
||||
<%= submit_tag "Connect bunker", class: action_button_class %>
|
||||
</p>
|
||||
<% end %>
|
||||
</details>
|
||||
|
||||
<% if @show_disconnect && @destroy_url.present? %>
|
||||
<div class="mt-4">
|
||||
@@ -164,20 +160,5 @@
|
||||
<%= button_to "Connect a signer app", @create_url, method: :post,
|
||||
class: "btn-md btn-gray w-full sm:w-auto" %>
|
||||
</div>
|
||||
|
||||
<details class="mt-4">
|
||||
<summary class="cursor-pointer text-gray-600">Already have a bunker:// URI?</summary>
|
||||
<%= form_with url: @create_url, method: :post, local: true, class: "mt-3" do %>
|
||||
<p>
|
||||
<%= text_field_tag :bunker_uri, nil,
|
||||
placeholder: "bunker://…",
|
||||
class: "w-full",
|
||||
autocomplete: "off" %>
|
||||
</p>
|
||||
<p class="mt-2">
|
||||
<%= submit_tag "Connect bunker", class: "btn-md btn-gray" %>
|
||||
</p>
|
||||
<% end %>
|
||||
</details>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -118,7 +118,7 @@ RSpec.describe NostrSignerConnectComponent, type: :component do
|
||||
|
||||
expect(rendered.text).to include("Nostr Connect")
|
||||
expect(rendered.text).to include("Cancel")
|
||||
expect(rendered.text).not_to include("Prefer a bunker:// URI?")
|
||||
expect(rendered.text).to include("Prefer a bunker:// URI?")
|
||||
expect(rendered.css("a[data-action='nostr-signer-connect#openSigner']").any?).to be(true)
|
||||
expect(rendered.css("p.text-base").any?).to be(true)
|
||||
expect(rendered.css("button.btn-md").any?).to be(true)
|
||||
@@ -138,12 +138,12 @@ RSpec.describe NostrSignerConnectComponent, type: :component do
|
||||
expect(retry_node["hidden"]).to be_nil
|
||||
end
|
||||
|
||||
it "keeps the inline bunker option when no connection exists" do
|
||||
it "keeps the inline connect button when no connection exists" do
|
||||
rendered = render_inline(described_class.new(create_url: "/settings/nostr_signer"))
|
||||
|
||||
expect(rendered.text).to include("Use a mobile or desktop signer app, like Amber or Regent")
|
||||
expect(rendered.text).to include("Connect a signer app")
|
||||
expect(rendered.text).to include("Already have a bunker:// URI?")
|
||||
expect(rendered.text).not_to include("bunker:// URI?")
|
||||
|
||||
connect = rendered.css("button, input[type=submit]").find do |node|
|
||||
node.text.strip == "Connect a signer app" || node["value"] == "Connect a signer app"
|
||||
|
||||
@@ -24,7 +24,6 @@ RSpec.describe 'Nostr Settings', type: :feature do
|
||||
expect(page).to have_css("h4", text: "Nostr Connect")
|
||||
expect(page).to have_content("Use a mobile or desktop signer app, like Amber or Regent")
|
||||
expect(page).to have_button("Connect a signer app")
|
||||
expect(page).to have_content("Already have a bunker:// URI?")
|
||||
end
|
||||
|
||||
# scenario 'Successfully saving a key' do
|
||||
|
||||
@@ -51,19 +51,20 @@ RSpec.describe "Settings::NostrSigners", type: :request do
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(response.body).to include("nostrconnect://")
|
||||
expect(response.body).to include("Waiting for your signer")
|
||||
expect(response.body).to include('data-nostr-signer-connect-target="status"')
|
||||
expect(response.body).to include("Prefer a bunker:// URI?")
|
||||
expect(response.body).to include('data-modal-open-value="true"')
|
||||
expect(response.body).to include('data-modal-target="background"')
|
||||
expect(response.body).to include("Nostr Connect")
|
||||
expect(response.body).not_to include("Already have a bunker:// URI?")
|
||||
end
|
||||
|
||||
it "keeps the inline connect button and bunker option when no session is pending" do
|
||||
it "keeps the inline connect button when no session is pending" do
|
||||
get setting_path(:nostr)
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(response.body).to include("Connect a signer app")
|
||||
expect(response.body).to include("Already have a bunker:// URI?")
|
||||
expect(response.body).not_to include("bunker:// URI?")
|
||||
expect(response.body).not_to include('data-modal-open-value="true"')
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user