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

Minor wallet modal UX improvements #1317

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading