Skip to content

Commit

Permalink
chore: tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
magiziz committed Nov 7, 2024
1 parent ff62220 commit dd2a048
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export class W3mConnectExternalWidget extends LitElement {
name=${connector.name ?? 'Unknown'}
data-testid=${`wallet-selector-external-${connector.id}`}
@click=${() => this.onConnector(connector)}
tabIdx=${ifDefined(this.tabIdx)}
>
</wui-list-wallet>
`
Expand Down
25 changes: 4 additions & 21 deletions packages/scaffold-ui/src/views/w3m-connect-view/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,30 +96,21 @@ export class W3mConnectView extends LitElement {
tabIdx=${ifDefined(tabIndex)}
></w3m-email-login-widget>
<w3m-social-login-widget tabIdx=${ifDefined(tabIndex)}></w3m-social-login-widget>
${this.walletListTemplate()}
${this.walletListTemplate(tabIndex)}
</wui-flex>
</wui-flex>
${this.guideTemplate()}
${this.guideTemplate(disabled)}
<w3m-legal-footer></w3m-legal-footer>
</wui-flex>
`
}

// -- Private ------------------------------------------- //
private walletListTemplate() {
const { termsConditionsUrl, privacyPolicyUrl, enableLegalCheckbox } = OptionsController.state
private walletListTemplate(tabIndex?: number) {
const socials = this.features?.socials
const emailShowWallets = this.features?.emailShowWallets
const enableWallets = OptionsController.state.enableWallets

const legalUrl = termsConditionsUrl || privacyPolicyUrl
const showLegalCheckbox =
Boolean(legalUrl) && Boolean(enableLegalCheckbox) && this.walletGuide === 'get-started'

const disabled = showLegalCheckbox && !this.checked

const tabIndex = disabled ? -1 : undefined

if (!enableWallets) {
return null
}
Expand Down Expand Up @@ -154,20 +145,12 @@ export class W3mConnectView extends LitElement {
return html`<w3m-wallet-login-list tabIdx=${ifDefined(tabIndex)}></w3m-wallet-login-list>`
}

private guideTemplate() {
private guideTemplate(disabled = false) {
const socials = this.features?.socials
const enableWallets = OptionsController.state.enableWallets

const { termsConditionsUrl, privacyPolicyUrl, enableLegalCheckbox } = OptionsController.state

const legalUrl = termsConditionsUrl || privacyPolicyUrl
const showLegalCheckbox =
Boolean(legalUrl) && Boolean(enableLegalCheckbox) && this.walletGuide === 'get-started'

const socialsExist = socials && socials.length

const disabled = showLegalCheckbox && !this.checked

const classes = {
guide: true,
disabled
Expand Down

0 comments on commit dd2a048

Please sign in to comment.