Improve Nostr connect UI

This commit is contained in:
2026-04-20 13:09:51 +04:00
parent 1dc0c4119b
commit 3a56464926

View File

@@ -7,6 +7,7 @@ import qrCode from '../modifiers/qr-code';
export default class NostrConnectComponent extends Component { export default class NostrConnectComponent extends Component {
@service nostrAuth; @service nostrAuth;
@service toast;
get hasExtension() { get hasExtension() {
return typeof window !== 'undefined' && typeof window.nostr !== 'undefined'; return typeof window !== 'undefined' && typeof window.nostr !== 'undefined';
@@ -16,6 +17,7 @@ export default class NostrConnectComponent extends Component {
async connectExtension() { async connectExtension() {
try { try {
await this.nostrAuth.connectWithExtension(); await this.nostrAuth.connectWithExtension();
this.toast.show('Nostr connected successfully');
if (this.args.onConnect) { if (this.args.onConnect) {
this.args.onConnect(); this.args.onConnect();
} }
@@ -29,6 +31,7 @@ export default class NostrConnectComponent extends Component {
async connectApp() { async connectApp() {
try { try {
await this.nostrAuth.connectWithApp(); await this.nostrAuth.connectWithApp();
this.toast.show('Nostr connected successfully');
if (this.args.onConnect) { if (this.args.onConnect) {
this.args.onConnect(); this.args.onConnect();
} }
@@ -53,7 +56,7 @@ export default class NostrConnectComponent extends Component {
</button> </button>
{{else}} {{else}}
<button <button
class="btn btn-secondary" class="btn btn-outline"
type="button" type="button"
disabled disabled
title="No Nostr extension found in your browser." title="No Nostr extension found in your browser."
@@ -72,7 +75,7 @@ export default class NostrConnectComponent extends Component {
</div> </div>
{{#if (eq this.nostrAuth.connectStatus "waiting")}} {{#if (eq this.nostrAuth.connectStatus "waiting")}}
<div class="alert alert-info nostr-connect-status"> <div class="nostr-connect-status">
{{#if this.nostrAuth.isMobile}} {{#if this.nostrAuth.isMobile}}
<p>Waiting for you to approve the connection in your mobile signer <p>Waiting for you to approve the connection in your mobile signer
app...</p> app...</p>