Skip to content

Commit

Permalink
chore: only show disconnect button once connected
Browse files Browse the repository at this point in the history
  • Loading branch information
magiziz committed Oct 18, 2024
1 parent f77edba commit 5e6c072
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions apps/laboratory/src/components/AppKitButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useAppKit, useDisconnect } from '@reown/appkit/react'
import { useAppKit, useDisconnect, useAppKitAccount } from '@reown/appkit/react'
import {
Stack,
Card,
Expand All @@ -12,6 +12,7 @@ import {

export function AppKitButtons() {
const { open } = useAppKit()
const { caipAddress } = useAppKitAccount()
const { disconnect } = useDisconnect()

return (
Expand Down Expand Up @@ -43,9 +44,11 @@ export function AppKitButtons() {
Open
</Button>

<Button data-testid="disconnect-hook-button" onClick={() => disconnect()}>
Disconnect
</Button>
{caipAddress && (
<Button data-testid="disconnect-hook-button" onClick={() => disconnect()}>
Disconnect
</Button>
)}
</Box>
</Box>
</Stack>
Expand Down

0 comments on commit 5e6c072

Please sign in to comment.