Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
12e07e0e
Commit
12e07e0e
authored
Sep 19, 2024
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring
parent
5b91364b
Changes
21
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
82 additions
and
79 deletions
+82
-79
useAccountWithDomain.ts
lib/web3/useAccountWithDomain.ts
+3
-2
HeroBanner.tsx
ui/home/HeroBanner.tsx
+4
-4
MarketplaceAppTopBar.tsx
ui/marketplace/MarketplaceAppTopBar.tsx
+4
-4
HeaderDesktop.tsx
ui/snippets/header/HeaderDesktop.tsx
+4
-4
HeaderMobile.tsx
ui/snippets/header/HeaderMobile.tsx
+4
-4
NavigationDesktop.tsx
ui/snippets/navigation/horizontal/NavigationDesktop.tsx
+4
-4
README.md
ui/snippets/user/README.md
+2
-0
UserIdenticon.tsx
ui/snippets/user/UserIdenticon.tsx
+2
-2
UserWalletAutoConnectAlert.tsx
ui/snippets/user/UserWalletAutoConnectAlert.tsx
+2
-2
UserProfileButton.tsx
ui/snippets/user/profile/UserProfileButton.tsx
+5
-5
UserProfileContent.tsx
ui/snippets/user/profile/UserProfileContent.tsx
+10
-10
UserProfileContentNavLink.tsx
ui/snippets/user/profile/UserProfileContentNavLink.tsx
+2
-2
UserProfileContentWallet.tsx
ui/snippets/user/profile/UserProfileContentWallet.tsx
+3
-4
UserProfileDesktop.tsx
ui/snippets/user/profile/UserProfileDesktop.tsx
+6
-6
UserProfileMobile.tsx
ui/snippets/user/profile/UserProfileMobile.tsx
+6
-6
types.ts
ui/snippets/user/profile/types.ts
+0
-0
utils.ts
ui/snippets/user/profile/utils.ts
+0
-0
UserWalletButton.tsx
ui/snippets/user/wallet/UserWalletButton.tsx
+5
-4
UserWalletDesktop.tsx
ui/snippets/user/wallet/UserWalletDesktop.tsx
+5
-5
UserWalletMenuContent.tsx
ui/snippets/user/wallet/UserWalletMenuContent.tsx
+4
-4
UserWalletMobile.tsx
ui/snippets/user/wallet/UserWalletMobile.tsx
+7
-7
No files found.
ui/snippets/profile/useWeb3AccountWithDomain.tsx
→
lib/web3/useAccountWithDomain.ts
View file @
12e07e0e
...
...
@@ -2,9 +2,10 @@ import React from 'react';
import
config
from
'
configs/app
'
;
import
useApiQuery
from
'
lib/api/useApiQuery
'
;
import
useAccount
from
'
lib/web3/useAccount
'
;
export
default
function
useWeb3AccountWithDomain
(
isEnabled
:
boolean
)
{
import
useAccount
from
'
./useAccount
'
;
export
default
function
useAccountWithDomain
(
isEnabled
:
boolean
)
{
const
{
address
}
=
useAccount
();
const
isQueryEnabled
=
config
.
features
.
nameService
.
isEnabled
&&
Boolean
(
address
)
&&
Boolean
(
isEnabled
);
...
...
ui/home/HeroBanner.tsx
View file @
12e07e0e
...
...
@@ -3,9 +3,9 @@ import React from 'react';
import
config
from
'
configs/app
'
;
import
AdBanner
from
'
ui/shared/ad/AdBanner
'
;
import
ProfileDesktop
from
'
ui/snippets/profile/ProfileDesktop
'
;
import
SearchBar
from
'
ui/snippets/searchBar/SearchBar
'
;
import
WalletDesktop
from
'
ui/snippets/wallet/WalletDesktop
'
;
import
UserProfileDesktop
from
'
ui/snippets/user/profile/UserProfileDesktop
'
;
import
UserWalletDesktop
from
'
ui/snippets/user/wallet/UserWalletDesktop
'
;
const
BACKGROUND_DEFAULT
=
'
radial-gradient(103.03% 103.03% at 0% 0%, rgba(183, 148, 244, 0.8) 0%, rgba(0, 163, 196, 0.8) 100%), var(--chakra-colors-blue-400)
'
;
const
TEXT_COLOR_DEFAULT
=
'
white
'
;
...
...
@@ -55,8 +55,8 @@ const HeroBanner = () => {
{
config
.
UI
.
navigation
.
layout
===
'
vertical
'
&&
(
<
Box
display=
{
{
base
:
'
none
'
,
lg
:
'
block
'
}
}
>
{
(
config
.
features
.
account
.
isEnabled
&&
<
ProfileDesktop
buttonVariant=
"hero"
/>)
||
(
config
.
features
.
blockchainInteraction
.
isEnabled
&&
<
WalletDesktop
buttonVariant=
"hero"
/>)
(
config
.
features
.
account
.
isEnabled
&&
<
User
ProfileDesktop
buttonVariant=
"hero"
/>)
||
(
config
.
features
.
blockchainInteraction
.
isEnabled
&&
<
User
WalletDesktop
buttonVariant=
"hero"
/>)
}
</
Box
>
)
}
...
...
ui/marketplace/MarketplaceAppTopBar.tsx
View file @
12e07e0e
...
...
@@ -12,8 +12,8 @@ import IconSvg from 'ui/shared/IconSvg';
import
LinkExternal
from
'
ui/shared/links/LinkExternal
'
;
import
LinkInternal
from
'
ui/shared/links/LinkInternal
'
;
import
NetworkLogo
from
'
ui/snippets/networkMenu/NetworkLogo
'
;
import
ProfileDesktop
from
'
ui/snippets/profile/
ProfileDesktop
'
;
import
WalletDesktop
from
'
ui/snippets/wallet/
WalletDesktop
'
;
import
UserProfileDesktop
from
'
ui/snippets/user/profile/User
ProfileDesktop
'
;
import
UserWalletDesktop
from
'
ui/snippets/user/wallet/User
WalletDesktop
'
;
import
AppSecurityReport
from
'
./AppSecurityReport
'
;
import
ContractListModal
from
'
./ContractListModal
'
;
...
...
@@ -100,8 +100,8 @@ const MarketplaceAppTopBar = ({ appId, data, isLoading, securityReport }: Props)
{
!
isMobile
&&
(
<
Box
ml=
"auto"
>
{
(
config
.
features
.
account
.
isEnabled
&&
<
ProfileDesktop
buttonSize=
"sm"
/>)
||
(
config
.
features
.
blockchainInteraction
.
isEnabled
&&
<
WalletDesktop
buttonSize=
"sm"
/>)
(
config
.
features
.
account
.
isEnabled
&&
<
User
ProfileDesktop
buttonSize=
"sm"
/>)
||
(
config
.
features
.
blockchainInteraction
.
isEnabled
&&
<
User
WalletDesktop
buttonSize=
"sm"
/>)
}
</
Box
>
)
}
...
...
ui/snippets/header/HeaderDesktop.tsx
View file @
12e07e0e
...
...
@@ -3,9 +3,9 @@ import React from 'react';
import
config
from
'
configs/app
'
;
import
NetworkLogo
from
'
ui/snippets/networkMenu/NetworkLogo
'
;
import
ProfileDesktop
from
'
ui/snippets/profile/ProfileDesktop
'
;
import
SearchBar
from
'
ui/snippets/searchBar/SearchBar
'
;
import
WalletDesktop
from
'
ui/snippets/wallet/WalletDesktop
'
;
import
UserProfileDesktop
from
'
ui/snippets/user/profile/UserProfileDesktop
'
;
import
UserWalletDesktop
from
'
ui/snippets/user/wallet/UserWalletDesktop
'
;
import
Burger
from
'
./Burger
'
;
...
...
@@ -39,8 +39,8 @@ const HeaderDesktop = ({ renderSearchBar, isMarketplaceAppPage }: Props) => {
{
config
.
UI
.
navigation
.
layout
===
'
vertical
'
&&
(
<
Box
display=
"flex"
flexShrink=
{
0
}
>
{
(
config
.
features
.
account
.
isEnabled
&&
<
ProfileDesktop
/>)
||
(
config
.
features
.
blockchainInteraction
.
isEnabled
&&
<
WalletDesktop
/>)
(
config
.
features
.
account
.
isEnabled
&&
<
User
ProfileDesktop
/>)
||
(
config
.
features
.
blockchainInteraction
.
isEnabled
&&
<
User
WalletDesktop
/>)
}
</
Box
>
)
}
...
...
ui/snippets/header/HeaderMobile.tsx
View file @
12e07e0e
...
...
@@ -5,9 +5,9 @@ import { useInView } from 'react-intersection-observer';
import
config
from
'
configs/app
'
;
import
{
useScrollDirection
}
from
'
lib/contexts/scrollDirection
'
;
import
NetworkLogo
from
'
ui/snippets/networkMenu/NetworkLogo
'
;
import
ProfileMobile
from
'
ui/snippets/profile/ProfileMobile
'
;
import
SearchBar
from
'
ui/snippets/searchBar/SearchBar
'
;
import
WalletMobile
from
'
ui/snippets/wallet/WalletMobile
'
;
import
UserProfileMobile
from
'
ui/snippets/user/profile/UserProfileMobile
'
;
import
UserWalletMobile
from
'
ui/snippets/user/wallet/UserWalletMobile
'
;
import
Burger
from
'
./Burger
'
;
...
...
@@ -49,8 +49,8 @@ const HeaderMobile = ({ hideSearchBar, renderSearchBar }: Props) => {
<
NetworkLogo
ml=
{
2
}
mr=
"auto"
/>
<
Flex
columnGap=
{
2
}
>
{
(
config
.
features
.
account
.
isEnabled
&&
<
ProfileMobile
/>)
||
(
config
.
features
.
blockchainInteraction
.
isEnabled
&&
<
WalletMobile
/>)
||
(
config
.
features
.
account
.
isEnabled
&&
<
User
ProfileMobile
/>)
||
(
config
.
features
.
blockchainInteraction
.
isEnabled
&&
<
User
WalletMobile
/>)
||
<
Box
boxSize=
{
10
}
/>
}
</
Flex
>
...
...
ui/snippets/navigation/horizontal/NavigationDesktop.tsx
View file @
12e07e0e
...
...
@@ -5,8 +5,8 @@ import config from 'configs/app';
import
useNavItems
,
{
isGroupItem
}
from
'
lib/hooks/useNavItems
'
;
import
{
CONTENT_MAX_WIDTH
}
from
'
ui/shared/layout/utils
'
;
import
NetworkLogo
from
'
ui/snippets/networkMenu/NetworkLogo
'
;
import
ProfileDesktop
from
'
ui/snippets/profile/
ProfileDesktop
'
;
import
WalletDesktop
from
'
ui/snippets/wallet/
WalletDesktop
'
;
import
UserProfileDesktop
from
'
ui/snippets/user/profile/User
ProfileDesktop
'
;
import
UserWalletDesktop
from
'
ui/snippets/user/wallet/User
WalletDesktop
'
;
import
TestnetBadge
from
'
../TestnetBadge
'
;
import
NavLink
from
'
./NavLink
'
;
...
...
@@ -39,8 +39,8 @@ const NavigationDesktop = () => {
</
Flex
>
</
chakra
.
nav
>
{
(
config
.
features
.
account
.
isEnabled
&&
<
ProfileDesktop
buttonSize=
"sm"
/>)
||
(
config
.
features
.
blockchainInteraction
.
isEnabled
&&
<
WalletDesktop
buttonSize=
"sm"
/>)
(
config
.
features
.
account
.
isEnabled
&&
<
User
ProfileDesktop
buttonSize=
"sm"
/>)
||
(
config
.
features
.
blockchainInteraction
.
isEnabled
&&
<
User
WalletDesktop
buttonSize=
"sm"
/>)
}
</
Flex
>
</
Box
>
...
...
ui/snippets/user/README.md
0 → 100644
View file @
12e07e0e
Component in
`/profile`
directory are used when Account and WalletConnect features are enabled.
Component in
`/wallet`
directory are used when only WalletConnect features is enabled.
\ No newline at end of file
ui/snippets/
profile/ProfileAddressI
con.tsx
→
ui/snippets/
user/UserIdenti
con.tsx
View file @
12e07e0e
...
...
@@ -9,7 +9,7 @@ type Props = {
isAutoConnectDisabled
?:
boolean
;
};
const
ProfileAddressI
con
=
({
address
,
isAutoConnectDisabled
}:
Props
)
=>
{
const
UserIdenti
con
=
({
address
,
isAutoConnectDisabled
}:
Props
)
=>
{
const
borderColor
=
useColorModeValue
(
'
orange.100
'
,
'
orange.900
'
);
return
(
...
...
@@ -37,4 +37,4 @@ const ProfileAddressIcon = ({ address, isAutoConnectDisabled }: Props) => {
);
};
export
default
React
.
memo
(
ProfileAddressI
con
);
export
default
React
.
memo
(
UserIdenti
con
);
ui/snippets/
wallet/WalletAutoConnectDisabled
Alert.tsx
→
ui/snippets/
user/UserWalletAutoConnect
Alert.tsx
View file @
12e07e0e
...
...
@@ -3,7 +3,7 @@ import React from 'react';
import
IconSvg
from
'
ui/shared/IconSvg
'
;
const
WalletAutoConnectDisabled
Alert
=
()
=>
{
const
UserWalletAutoConnect
Alert
=
()
=>
{
const
bgColor
=
useColorModeValue
(
'
orange.100
'
,
'
orange.900
'
);
return
(
...
...
@@ -28,4 +28,4 @@ const WalletAutoConnectDisabledAlert = () => {
);
};
export
default
React
.
memo
(
WalletAutoConnectDisabled
Alert
);
export
default
React
.
memo
(
UserWalletAutoConnect
Alert
);
ui/snippets/
profile/
ProfileButton.tsx
→
ui/snippets/
user/profile/User
ProfileButton.tsx
View file @
12e07e0e
...
...
@@ -8,10 +8,10 @@ import type { UserInfo } from 'types/api/account';
import
{
useMarketplaceContext
}
from
'
lib/contexts/marketplace
'
;
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
shortenString
from
'
lib/shortenString
'
;
import
useWeb3AccountWithDomain
from
'
lib/web3/useAccountWithDomain
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
ProfileAddressIcon
from
'
./ProfileAddressIcon
'
;
import
useWeb3AccountWithDomain
from
'
./useWeb3AccountWithDomain
'
;
import
UserIdenticon
from
'
../UserIdenticon
'
;
import
{
getUserHandle
}
from
'
./utils
'
;
interface
Props
{
...
...
@@ -22,7 +22,7 @@ interface Props {
isPending
?:
boolean
;
}
const
ProfileButton
=
({
profileQuery
,
size
,
variant
,
onClick
,
isPending
}:
Props
,
ref
:
React
.
ForwardedRef
<
HTMLDivElement
>
)
=>
{
const
User
ProfileButton
=
({
profileQuery
,
size
,
variant
,
onClick
,
isPending
}:
Props
,
ref
:
React
.
ForwardedRef
<
HTMLDivElement
>
)
=>
{
const
[
isFetched
,
setIsFetched
]
=
React
.
useState
(
false
);
const
isMobile
=
useIsMobile
();
...
...
@@ -57,7 +57,7 @@ const ProfileButton = ({ profileQuery, size, variant, onClick, isPending }: Prop
return
(
<
HStack
gap=
{
2
}
>
<
ProfileAddressI
con
address=
{
address
}
isAutoConnectDisabled=
{
isAutoConnectDisabled
}
/>
<
UserIdenti
con
address=
{
address
}
isAutoConnectDisabled=
{
isAutoConnectDisabled
}
/>
<
Box
display=
{
{
base
:
'
none
'
,
md
:
'
block
'
}
}
>
{
text
}
</
Box
>
</
HStack
>
);
...
...
@@ -104,4 +104,4 @@ const ProfileButton = ({ profileQuery, size, variant, onClick, isPending }: Prop
);
};
export
default
React
.
memo
(
React
.
forwardRef
(
ProfileButton
));
export
default
React
.
memo
(
React
.
forwardRef
(
User
ProfileButton
));
ui/snippets/
profile/ProfileMenu
Content.tsx
→
ui/snippets/
user/profile/UserProfile
Content.tsx
View file @
12e07e0e
...
...
@@ -9,10 +9,10 @@ import { route } from 'nextjs-routes';
import
config
from
'
configs/app
'
;
import
{
useMarketplaceContext
}
from
'
lib/contexts/marketplace
'
;
import
useLogout
from
'
ui/snippets/auth/useLogout
'
;
import
WalletAutoConnectDisabledAlert
from
'
ui/snippets/wallet/WalletAutoConnectDisabledAlert
'
;
import
ProfileMenuNavLink
from
'
./ProfileMenuNavLink
'
;
import
ProfileMenuWallet
from
'
./ProfileMenuWallet
'
;
import
UserWalletAutoConnectAlert
from
'
../UserWalletAutoConnectAlert
'
;
import
UserProfileContentNavLink
from
'
./UserProfileContentNavLink
'
;
import
UserProfileContentWallet
from
'
./UserProfileContentWallet
'
;
import
{
getUserHandle
}
from
'
./utils
'
;
const
navLinks
:
Array
<
NavLink
>
=
[
...
...
@@ -48,16 +48,16 @@ interface Props {
onClose
?:
()
=>
void
;
}
const
ProfileMenu
Content
=
({
data
,
onClose
}:
Props
)
=>
{
const
UserProfile
Content
=
({
data
,
onClose
}:
Props
)
=>
{
const
{
isAutoConnectDisabled
}
=
useMarketplaceContext
();
const
logout
=
useLogout
();
return
(
<
Box
>
{
isAutoConnectDisabled
&&
<
WalletAutoConnectDisabled
Alert
/>
}
{
isAutoConnectDisabled
&&
<
UserWalletAutoConnect
Alert
/>
}
<
Flex
alignItems=
"center"
justifyContent=
"space-between"
>
<
ProfileMenu
NavLink
<
UserProfileContent
NavLink
text=
"Profile"
href=
{
route
({
pathname
:
'
/auth/profile
'
})
}
icon=
"profile"
...
...
@@ -66,11 +66,11 @@ const ProfileMenuContent = ({ data, onClose }: Props) => {
{
data
?.
email
&&
<
Text
variant=
"secondary"
fontSize=
"sm"
>
{
getUserHandle
(
data
.
email
)
}
</
Text
>
}
</
Flex
>
{
config
.
features
.
blockchainInteraction
.
isEnabled
?
<
ProfileMenu
Wallet
onClose=
{
onClose
}
/>
:
<
Divider
/>
}
{
config
.
features
.
blockchainInteraction
.
isEnabled
?
<
UserProfileContent
Wallet
onClose=
{
onClose
}
/>
:
<
Divider
/>
}
<
VStack
as=
"ul"
spacing=
"0"
alignItems=
"flex-start"
overflow=
"hidden"
>
{
navLinks
.
map
((
item
)
=>
(
<
ProfileMenu
NavLink
<
UserProfileContent
NavLink
key=
{
item
.
text
}
{
...
item
}
onClick=
{
onClose
}
...
...
@@ -80,7 +80,7 @@ const ProfileMenuContent = ({ data, onClose }: Props) => {
<
Divider
my=
{
1
}
/>
<
ProfileMenu
NavLink
<
UserProfileContent
NavLink
text=
"Sign out"
icon=
"sign_out"
onClick=
{
logout
}
...
...
@@ -89,4 +89,4 @@ const ProfileMenuContent = ({ data, onClose }: Props) => {
);
};
export
default
React
.
memo
(
ProfileMenu
Content
);
export
default
React
.
memo
(
UserProfile
Content
);
ui/snippets/
profile/ProfileMenu
NavLink.tsx
→
ui/snippets/
user/profile/UserProfileContent
NavLink.tsx
View file @
12e07e0e
...
...
@@ -8,7 +8,7 @@ import LinkInternal from 'ui/shared/links/LinkInternal';
type
Props
=
NavLink
const
ProfileMenu
NavLink
=
({
href
,
icon
,
text
,
onClick
}:
Props
)
=>
{
const
UserProfileContent
NavLink
=
({
href
,
icon
,
text
,
onClick
}:
Props
)
=>
{
return
(
<
LinkInternal
...
...
@@ -27,4 +27,4 @@ const ProfileMenuNavLink = ({ href, icon, text, onClick }: Props) => {
);
};
export
default
React
.
memo
(
ProfileMenu
NavLink
);
export
default
React
.
memo
(
UserProfileContent
NavLink
);
ui/snippets/
profile/ProfileMenu
Wallet.tsx
→
ui/snippets/
user/profile/UserProfileContent
Wallet.tsx
View file @
12e07e0e
...
...
@@ -2,17 +2,16 @@ import { Button, Divider, Flex, IconButton } from '@chakra-ui/react';
import
React
from
'
react
'
;
import
delay
from
'
lib/delay
'
;
import
useWeb3AccountWithDomain
from
'
lib/web3/useAccountWithDomain
'
;
import
useWeb3Wallet
from
'
lib/web3/useWallet
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
useWeb3AccountWithDomain
from
'
./useWeb3AccountWithDomain
'
;
interface
Props
{
onClose
?:
()
=>
void
;
}
const
ProfileMenu
Wallet
=
({
onClose
}:
Props
)
=>
{
const
UserProfileContent
Wallet
=
({
onClose
}:
Props
)
=>
{
const
web3Wallet
=
useWeb3Wallet
({
source
:
'
Header
'
});
const
web3AccountWithDomain
=
useWeb3AccountWithDomain
(
true
);
...
...
@@ -72,4 +71,4 @@ const ProfileMenuWallet = ({ onClose }: Props) => {
);
};
export
default
React
.
memo
(
ProfileMenu
Wallet
);
export
default
React
.
memo
(
UserProfileContent
Wallet
);
ui/snippets/
profile/
ProfileDesktop.tsx
→
ui/snippets/
user/profile/User
ProfileDesktop.tsx
View file @
12e07e0e
...
...
@@ -8,15 +8,15 @@ import Popover from 'ui/shared/chakra/Popover';
import
AuthModal
from
'
ui/snippets/auth/AuthModal
'
;
import
useSignInWithWallet
from
'
ui/snippets/auth/useSignInWithWallet
'
;
import
ProfileButton
from
'
./
ProfileButton
'
;
import
ProfileMenuContent
from
'
./ProfileMenu
Content
'
;
import
UserProfileButton
from
'
./User
ProfileButton
'
;
import
UserProfileContent
from
'
./UserProfile
Content
'
;
interface
Props
{
buttonSize
?:
ButtonProps
[
'
size
'
];
buttonVariant
?:
ButtonProps
[
'
variant
'
];
}
const
ProfileDesktop
=
({
buttonSize
,
buttonVariant
=
'
header
'
}:
Props
)
=>
{
const
User
ProfileDesktop
=
({
buttonSize
,
buttonVariant
=
'
header
'
}:
Props
)
=>
{
const
router
=
useRouter
();
const
authModal
=
useDisclosure
();
...
...
@@ -43,7 +43,7 @@ const ProfileDesktop = ({ buttonSize, buttonVariant = 'header' }: Props) => {
<>
<
Popover
openDelay=
{
300
}
placement=
"bottom-end"
isLazy
isOpen=
{
profileMenu
.
isOpen
}
onClose=
{
profileMenu
.
onClose
}
>
<
PopoverTrigger
>
<
ProfileButton
<
User
ProfileButton
profileQuery=
{
profileQuery
}
size=
{
buttonSize
}
variant=
{
buttonVariant
}
...
...
@@ -54,7 +54,7 @@ const ProfileDesktop = ({ buttonSize, buttonVariant = 'header' }: Props) => {
{
profileQuery
.
data
&&
(
<
PopoverContent
maxW=
"280px"
minW=
"220px"
w=
"min-content"
>
<
PopoverBody
>
<
ProfileMenu
Content
data=
{
profileQuery
.
data
}
onClose=
{
profileMenu
.
onClose
}
/>
<
UserProfile
Content
data=
{
profileQuery
.
data
}
onClose=
{
profileMenu
.
onClose
}
/>
</
PopoverBody
>
</
PopoverContent
>
)
}
...
...
@@ -69,4 +69,4 @@ const ProfileDesktop = ({ buttonSize, buttonVariant = 'header' }: Props) => {
);
};
export
default
React
.
memo
(
ProfileDesktop
);
export
default
React
.
memo
(
User
ProfileDesktop
);
ui/snippets/
profile/
ProfileMobile.tsx
→
ui/snippets/
user/profile/User
ProfileMobile.tsx
View file @
12e07e0e
...
...
@@ -7,10 +7,10 @@ import useFetchProfileInfo from 'lib/hooks/useFetchProfileInfo';
import
AuthModal
from
'
ui/snippets/auth/AuthModal
'
;
import
useSignInWithWallet
from
'
ui/snippets/auth/useSignInWithWallet
'
;
import
ProfileButton
from
'
./
ProfileButton
'
;
import
ProfileMenuContent
from
'
./ProfileMenu
Content
'
;
import
UserProfileButton
from
'
./User
ProfileButton
'
;
import
UserProfileContent
from
'
./UserProfile
Content
'
;
const
ProfileMobile
=
()
=>
{
const
User
ProfileMobile
=
()
=>
{
const
router
=
useRouter
();
const
authModal
=
useDisclosure
();
...
...
@@ -35,7 +35,7 @@ const ProfileMobile = () => {
return
(
<>
<
ProfileButton
<
User
ProfileButton
profileQuery=
{
profileQuery
}
variant=
"header"
onClick=
{
handleProfileButtonClick
}
...
...
@@ -50,7 +50,7 @@ const ProfileMobile = () => {
<
DrawerOverlay
/>
<
DrawerContent
maxWidth=
"300px"
>
<
DrawerBody
p=
{
6
}
>
<
ProfileMenu
Content
data=
{
profileQuery
.
data
}
onClose=
{
profileMenu
.
onClose
}
/>
<
UserProfile
Content
data=
{
profileQuery
.
data
}
onClose=
{
profileMenu
.
onClose
}
/>
</
DrawerBody
>
</
DrawerContent
>
</
Drawer
>
...
...
@@ -65,4 +65,4 @@ const ProfileMobile = () => {
);
};
export
default
React
.
memo
(
ProfileMobile
);
export
default
React
.
memo
(
User
ProfileMobile
);
ui/snippets/profile/types.ts
→
ui/snippets/
user/
profile/types.ts
View file @
12e07e0e
File moved
ui/snippets/profile/utils.ts
→
ui/snippets/
user/
profile/utils.ts
View file @
12e07e0e
File moved
ui/snippets/
wallet/
WalletButton.tsx
→
ui/snippets/
user/wallet/User
WalletButton.tsx
View file @
12e07e0e
...
...
@@ -4,7 +4,8 @@ import React from 'react';
import
useIsMobile
from
'
lib/hooks/useIsMobile
'
;
import
shortenString
from
'
lib/shortenString
'
;
import
ProfileAddressIcon
from
'
ui/snippets/profile/ProfileAddressIcon
'
;
import
UserIdenticon
from
'
../UserIdenticon
'
;
interface
Props
{
size
?:
ButtonProps
[
'
size
'
];
...
...
@@ -16,7 +17,7 @@ interface Props {
domain
?:
string
;
}
const
WalletButton
=
({
size
,
variant
,
onClick
,
isPending
,
isAutoConnectDisabled
,
address
,
domain
}:
Props
,
ref
:
React
.
ForwardedRef
<
HTMLButtonElement
>
)
=>
{
const
User
WalletButton
=
({
size
,
variant
,
onClick
,
isPending
,
isAutoConnectDisabled
,
address
,
domain
}:
Props
,
ref
:
React
.
ForwardedRef
<
HTMLButtonElement
>
)
=>
{
const
isMobile
=
useIsMobile
();
...
...
@@ -29,7 +30,7 @@ const WalletButton = ({ size, variant, onClick, isPending, isAutoConnectDisabled
return
(
<
HStack
gap=
{
2
}
>
<
ProfileAddressI
con
address=
{
address
}
isAutoConnectDisabled=
{
isAutoConnectDisabled
}
/>
<
UserIdenti
con
address=
{
address
}
isAutoConnectDisabled=
{
isAutoConnectDisabled
}
/>
<
Box
display=
{
{
base
:
'
none
'
,
md
:
'
block
'
}
}
>
{
text
}
</
Box
>
</
HStack
>
);
...
...
@@ -63,4 +64,4 @@ const WalletButton = ({ size, variant, onClick, isPending, isAutoConnectDisabled
);
};
export
default
React
.
memo
(
React
.
forwardRef
(
WalletButton
));
export
default
React
.
memo
(
React
.
forwardRef
(
User
WalletButton
));
ui/snippets/
wallet/
WalletDesktop.tsx
→
ui/snippets/
user/wallet/User
WalletDesktop.tsx
View file @
12e07e0e
...
...
@@ -2,12 +2,12 @@ import { PopoverBody, PopoverContent, PopoverTrigger, useDisclosure, type Button
import
React
from
'
react
'
;
import
{
useMarketplaceContext
}
from
'
lib/contexts/marketplace
'
;
import
useWeb3AccountWithDomain
from
'
lib/web3/useAccountWithDomain
'
;
import
useWeb3Wallet
from
'
lib/web3/useWallet
'
;
import
Popover
from
'
ui/shared/chakra/Popover
'
;
import
useWeb3AccountWithDomain
from
'
ui/snippets/profile/useWeb3AccountWithDomain
'
;
import
WalletButton
from
'
./
WalletButton
'
;
import
WalletMenuContent
from
'
./
WalletMenuContent
'
;
import
UserWalletButton
from
'
./User
WalletButton
'
;
import
UserWalletMenuContent
from
'
./User
WalletMenuContent
'
;
interface
Props
{
buttonSize
?:
ButtonProps
[
'
size
'
];
...
...
@@ -38,7 +38,7 @@ const WalletDesktop = ({ buttonSize, buttonVariant = 'header' }: Props) => {
return
(
<
Popover
openDelay=
{
300
}
placement=
"bottom-end"
isLazy
isOpen=
{
walletMenu
.
isOpen
}
onClose=
{
walletMenu
.
onClose
}
>
<
PopoverTrigger
>
<
WalletButton
<
User
WalletButton
size=
{
buttonSize
}
variant=
{
buttonVariant
}
onClick=
{
web3Wallet
.
isConnected
?
walletMenu
.
onOpen
:
web3Wallet
.
openModal
}
...
...
@@ -51,7 +51,7 @@ const WalletDesktop = ({ buttonSize, buttonVariant = 'header' }: Props) => {
{
web3AccountWithDomain
.
address
&&
(
<
PopoverContent
w=
"235px"
>
<
PopoverBody
>
<
WalletMenuContent
<
User
WalletMenuContent
address=
{
web3AccountWithDomain
.
address
}
domain=
{
web3AccountWithDomain
.
domain
}
isAutoConnectDisabled=
{
isAutoConnectDisabled
}
...
...
ui/snippets/
wallet/
WalletMenuContent.tsx
→
ui/snippets/
user/wallet/User
WalletMenuContent.tsx
View file @
12e07e0e
...
...
@@ -5,7 +5,7 @@ import delay from 'lib/delay';
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
WalletAutoConnectDisabledAlert
from
'
./WalletAutoConnectDisabled
Alert
'
;
import
UserWalletAutoConnectAlert
from
'
../UserWalletAutoConnect
Alert
'
;
interface
Props
{
address
:
string
;
...
...
@@ -15,7 +15,7 @@ interface Props {
onOpenWallet
:
()
=>
void
;
}
const
WalletMenuContent
=
({
isAutoConnectDisabled
,
address
,
domain
,
onDisconnect
,
onOpenWallet
}:
Props
)
=>
{
const
User
WalletMenuContent
=
({
isAutoConnectDisabled
,
address
,
domain
,
onDisconnect
,
onOpenWallet
}:
Props
)
=>
{
const
handleOpenWalletClick
=
React
.
useCallback
(
async
()
=>
{
await
delay
(
100
);
...
...
@@ -24,7 +24,7 @@ const WalletMenuContent = ({ isAutoConnectDisabled, address, domain, onDisconnec
return
(
<
Box
>
{
isAutoConnectDisabled
&&
<
WalletAutoConnectDisabled
Alert
/>
}
{
isAutoConnectDisabled
&&
<
UserWalletAutoConnect
Alert
/>
}
<
Text
fontSize=
"sm"
fontWeight=
{
600
}
mb=
{
1
}
>
My wallet
</
Text
>
<
Text
fontSize=
"sm"
mb=
{
5
}
fontWeight=
{
400
}
color=
"text_secondary"
>
Your wallet is used to interact with apps and contracts in the explorer.
...
...
@@ -54,4 +54,4 @@ const WalletMenuContent = ({ isAutoConnectDisabled, address, domain, onDisconnec
);
};
export
default
React
.
memo
(
WalletMenuContent
);
export
default
React
.
memo
(
User
WalletMenuContent
);
ui/snippets/
wallet/
WalletMobile.tsx
→
ui/snippets/
user/wallet/User
WalletMobile.tsx
View file @
12e07e0e
...
...
@@ -2,13 +2,13 @@ import { Drawer, DrawerBody, DrawerContent, DrawerOverlay, useDisclosure } from
import
React
from
'
react
'
;
import
{
useMarketplaceContext
}
from
'
lib/contexts/marketplace
'
;
import
useWeb3AccountWithDomain
from
'
lib/web3/useAccountWithDomain
'
;
import
useWeb3Wallet
from
'
lib/web3/useWallet
'
;
import
useWeb3AccountWithDomain
from
'
ui/snippets/profile/useWeb3AccountWithDomain
'
;
import
WalletButton
from
'
./
WalletButton
'
;
import
WalletMenuContent
from
'
./
WalletMenuContent
'
;
import
UserWalletButton
from
'
./User
WalletButton
'
;
import
UserWalletMenuContent
from
'
./User
WalletMenuContent
'
;
const
WalletMobile
=
()
=>
{
const
User
WalletMobile
=
()
=>
{
const
walletMenu
=
useDisclosure
();
const
web3Wallet
=
useWeb3Wallet
({
source
:
'
Header
'
});
...
...
@@ -31,7 +31,7 @@ const WalletMobile = () => {
return
(
<>
<
WalletButton
<
User
WalletButton
variant=
"header"
onClick=
{
web3Wallet
.
isConnected
?
walletMenu
.
onOpen
:
web3Wallet
.
openModal
}
address=
{
web3AccountWithDomain
.
address
}
...
...
@@ -48,7 +48,7 @@ const WalletMobile = () => {
<
DrawerOverlay
/>
<
DrawerContent
maxWidth=
"300px"
>
<
DrawerBody
p=
{
6
}
>
<
WalletMenuContent
<
User
WalletMenuContent
address=
{
web3AccountWithDomain
.
address
}
domain=
{
web3AccountWithDomain
.
domain
}
isAutoConnectDisabled=
{
isAutoConnectDisabled
}
...
...
@@ -63,4 +63,4 @@ const WalletMobile = () => {
);
};
export
default
React
.
memo
(
WalletMobile
);
export
default
React
.
memo
(
User
WalletMobile
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment