-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Connect wallet button [interchain UI part 2] (#1014)
* Add ibc in slice * Connect wallet * Update dropdown * cleanup
- Loading branch information
Showing
22 changed files
with
807 additions
and
242 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 was deleted.
Oops, something went wrong.
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
30 changes: 30 additions & 0 deletions
30
apps/minifront/src/components/ibc/ibc-in/cosmos-wallet-connector.tsx
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,30 @@ | ||
import { useStore } from '../../../state'; | ||
import { ibcInSelector } from '../../../state/ibc-in'; | ||
import { useChain, useManager } from '@cosmos-kit/react'; | ||
import { WalletStatus } from '@cosmos-kit/core'; | ||
import { WalletAddrCard } from './wallet-addr-card'; | ||
import { ConnectWalletButton } from './wallet-connect-button'; | ||
|
||
export const useChainConnector = () => { | ||
const { selectedChain } = useStore(ibcInSelector); | ||
const { chainRecords } = useManager(); | ||
const defaultChain = chainRecords[0]!.name; | ||
return useChain(selectedChain?.chainName ?? defaultChain); | ||
}; | ||
|
||
export const CosmosWalletConnector = () => { | ||
const { selectedChain } = useStore(ibcInSelector); | ||
const { username, address, status, message } = useChainConnector(); | ||
|
||
return ( | ||
<div className='flex flex-col items-center justify-center gap-4'> | ||
{address && selectedChain && <WalletAddrCard username={username} address={address} />} | ||
<div className='w-52'> | ||
<ConnectWalletButton /> | ||
</div> | ||
{(status === WalletStatus.Rejected || status === WalletStatus.Error) && ( | ||
<div className='text-purple-500'>{message}</div> | ||
)} | ||
</div> | ||
); | ||
}; |
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
16 changes: 16 additions & 0 deletions
16
apps/minifront/src/components/ibc/ibc-in/wallet-addr-card.tsx
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,16 @@ | ||
import { Identicon } from '@penumbra-zone/ui/components/ui/identicon'; | ||
|
||
interface UserInfoProps { | ||
address: string; | ||
username?: string; | ||
} | ||
|
||
export const WalletAddrCard = ({ address, username }: UserInfoProps) => { | ||
return ( | ||
<div className='flex flex-col items-center gap-2 space-y-1 rounded-lg bg-white p-6'> | ||
<Identicon uniqueIdentifier={address} type='gradient' size={42} /> | ||
<div className='flex items-center justify-center gap-4 text-gray-500'>{address}</div> | ||
<span className='text-sm font-semibold text-stone-700 sm:text-xl'>{username}</span> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.