From d139935fe9f9e40121817b23d265daf3b4b5b712 Mon Sep 17 00:00:00 2001 From: Jonatan Date: Tue, 9 Jan 2024 08:09:45 +0100 Subject: [PATCH] Add Profile (#5) --- web/src/Layout.tsx | 15 +++++++++- web/src/UserProfile.tsx | 9 ++---- web/src/user/ProfilePage.tsx | 58 ++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 7 deletions(-) create mode 100644 web/src/user/ProfilePage.tsx diff --git a/web/src/Layout.tsx b/web/src/Layout.tsx index cf596e4..7a8d749 100644 --- a/web/src/Layout.tsx +++ b/web/src/Layout.tsx @@ -3,10 +3,12 @@ import { MenuSVG } from '@ensdomains/thorin'; import { FC, PropsWithChildren, useState } from 'react'; import { Header } from './header/Header'; +import { ProfilePage } from './user/ProfilePage'; import { UserProfile } from './UserProfile'; export const Layout: FC> = ({ children }) => { const [headerExpanded, setHeaderExpanded] = useState(false); + const [userExanded, setUserExpanded] = useState(false); return ( <> @@ -17,6 +19,13 @@ export const Layout: FC> = ({ children }) => { }} /> )} + {userExanded && ( + { + setUserExpanded(false); + }} + /> + )}
@@ -32,7 +41,11 @@ export const Layout: FC> = ({ children }) => {
- + { + setUserExpanded(true); + }} + />
{children} diff --git a/web/src/UserProfile.tsx b/web/src/UserProfile.tsx index 9f7c590..eb229d1 100644 --- a/web/src/UserProfile.tsx +++ b/web/src/UserProfile.tsx @@ -1,24 +1,21 @@ import { formatAddress } from '@ens-tools/format'; import { useWeb3Modal } from '@web3modal/wagmi/react'; import { FC } from 'react'; -import { useAccount, useDisconnect, useEnsAvatar, useEnsName } from 'wagmi'; +import { useAccount, useEnsAvatar, useEnsName } from 'wagmi'; -export const UserProfile: FC = () => { +export const UserProfile: FC<{ onClick: () => void }> = ({ onClick }) => { const { open } = useWeb3Modal(); const { address } = useAccount(); const { data: name } = useEnsName({ address }); const { data: avatar } = useEnsAvatar({ name, }); - const { disconnect } = useDisconnect(); if (address) { return ( + +
+ + + ); +};