Commit fed42c9c authored by tom's avatar tom

Blockscout account V2

Fixes #2029
parent 10b4c5e2
import { Box, Button, Divider, Flex, Link, VStack } from '@chakra-ui/react'; import { Box, Button, Divider, Flex, Link, VStack, useColorModeValue } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import type { NavLink } from './types'; import type { NavLink } from './types';
...@@ -18,6 +18,11 @@ import UserProfileContentNavLink from './UserProfileContentNavLink'; ...@@ -18,6 +18,11 @@ import UserProfileContentNavLink from './UserProfileContentNavLink';
import UserProfileContentWallet from './UserProfileContentWallet'; import UserProfileContentWallet from './UserProfileContentWallet';
const navLinks: Array<NavLink> = [ const navLinks: Array<NavLink> = [
{
text: 'My profile',
href: route({ pathname: '/auth/profile' }),
icon: 'profile' as const,
},
{ {
text: 'Watch list', text: 'Watch list',
href: route({ pathname: '/account/watchlist' }), href: route({ pathname: '/account/watchlist' }),
...@@ -57,6 +62,8 @@ const UserProfileContent = ({ data, onClose, onLogin, onAddEmail, onAddAddress } ...@@ -57,6 +62,8 @@ const UserProfileContent = ({ data, onClose, onLogin, onAddEmail, onAddAddress }
const { isAutoConnectDisabled } = useMarketplaceContext(); const { isAutoConnectDisabled } = useMarketplaceContext();
const logout = useLogout(); const logout = useLogout();
const accountTextColor = useColorModeValue('gray.500', 'gray.300');
if (!data) { if (!data) {
return ( return (
<Box> <Box>
...@@ -71,15 +78,16 @@ const UserProfileContent = ({ data, onClose, onLogin, onAddEmail, onAddAddress } ...@@ -71,15 +78,16 @@ const UserProfileContent = ({ data, onClose, onLogin, onAddEmail, onAddAddress }
<Box> <Box>
{ isAutoConnectDisabled && <UserWalletAutoConnectAlert/> } { isAutoConnectDisabled && <UserWalletAutoConnectAlert/> }
<UserProfileContentNavLink <Box fontSize="xs" lineHeight={ 6 } fontWeight="500" px={ 1 } mb="2px">Account</Box>
text="My profile" <Box
href={ route({ pathname: '/auth/profile' }) } fontSize="xs"
icon="profile" lineHeight={ 4 }
onClick={ onClose } fontWeight="500"
py="8px" borderColor="divider"
/> borderWidth="1px"
borderRadius="base"
<Box fontSize="xs" lineHeight={ 4 } fontWeight="500" borderColor="divider" borderWidth="1px" borderRadius="base"> color={ accountTextColor }
>
{ config.features.blockchainInteraction.isEnabled && ( { config.features.blockchainInteraction.isEnabled && (
<Flex p={ 2 } borderColor="divider" borderBottomWidth="1px"> <Flex p={ 2 } borderColor="divider" borderBottomWidth="1px">
<Box>Address</Box> <Box>Address</Box>
...@@ -91,7 +99,7 @@ const UserProfileContent = ({ data, onClose, onLogin, onAddEmail, onAddAddress } ...@@ -91,7 +99,7 @@ const UserProfileContent = ({ data, onClose, onLogin, onAddEmail, onAddAddress }
/> />
{ data?.address_hash ? { data?.address_hash ?
<Box>{ shortenString(data?.address_hash) }</Box> : <Box>{ shortenString(data?.address_hash) }</Box> :
<Link onClick={ onAddAddress } color="text_secondary" _hover={{ color: 'link_hovered', textDecoration: 'none' }}>Add address</Link> <Link onClick={ onAddAddress } color="icon_info" _hover={{ color: 'link_hovered', textDecoration: 'none' }}>Add address</Link>
} }
</Flex> </Flex>
) } ) }
...@@ -99,14 +107,14 @@ const UserProfileContent = ({ data, onClose, onLogin, onAddEmail, onAddAddress } ...@@ -99,14 +107,14 @@ const UserProfileContent = ({ data, onClose, onLogin, onAddEmail, onAddAddress }
<Box mr="auto">Email</Box> <Box mr="auto">Email</Box>
{ data?.email ? { data?.email ?
<TruncatedValue value={ data.email }/> : <TruncatedValue value={ data.email }/> :
<Link onClick={ onAddEmail } color="text_secondary" _hover={{ color: 'link_hovered', textDecoration: 'none' }}>Add email</Link> <Link onClick={ onAddEmail } color="icon_info" _hover={{ color: 'link_hovered', textDecoration: 'none' }}>Add email</Link>
} }
</Flex> </Flex>
</Box> </Box>
{ config.features.blockchainInteraction.isEnabled && <UserProfileContentWallet onClose={ onClose } mt={ 3 }/> } { config.features.blockchainInteraction.isEnabled && <UserProfileContentWallet onClose={ onClose } mt={ 3 }/> }
<VStack as="ul" spacing="0" alignItems="flex-start" overflow="hidden" mt={ 3 }> <VStack as="ul" spacing="0" alignItems="flex-start" overflow="hidden" mt={ 4 }>
{ navLinks.map((item) => ( { navLinks.map((item) => (
<UserProfileContentNavLink <UserProfileContentNavLink
key={ item.text } key={ item.text }
......
import type { SpaceProps } from '@chakra-ui/react';
import { Box } from '@chakra-ui/react'; import { Box } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
...@@ -7,11 +6,7 @@ import type { NavLink } from './types'; ...@@ -7,11 +6,7 @@ import type { NavLink } from './types';
import IconSvg from 'ui/shared/IconSvg'; import IconSvg from 'ui/shared/IconSvg';
import LinkInternal from 'ui/shared/links/LinkInternal'; import LinkInternal from 'ui/shared/links/LinkInternal';
type Props = NavLink & { const UserProfileContentNavLink = ({ href, icon, text, onClick }: NavLink) => {
py?: SpaceProps['py'];
}
const UserProfileContentNavLink = ({ href, icon, text, onClick, py }: Props) => {
return ( return (
<LinkInternal <LinkInternal
...@@ -19,7 +14,7 @@ const UserProfileContentNavLink = ({ href, icon, text, onClick, py }: Props) => ...@@ -19,7 +14,7 @@ const UserProfileContentNavLink = ({ href, icon, text, onClick, py }: Props) =>
display="flex" display="flex"
alignItems="center" alignItems="center"
columnGap={ 3 } columnGap={ 3 }
py={ py ?? '14px' } py="14px"
color="inherit" color="inherit"
_hover={{ textDecoration: 'none', color: 'link_hovered' }} _hover={{ textDecoration: 'none', color: 'link_hovered' }}
onClick={ onClick } onClick={ onClick }
......
...@@ -73,7 +73,7 @@ const UserProfileContentWallet = ({ onClose, className }: Props) => { ...@@ -73,7 +73,7 @@ const UserProfileContentWallet = ({ onClose, className }: Props) => {
return ( return (
<Box className={ className }> <Box className={ className }>
<Flex px={ 2 } py={ 1 } mb={ 1 } fontSize="xs" lineHeight={ 4 } fontWeight="500"> <Flex px={ 1 } mb="2px" fontSize="xs" alignItems="center" lineHeight={ 6 } fontWeight="500">
<span>Connected wallet</span> <span>Connected wallet</span>
<Hint <Hint
label={ label={
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment