diff --git a/templates/nostrmarket/market.html b/templates/nostrmarket/market.html index 33af581..103d7db 100644 --- a/templates/nostrmarket/market.html +++ b/templates/nostrmarket/market.html @@ -1,6 +1,6 @@ {% extends "public.html" %} {% block page %} - - + + Settings @@ -47,6 +47,7 @@ dense round icon="delete" + @click="removePubkey(pub)" /> {%endraw%} @@ -87,6 +88,7 @@ dense round icon="delete" + @click="removeRelay(url)" /> {%endraw%} @@ -212,7 +214,7 @@ - + @@ -247,9 +249,9 @@ mixins: [windowMixin], data: function () { return { - drawer: true, + drawer: false, pubkeys: new Set(), - relays: new Set(defaultRelays), + relays: new Set(), stalls: [], products: [], events: [], @@ -269,6 +271,9 @@ p.categories.includes(this.searchText) ) }) + }, + relayList() { + return Array.from(this.relays) } }, async created() { @@ -276,12 +281,12 @@ this.pubkeys.add( '855ea22a88d7df7ccd8497777db81f115575d5362f51df3af02ead383f5eaba2' ) - //await this.initNostr() + this.relays = new Set(defaultRelays) + await this.initNostr() }, methods: { async initNostr() { this.pool = new nostr.SimplePool() - this.relays = new Set(defaultRelays) let sub = await this.pool .list(Array.from(this.relays), [ { @@ -343,6 +348,12 @@ console.error(err) } }, + removePubkey(pubkey) { + // Needs a hack for Vue reactivity + let pubkeys = this.pubkeys + pubkeys.delete(pubkey) + this.pubkeys = new Set(Array.from(pubkeys)) + }, addRelay() { let relay = String(this.inputRelay).trim() if (!relay.startsWith('ws')) { @@ -351,13 +362,14 @@ } this.relays.add(relay) this.inputRelay = null + }, + removeRelay(relay) { + // Needs a hack for Vue reactivity + let relays = this.relays + relays.delete(relay) + this.relays = new Set(Array.from(relays)) } } }) - {% endblock %}