mirror of
https://github.com/lnbits/lnbits.git
synced 2025-04-10 12:59:43 +02:00
move scan to outside of receive.
This commit is contained in:
parent
b1f30390b0
commit
fa8713de17
@ -136,7 +136,7 @@ new Vue({
|
||||
bolt11: ''
|
||||
}
|
||||
},
|
||||
sendCamera: {
|
||||
theCamera: {
|
||||
show: false,
|
||||
camera: 'auto'
|
||||
},
|
||||
@ -206,11 +206,17 @@ new Vue({
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// closeCamera: function () {
|
||||
// this.sendCamera.show = false
|
||||
// },
|
||||
// showCamera: function () {
|
||||
// this.sendCamera.show = true
|
||||
// },
|
||||
closeCamera: function () {
|
||||
this.sendCamera.show = false
|
||||
this.theCamera.show = false
|
||||
},
|
||||
showCamera: function () {
|
||||
this.sendCamera.show = true
|
||||
this.theCamera.show = true
|
||||
},
|
||||
showChart: function () {
|
||||
this.paymentsChart.show = true
|
||||
@ -247,7 +253,7 @@ new Vue({
|
||||
}, 10000)
|
||||
},
|
||||
closeSendDialog: function () {
|
||||
this.sendCamera.show = false
|
||||
// this.sendCamera.show = false
|
||||
var checker = this.send.paymentChecker
|
||||
setTimeout(function () {
|
||||
clearInterval(checker)
|
||||
@ -284,10 +290,26 @@ new Vue({
|
||||
})
|
||||
},
|
||||
decodeQR: function (res) {
|
||||
this.send.data.bolt11 = res
|
||||
this.decodeInvoice()
|
||||
this.sendCamera.show = false
|
||||
if (res.substring(0, 4) == 'lnurl') {
|
||||
console.log(res)
|
||||
var self = this
|
||||
|
||||
LNbits.api
|
||||
.request('GET', '/lnurlscan/' + res, this.g.user.wallets[0].adminkey)
|
||||
.then(function (response) {
|
||||
console.log(response.data)
|
||||
})
|
||||
.catch(function (error) {
|
||||
clearInterval(self.checker)
|
||||
LNbits.utils.notifyApiError(error)
|
||||
})
|
||||
} else {
|
||||
this.send.data.bolt11 = res
|
||||
this.decodeInvoice()
|
||||
this.theCamera.show = false
|
||||
}
|
||||
},
|
||||
|
||||
decodeInvoice: function () {
|
||||
if (this.send.data.bolt11.startsWith('lightning:')) {
|
||||
this.send.data.bolt11 = this.send.data.bolt11.slice(10)
|
||||
|
@ -14,7 +14,7 @@
|
||||
<div class="col">
|
||||
<q-btn
|
||||
unelevated
|
||||
color="purple"
|
||||
color="deep-purple"
|
||||
class="full-width"
|
||||
@click="showSendDialog"
|
||||
>Send</q-btn
|
||||
@ -29,6 +29,16 @@
|
||||
>Receive</q-btn
|
||||
>
|
||||
</div>
|
||||
<div class="col">
|
||||
<q-btn
|
||||
unelevated
|
||||
color="purple"
|
||||
icon="photo_camera"
|
||||
@click="showCamera"
|
||||
>scan
|
||||
<q-tooltip>Use camera to scan an invoice/QR</q-tooltip>
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
|
||||
@ -187,6 +197,7 @@
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-md-5 q-gutter-y-md">
|
||||
<q-card>
|
||||
@ -304,11 +315,6 @@
|
||||
type="textarea"
|
||||
label="Paste an invoice *"
|
||||
>
|
||||
<template v-slot:after>
|
||||
<q-btn round dense flat icon="photo_camera" @click="showCamera">
|
||||
<q-tooltip>Use camera to scan an invoice</q-tooltip>
|
||||
</q-btn>
|
||||
</template>
|
||||
</q-input>
|
||||
<div class="row q-mt-lg">
|
||||
<q-btn
|
||||
@ -342,7 +348,7 @@
|
||||
<h6 class="q-my-none">{{ send.invoice.fsat }} sat</h6>
|
||||
<q-separator class="q-my-sm"></q-separator>
|
||||
<p style="word-break: break-all">
|
||||
<strong>Memo:</strong> {{ send.invoice.description }}<br />
|
||||
<strong>Description:</strong> {{ send.invoice.description }}<br />
|
||||
<strong>Expire date:</strong> {{ send.invoice.expireDate }}<br />
|
||||
<strong>Hash:</strong> {{ send.invoice.hash }}
|
||||
</p>
|
||||
@ -363,8 +369,21 @@
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
|
||||
<q-dialog v-model="theCamera.show" position="top">
|
||||
<q-card class="q-pa-lg q-pt-xl">
|
||||
<div class="text-center q-mb-lg">
|
||||
<qrcode-stream @decode="decodeQR" class="rounded-borders"></qrcode-stream>
|
||||
</div>
|
||||
<div class="row q-mt-lg">
|
||||
<q-btn @click="closeCamera" flat color="grey" class="q-ml-auto"
|
||||
>Cancel</q-btn
|
||||
>
|
||||
</div>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
|
||||
<q-dialog v-model="paymentsChart.show" position="top">
|
||||
<q-card class="q-pa-sm" style="width: 800px; max-width: unset">
|
||||
<q-card class="q-pa-sm" style="width: 800px; max-width: unset;">
|
||||
<q-card-section>
|
||||
<canvas ref="canvas" width="600" height="400"></canvas>
|
||||
</q-card-section>
|
||||
|
Loading…
x
Reference in New Issue
Block a user