Skip to content

Commit

Permalink
Show copy link button when QR code is loaded (#1575)
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvoskamp authored Dec 15, 2023
1 parent 3cb12f8 commit 90e63a7
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions packages/scaffold/src/partials/w3m-connecting-wc-qrcode/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ export class W3mConnectingWcQrcode extends W3mConnectingWidget {
<wui-text variant="paragraph-500" color="fg-100">
Scan this QR Code with your phone
</wui-text>
<wui-link @click=${this.onCopyUri} color="fg-200">
<wui-icon size="xs" color="fg-200" slot="iconLeft" name="copy"></wui-icon>
Copy link
</wui-link>
${this.copyTemplate()}
</wui-flex>
<w3m-mobile-download-links .wallet=${this.wallet}></w3m-mobile-download-links>
Expand All @@ -65,7 +61,7 @@ export class W3mConnectingWcQrcode extends W3mConnectingWidget {
ConnectionController.setWcLinking(undefined)
ConnectionController.setRecentWallet(this.wallet)

return html`<wui-qr-code
return html` <wui-qr-code
size=${size}
theme=${ThemeController.state.themeMode}
uri=${this.uri}
Expand All @@ -74,6 +70,17 @@ export class W3mConnectingWcQrcode extends W3mConnectingWidget {
></wui-qr-code>`
}

private copyTemplate() {
if (!this.uri || !this.ready) {
return null
}

return html`<wui-link @click=${this.onCopyUri} color="fg-200">
<wui-icon size="xs" color="fg-200" slot="iconLeft" name="copy"></wui-icon>
Copy link
</wui-link>`
}

private forceUpdate = () => {
this.requestUpdate()
}
Expand Down

3 comments on commit 90e63a7

@vercel
Copy link

@vercel vercel bot commented on 90e63a7 Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 90e63a7 Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 90e63a7 Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.