Skip to content

Commit

Permalink
wait till uri is loaded to show copy link button
Browse files Browse the repository at this point in the history
  • Loading branch information
svenvoskamp committed Dec 15, 2023
1 parent 543666c commit aa9082e
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

0 comments on commit aa9082e

Please sign in to comment.