Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show copy link button when QR code is loaded #1575

Merged
merged 7 commits into from
Dec 15, 2023
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