mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* basic login button implementation * refactoring and add dynamic auth button to the other pages * connect wallet without authenticating an user * login and logout user in blockscout account * refactoring and RPC overrides * authenticate user with connected wallet * add ENS to profile button * override evm chains and fix contract write with waas wallet * disconnect wallet and fix docker build * add dynamic imports to components that use web3 wallet packages * refactor user profile directory * clean up * tweaks * update pw ci script * fix "connect wallet" button behavior * handle linking email to profile with dynamic provider * fix test * async loading web3 hooks and remove dynamic loading from components that use them * fix pw tests * add account navigation in horizontal layout when auth provider is dynamic * fix address verification modal * review fixes * spelling fixes
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
import { DynamicConnectButton, useAuthenticateConnectedUser } from '@dynamic-labs/sdk-react-core';
|
|
import React from 'react';
|
|
|
|
import { Button } from 'toolkit/chakra/button';
|
|
import { PopoverBody, PopoverContent, PopoverRoot, PopoverTrigger } from 'toolkit/chakra/popover';
|
|
|
|
import UserWalletAutoConnectAlert from '../../UserWalletAutoConnectAlert';
|
|
import UserProfileContentWallet from '../common/UserProfileContentWallet';
|
|
|
|
interface Props {
|
|
children: React.ReactNode;
|
|
isAutoConnectDisabled: boolean;
|
|
}
|
|
|
|
const UserProfilePopover = ({ children, isAutoConnectDisabled }: Props) => {
|
|
|
|
const { authenticateUser } = useAuthenticateConnectedUser();
|
|
|
|
return (
|
|
<PopoverRoot positioning={{ placement: 'bottom-end' }}>
|
|
<PopoverTrigger>
|
|
{ children }
|
|
</PopoverTrigger>
|
|
<PopoverContent w="280px">
|
|
<PopoverBody
|
|
css={{
|
|
'& .dynamic-login-button': {
|
|
width: '100%',
|
|
},
|
|
}}
|
|
>
|
|
{ isAutoConnectDisabled && <UserWalletAutoConnectAlert/> }
|
|
<UserProfileContentWallet/>
|
|
<DynamicConnectButton buttonClassName="dynamic-login-button">
|
|
<Button as="div" mt={ 3 } onClick={ authenticateUser } size="sm" w="100%" >Log in</Button>
|
|
</DynamicConnectButton>
|
|
</PopoverBody>
|
|
</PopoverContent>
|
|
</PopoverRoot>
|
|
);
|
|
};
|
|
|
|
export default React.memo(UserProfilePopover);
|