expansion button and copy button

This commit is contained in:
callebtc 2023-05-08 12:16:41 +02:00
parent b748dc3cb0
commit 55b84de873

View file

@ -99,8 +99,18 @@
<q-card> <q-card>
<q-card-section> <q-card-section>
<div class="row"> <div class="row">
<div class="col-9"> <div class="col">
<div class="text-weight-bold"> <div class="text-weight-bold">
<q-btn
flat
dense
size="0.6rem"
class="q-px-none q-mx-none"
color="grey"
icon="content_copy"
@click="copyText(`wss://${host}/nostrclient/api/v1/relay`)"
><q-tooltip>Copy address</q-tooltip></q-btn
>
Your endpoint: Your endpoint:
<q-badge <q-badge
outline outline
@ -109,15 +119,15 @@
/> />
</div> </div>
</div> </div>
<div class="col-3">
<q-btn @click="toggleTestPanel" :label="testData.show ? 'Close' : 'Test Endpoint' " unelevated color="primary" class="float-right"
></q-btn
>
</div>
</div> </div>
</q-card-section> </q-card-section>
<q-separator v-if="testData.show"></q-separator> <q-expansion-item
<q-card-section v-if="testData.show"> group="advanced"
icon="settings"
label="Test this endpoint"
>
<q-separator></q-separator>
<q-card-section>
<div class="row"> <div class="row">
<div class="col-3"> <div class="col-3">
<span>Sender Private Key:</span> <span>Sender Private Key:</span>
@ -128,7 +138,7 @@
v-model="testData.senderPrivateKey" v-model="testData.senderPrivateKey"
dense dense
filled filled
label="Test Private Key (optional)" label="Private Key (optional)"
></q-input> ></q-input>
</div> </div>
</div> </div>
@ -136,14 +146,10 @@
<div class="col-3"></div> <div class="col-3"></div>
<div class="col-9"> <div class="col-9">
<q-badge color="yellow" text-color="black"> <q-badge color="yellow" text-color="black">
<span <span>
>This should be a temp private (throw away). No not user your No not use your real private key! Leave empty for a randomly
own private key! generated key.</span
</span> >
</q-badge>
<q-badge color="yellow" text-color="black">
<span> It is optional. One can be generated for you!</span>
</q-badge> </q-badge>
</div> </div>
</div> </div>
@ -195,7 +201,9 @@
<div class="col-3"></div> <div class="col-3"></div>
<div class="col-9"> <div class="col-9">
<q-badge color="yellow" text-color="black"> <q-badge color="yellow" text-color="black">
<span>This is the recipient of the message. Field required.</span> <span
>This is the recipient of the message. Field required.</span
>
</q-badge> </q-badge>
</div> </div>
</div> </div>
@ -212,8 +220,9 @@
</div> </div>
</div> </div>
</q-card-section> </q-card-section>
<q-separator v-if="testData.show"></q-separator>
<q-card-section v-if="testData.show"> <q-separator></q-separator>
<q-card-section>
<div class="row q-mt-md"> <div class="row q-mt-md">
<div class="col-3"> <div class="col-3">
<span>Sent Data:</span> <span>Sent Data:</span>
@ -245,6 +254,7 @@
</div> </div>
</div> </div>
</q-card-section> </q-card-section>
</q-expansion-item>
</q-card> </q-card>
</div> </div>
@ -421,18 +431,21 @@
LNbits.utils.notifyApiError(error) LNbits.utils.notifyApiError(error)
}) })
}, },
toggleTestPanel: async function() { toggleTestPanel: async function () {
if (this.testData.show) { if (this.testData.show) {
await this.hideTestPannel() await this.hideTestPannel()
} else { } else {
await this.showTestPanel() await this.showTestPanel()
} }
}, },
showTestPanel: async function() { showTestPanel: async function () {
this.testData = { this.testData = {
show: true, show: true,
wsConnection: null, wsConnection: null,
senderPrivateKey: this.$q.localStorage.getItem('lnbits.nostrclient.senderPrivateKey') || '', senderPrivateKey:
this.$q.localStorage.getItem(
'lnbits.nostrclient.senderPrivateKey'
) || '',
recieverPublicKey: null, recieverPublicKey: null,
message: null, message: null,
sentData: '', sentData: '',
@ -441,7 +454,7 @@
await this.closeWebsocket() await this.closeWebsocket()
this.connectToWebsocket() this.connectToWebsocket()
}, },
hideTestPannel: async function() { hideTestPannel: async function () {
await this.closeWebsocket() await this.closeWebsocket()
this.testData = { this.testData = {
show: false, show: false,