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
4b18a656
Commit
4b18a656
authored
Sep 19, 2024
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle case when wc is disabled
parent
1878c18b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
10 deletions
+26
-10
account.ts
configs/app/features/account.ts
+1
-0
MyProfile.tsx
ui/pages/MyProfile.tsx
+2
-1
useSignInWithWallet.tsx
ui/snippets/auth/useSignInWithWallet.tsx
+8
-1
ProfileDesktop.tsx
ui/snippets/profile/ProfileDesktop.tsx
+7
-1
ProfileMenuContent.tsx
ui/snippets/profile/ProfileMenuContent.tsx
+1
-1
ProfileMenuWallet.tsx
ui/snippets/profile/ProfileMenuWallet.tsx
+0
-5
ProfileMobile.tsx
ui/snippets/profile/ProfileMobile.tsx
+7
-1
No files found.
configs/app/features/account.ts
View file @
4b18a656
...
...
@@ -28,6 +28,7 @@ const logoutUrl = (() => {
})();
const
title
=
'
My account
'
;
// TODO @tom2drum add condition for recaptcha
const
config
:
Feature
<
{
authUrl
:
string
;
logoutUrl
:
string
}
>
=
(()
=>
{
if
(
...
...
ui/pages/MyProfile.tsx
View file @
4b18a656
import
{
Flex
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
config
from
'
configs/app
'
;
import
useFetchProfileInfo
from
'
lib/hooks/useFetchProfileInfo
'
;
import
useRedirectForInvalidAuthToken
from
'
lib/hooks/useRedirectForInvalidAuthToken
'
;
import
MyProfileEmail
from
'
ui/myProfile/MyProfileEmail
'
;
...
...
@@ -25,7 +26,7 @@ const MyProfile = () => {
return
(
<
Flex
maxW=
"480px"
mt=
{
8
}
flexDir=
"column"
rowGap=
{
12
}
>
<
MyProfileEmail
profileQuery=
{
profileQuery
}
/>
<
MyProfileWallet
profileQuery=
{
profileQuery
}
/>
{
config
.
features
.
blockchainInteraction
.
isEnabled
&&
<
MyProfileWallet
profileQuery=
{
profileQuery
}
/>
}
</
Flex
>
);
})();
...
...
ui/snippets/auth/useSignInWithWallet.tsx
View file @
4b18a656
...
...
@@ -2,6 +2,7 @@ import { useWeb3Modal } from '@web3modal/wagmi/react';
import
React
from
'
react
'
;
import
{
useSignMessage
}
from
'
wagmi
'
;
import
config
from
'
configs/app
'
;
import
useApiFetch
from
'
lib/api/useApiFetch
'
;
import
getErrorMessage
from
'
lib/errors/getErrorMessage
'
;
import
useToast
from
'
lib/hooks/useToast
'
;
...
...
@@ -12,7 +13,7 @@ interface Props {
onError
?:
()
=>
void
;
}
export
default
function
useSignInWithWallet
({
onSuccess
,
onError
}:
Props
)
{
function
useSignInWithWallet
({
onSuccess
,
onError
}:
Props
)
{
const
[
isPending
,
setIsPending
]
=
React
.
useState
(
false
);
const
isConnectingWalletRef
=
React
.
useRef
(
false
);
...
...
@@ -65,3 +66,9 @@ export default function useSignInWithWallet({ onSuccess, onError }: Props) {
return
React
.
useMemo
(()
=>
({
start
,
isPending
}),
[
start
,
isPending
]);
}
function
useSignInWithWalletFallback
()
{
return
React
.
useMemo
(()
=>
({
start
:
()
=>
{},
isPending
:
false
}),
[
]);
}
export
default
config
.
features
.
blockchainInteraction
.
isEnabled
?
useSignInWithWallet
:
useSignInWithWalletFallback
;
ui/snippets/profile/ProfileDesktop.tsx
View file @
4b18a656
...
...
@@ -2,6 +2,7 @@ import { PopoverBody, PopoverContent, PopoverTrigger, useDisclosure, type Button
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
config
from
'
configs/app
'
;
import
useFetchProfileInfo
from
'
lib/hooks/useFetchProfileInfo
'
;
import
Popover
from
'
ui/shared/chakra/Popover
'
;
import
AuthModal
from
'
ui/snippets/auth/AuthModal
'
;
...
...
@@ -58,7 +59,12 @@ const ProfileDesktop = ({ buttonSize, buttonVariant = 'header' }: Props) => {
</
PopoverContent
>
)
}
</
Popover
>
{
authModal
.
isOpen
&&
<
AuthModal
onClose=
{
authModal
.
onClose
}
initialScreen=
{
{
type
:
'
select_method
'
}
}
/>
}
{
authModal
.
isOpen
&&
(
<
AuthModal
onClose=
{
authModal
.
onClose
}
initialScreen=
{
{
type
:
config
.
features
.
blockchainInteraction
.
isEnabled
?
'
select_method
'
:
'
email
'
}
}
/>
)
}
</>
);
};
...
...
ui/snippets/profile/ProfileMenuContent.tsx
View file @
4b18a656
...
...
@@ -66,7 +66,7 @@ const ProfileMenuContent = ({ data, onClose }: Props) => {
{
data
?.
email
&&
<
Text
variant=
"secondary"
fontSize=
"sm"
>
{
getUserHandle
(
data
.
email
)
}
</
Text
>
}
</
Flex
>
<
ProfileMenuWallet
onClose=
{
onClose
}
/>
{
config
.
features
.
blockchainInteraction
.
isEnabled
?
<
ProfileMenuWallet
onClose=
{
onClose
}
/>
:
<
Divider
/>
}
<
VStack
as=
"ul"
spacing=
"0"
alignItems=
"flex-start"
overflow=
"hidden"
>
{
navLinks
.
map
((
item
)
=>
(
...
...
ui/snippets/profile/ProfileMenuWallet.tsx
View file @
4b18a656
import
{
Button
,
Divider
,
Flex
,
IconButton
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
config
from
'
configs/app
'
;
import
delay
from
'
lib/delay
'
;
import
AddressEntity
from
'
ui/shared/entities/address/AddressEntity
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
...
...
@@ -30,10 +29,6 @@ const ProfileMenuWallet = ({ onClose }: Props) => {
onClose
?.();
},
[
wallet
,
onClose
]);
if
(
!
config
.
features
.
blockchainInteraction
.
isEnabled
)
{
return
<
Divider
/>;
}
if
(
wallet
.
isWalletConnected
&&
web3AccountWithDomain
.
address
)
{
return
(
<>
...
...
ui/snippets/profile/ProfileMobile.tsx
View file @
4b18a656
...
...
@@ -2,6 +2,7 @@ import { Drawer, DrawerBody, DrawerContent, DrawerOverlay, useDisclosure } from
import
{
useRouter
}
from
'
next/router
'
;
import
React
from
'
react
'
;
import
config
from
'
configs/app
'
;
import
useFetchProfileInfo
from
'
lib/hooks/useFetchProfileInfo
'
;
import
AuthModal
from
'
ui/snippets/auth/AuthModal
'
;
import
useSignInWithWallet
from
'
ui/snippets/auth/useSignInWithWallet
'
;
...
...
@@ -54,7 +55,12 @@ const ProfileMobile = () => {
</
DrawerContent
>
</
Drawer
>
)
}
{
authModal
.
isOpen
&&
<
AuthModal
onClose=
{
authModal
.
onClose
}
initialScreen=
{
{
type
:
'
select_method
'
}
}
/>
}
{
authModal
.
isOpen
&&
(
<
AuthModal
onClose=
{
authModal
.
onClose
}
initialScreen=
{
{
type
:
config
.
features
.
blockchainInteraction
.
isEnabled
?
'
select_method
'
:
'
email
'
}
}
/>
)
}
</>
);
};
...
...
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