mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-02-09 05:25:15 -05:00
* MyMeta - App Drawer * MyMeta - App Drawer - help (#242) * update nextjs @10.0.3 * Use next image component for main app drawer icons * change links * backdrop to close drawer * Links * typecheck * Removed py for page header Co-authored-by: The Lone Rōnin <log2n@protonmail.com> * Framer Motion Integration * Removed drawer transparency * Fix disappeared Login component * remove unnecessary pointerevent thing (thanks to display=none) * Fix ticker display * Added guilds Co-authored-by: Pacien Boisson <pakokrew@users.noreply.github.com> Co-authored-by: Pacien Boisson <pakokrew@gmail.com>
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { Box, Button, HStack, MetaButton, Text } from '@metafam/ds';
|
|
import { MetaLink } from 'components/Link';
|
|
import { Web3Context } from 'contexts/Web3Context';
|
|
import React, { useCallback, useContext } from 'react';
|
|
|
|
import { formatAddress } from '../utils/playerHelpers';
|
|
|
|
export const LoginButton: React.FC = () => {
|
|
const { connectWeb3, disconnect, isConnected, address } = useContext(
|
|
Web3Context,
|
|
);
|
|
|
|
const handleLoginClick = useCallback(async () => {
|
|
await connectWeb3();
|
|
}, [connectWeb3]);
|
|
|
|
if (isConnected) {
|
|
return (
|
|
<Box>
|
|
<Text fontFamily="body" color="whiteAlpha.700">
|
|
{formatAddress(address)}
|
|
</Text>
|
|
<HStack spacing={2}>
|
|
<MetaLink href="/profile/setup">Setup profile</MetaLink>
|
|
<Text color="cyan.400">|</Text>
|
|
<Button
|
|
onClick={disconnect}
|
|
fontFamily="body"
|
|
color="cyan.400"
|
|
variant="link"
|
|
fontWeight="normal"
|
|
>
|
|
Disconnect
|
|
</Button>
|
|
</HStack>
|
|
</Box>
|
|
);
|
|
}
|
|
return (
|
|
<MetaButton size="md" px={8} onClick={handleLoginClick}>
|
|
Connect wallet
|
|
</MetaButton>
|
|
);
|
|
};
|