-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
174ea7d
commit 25e7e00
Showing
25 changed files
with
455 additions
and
1,290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
'use client'; | ||
|
||
import { Button, Drawer } from '@gobob/ui'; | ||
import { truncateBtcAddress, truncateEthAddress } from '@gobob/utils'; | ||
import { Trans } from '@lingui/macro'; | ||
import { useAccount } from 'wagmi'; | ||
import { useDynamicContext } from '@dynamic-labs/sdk-react-core'; | ||
import { useState } from 'react'; | ||
|
||
import { useBtcAccount } from '@/hooks'; | ||
|
||
const ConnectButton = (): JSX.Element => { | ||
const { setShowAuthFlow } = useDynamicContext(); | ||
|
||
const { address: evmAddress } = useAccount(); | ||
const { address: btcAddress } = useBtcAccount(); | ||
|
||
const [isOpen, setOpen] = useState(false); | ||
|
||
const isAuthenticated = evmAddress || btcAddress; | ||
|
||
if (!isAuthenticated) { | ||
const handleConnect = () => { | ||
setShowAuthFlow(true); | ||
}; | ||
|
||
return ( | ||
<Button onPress={handleConnect}> | ||
<Trans>Connect Wallet</Trans> | ||
</Button> | ||
); | ||
} | ||
|
||
const handleOpen = () => setOpen(true); | ||
|
||
const handleClose = () => setOpen(false); | ||
|
||
return ( | ||
<> | ||
<Button onPress={handleOpen}> | ||
{evmAddress ? truncateEthAddress(evmAddress) : btcAddress ? truncateBtcAddress(btcAddress) : undefined} | ||
</Button> | ||
<Drawer isOpen={isOpen} onClose={handleClose}> | ||
Here | ||
</Drawer> | ||
</> | ||
); | ||
}; | ||
|
||
export { ConnectButton }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 0 additions & 114 deletions
114
apps/evm/src/connect-ui/component/AuthButton/AuthButton.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.