Skip to content

Commit

Permalink
update styles for wallet connect
Browse files Browse the repository at this point in the history
  • Loading branch information
frontendphil committed Oct 22, 2024
1 parent 5d5962c commit 8890ada
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions extension/src/panel/routes/ConnectButton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import { Alert, Button, RawAddress, Tag } from '@/components'
import { validateAddress } from '@/utils'
import { Alert, Button } from '@/components'
import { invariant } from '@epic-web/invariant'
import classNames from 'classnames'
import { ZeroAddress } from 'ethers'
import React from 'react'
import { RiAlertLine } from 'react-icons/ri'
import { ChainId, parsePrefixedAddress } from 'ser-kit'
import { CHAIN_NAME } from '../../../chains'
import { ProviderType, Route } from '../../../types'
import { useInjectedWallet, useWalletConnect } from '../../providers'
import { isConnectedTo } from '../routeHooks'
import { Account } from './Account'
import { InjectedWallet } from './InjectedWallet'
import classes from './style.module.css'
import { WalletConnect } from './WalletConnect'

interface Props {
Expand Down Expand Up @@ -111,23 +107,18 @@ const ConnectButton: React.FC<Props> = ({ route, onConnect, onDisconnect }) => {
walletConnect.accounts.some((acc) => acc.toLowerCase() === pilotAddress) &&
walletConnect.chainId !== chainId
) {
const chainName = CHAIN_NAME[chainId] || `#${chainId}`

return (
<div
className={classNames(
classes.connectedContainer,
classes.connectionWarning
)}
>
<RawAddress>{validateAddress(pilotAddress)}</RawAddress>
<Tag head={<RiAlertLine />} color="warning">
Chain mismatch
</Tag>
<Button
onClick={() => walletConnect.disconnect()}
className={classes.disconnectButton}
>
Disconnect
</Button>
<div className="flex flex-col gap-4">
<Account providerType={route.providerType}>{pilotAddress}</Account>

<Alert title="Chain mismatch">
The connected wallet belongs to a different chain. Connect a wallet on{' '}
{chainName} to use Pilot.
</Alert>

<Button onClick={() => walletConnect.disconnect()}>Disconnect</Button>
</div>
)
}
Expand Down

0 comments on commit 8890ada

Please sign in to comment.