Skip to content

Commit

Permalink
Fix title disappearing and allow cancelling wallet connection. (#1317)
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso committed Aug 2, 2023
1 parent 4c33fce commit 941f687
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 21 deletions.
22 changes: 9 additions & 13 deletions packages/stateful/components/wallet/WalletUi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { WalletUiWalletList } from './WalletUiWalletList'

export const WalletUi = (props: WalletModalProps) => {
const {
isWalletDisconnected,
isWalletConnecting,
isWalletConnected,
isWalletError,
Expand Down Expand Up @@ -46,18 +45,15 @@ export const WalletUi = (props: WalletModalProps) => {
}

const showWalletConnectQr = isWalletConnecting && qrState === State.Done
const title =
isWalletDisconnected || isWalletError
? t('title.logInWith')
: isWalletConnecting
? showWalletConnectQr
? t('title.scanQrCode')
: current?.walletName.startsWith('web3auth_')
? t('title.loggingInToService', { service: current.walletPrettyName })
: t('title.connectingToWallet', { wallet: current?.walletPrettyName })
: isWalletConnected
? t('title.loggedIn')
: ''
const title = isWalletConnecting
? showWalletConnectQr
? t('title.scanQrCode')
: current?.walletName.startsWith('web3auth_')
? t('title.loggingInToService', { service: current.walletPrettyName })
: t('title.connectingToWallet', { wallet: current?.walletPrettyName })
: isWalletConnected
? t('title.loggedIn')
: t('title.logInWith')

return (
<Modal
Expand Down
14 changes: 6 additions & 8 deletions packages/stateful/components/wallet/WalletUiWalletList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,9 @@ export const WalletUiWalletList = ({
isConnectingTo(wallet) && 'animate-pulse'
)}
contentContainerClassName="flex-col !gap-3 justify-between items-center"
disabled={
// Disable if connecting to another wallet.
isWalletConnecting && !isConnectingTo(wallet)
onClick={() =>
isConnectingTo(wallet) ? walletRepo.disconnect() : connect(wallet)
}
onClick={() => connect(wallet)}
variant="secondary"
>
{!!wallet.walletInfo.logo && (
Expand Down Expand Up @@ -99,11 +97,11 @@ export const WalletUiWalletList = ({
isConnectingTo(wallet) && 'animate-pulse'
)}
contentContainerClassName="flex justify-center items-center"
disabled={
// Disable if connecting to another wallet.
isWalletConnecting && !isConnectingTo(wallet)
onClick={() =>
isConnectingTo(wallet)
? walletRepo.disconnect()
: connect(wallet)
}
onClick={() => connect(wallet)}
variant="secondary"
>
{!!wallet.walletInfo.logo && (
Expand Down

2 comments on commit 941f687

@vercel
Copy link

@vercel vercel bot commented on 941f687 Aug 2, 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 941f687 Aug 2, 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.