From 67c0ab909717bd37a926816ad44b989bb54a6862 Mon Sep 17 00:00:00 2001 From: Guillaume Dorce Date: Thu, 13 Oct 2022 17:42:45 +0200 Subject: [PATCH] add modal for user --- client/src/components/AppHeader.tsx | 5 ++-- client/src/components/Message.tsx | 6 ++--- client/src/components/MessageWrapper.tsx | 4 ++-- client/src/components/ScrollToBottom.tsx | 16 ++++++------- client/src/components/User.tsx | 29 ++++++++++++++++++++++++ 5 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 client/src/components/User.tsx diff --git a/client/src/components/AppHeader.tsx b/client/src/components/AppHeader.tsx index 32da63a..9596866 100644 --- a/client/src/components/AppHeader.tsx +++ b/client/src/components/AppHeader.tsx @@ -2,6 +2,7 @@ import logo from '@assets/images/logo-only.svg'; import { useQuery } from '@tanstack/react-query'; import { useCookies } from 'react-cookie'; import Avatar from '@components/Avatar'; +import User from './User'; import { getMeInfo } from '@controllers/UserController'; import { FiLogOut } from 'react-icons/fi'; @@ -31,9 +32,7 @@ const AppHeader = () => {
{meInfo.data && }
- - {meInfo.isLoading ? '' : meInfo.data ? meInfo.data.firstName + ' ' + meInfo.data.lastName : ''} - + {meInfo.data && }
+ ); }; diff --git a/client/src/components/User.tsx b/client/src/components/User.tsx new file mode 100644 index 0000000..aee8875 --- /dev/null +++ b/client/src/components/User.tsx @@ -0,0 +1,29 @@ +import { useState } from 'react'; +import Modal from './Modal'; + +const User = ({ author }: any) => { + const [show, setShow] = useState(false); + + return ( + <> + + +
+
+
User info
+
First name: {author.firstName}
+
Last name: {author.lastName}
+
Email: {author.email}
+
+ +
+
+ + ); +}; + +export default User;