Skip to content

Commit

Permalink
feat: add lightning: url scheme fallback when webln is not enabled …
Browse files Browse the repository at this point in the history
…+ wording
  • Loading branch information
Dolu89 committed Sep 25, 2022
1 parent 400dcdc commit 0e444aa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@zerologin/elements",
"description": "Zerologin auth web component",
"version": "0.0.5-beta",
"version": "0.0.6-beta",
"private": false,
"files": [
"dist/"
Expand Down
33 changes: 17 additions & 16 deletions src/components/zerologin.ce.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
<template>
<div class="zerologin">
<h1 class="zl-title">Login with lightning⚡️</h1>
<h1 class="zl-title">Login with Lightning⚡️</h1>

<div class="zl-qr-wrapper">
<div class="zl-qr-wrapper" @click="clickToConnect()">
<img src="" class="zl-qr" ref="qrImage" />
</div>

<div class="zl-scan-text">
Scan this code or copy + paste it to your lightning wallet. Or click to
login with your browser’s wallet.
Scan, click or copy this code to login using your wallet
</div>

<div class="zl-buttons-action">
<button
class="zl-button zl-first"
@click="weblnConnect()"
:disabled="!weblnSupported"
>
<button class="zl-button zl-first" @click="clickToConnect()">
Click to connect
<img src="/src/assets/icons/send-icon.svg" alt="send icon" />
</button>
Expand Down Expand Up @@ -76,14 +71,18 @@ function copy() {
}, 3000);
}
async function weblnConnect() {
// @ts-ignore
await window.webln.enable();
try {
async function clickToConnect() {
if (weblnSupported.value) {
// @ts-ignore
await webln.lnurl(lnurl.value);
} catch (e) {
console.error(e);
await window.webln.enable();
try {
// @ts-ignore
await webln.lnurl(lnurl.value);
} catch (e) {
console.error(e);
}
} else {
window.open(`lightning:${lnurl}`, "_self");
}
}
Expand Down Expand Up @@ -291,6 +290,7 @@ $gray-primary-color-active: mix(
}
.zl-qr-wrapper {
cursor: pointer;
padding: 20px;
background-color: $white;
border-radius: 24px;
Expand Down Expand Up @@ -318,6 +318,7 @@ $gray-primary-color-active: mix(
}
.zl-button {
text-decoration: none;
cursor: pointer;
color: $white;
background-color: $violet-primary-color;
Expand Down

0 comments on commit 0e444aa

Please sign in to comment.