Updated signed in user menu in IDE
This commit is contained in:
@@ -174,7 +174,7 @@ const IdeHeader = ({
|
|||||||
}}
|
}}
|
||||||
</Popover>
|
</Popover>
|
||||||
{/* <TopButton>Fork</TopButton> */}
|
{/* <TopButton>Fork</TopButton> */}
|
||||||
<div className="h-8 w-8 flex-shrink-0 rounded-full border-2 border-gray-200 flex items-center justify-center">
|
<div className="h-8 w-8">
|
||||||
<NavPlusButton />
|
<NavPlusButton />
|
||||||
</div>
|
</div>
|
||||||
<ProfileSlashLogin />
|
<ProfileSlashLogin />
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import { useState } from 'react'
|
|||||||
import { useAuth } from '@redwoodjs/auth'
|
import { useAuth } from '@redwoodjs/auth'
|
||||||
import { Link, routes } from '@redwoodjs/router'
|
import { Link, routes } from '@redwoodjs/router'
|
||||||
import ReactGA from 'react-ga'
|
import ReactGA from 'react-ga'
|
||||||
import Popover from '@material-ui/core/Popover'
|
import { Popover } from '@headlessui/react'
|
||||||
|
import { ImageFallback } from 'src/components/ImageUploader'
|
||||||
|
|
||||||
import useUser from 'src/helpers/hooks/useUser'
|
import useUser from 'src/helpers/hooks/useUser'
|
||||||
import LoginModal from 'src/components/LoginModal'
|
import LoginModal from 'src/components/LoginModal'
|
||||||
@@ -42,17 +43,38 @@ const ProfileSlashLogin = () => {
|
|||||||
return (
|
return (
|
||||||
<div className="flex-shrink-0">
|
<div className="flex-shrink-0">
|
||||||
{isAuthenticated ? (
|
{isAuthenticated ? (
|
||||||
<div
|
<Popover className="relative outline-none h-8 w-8">
|
||||||
className="h-8 w-8 relative text-indigo-200"
|
<Popover.Button
|
||||||
aria-describedby={popoverId}
|
disabled={!isAuthenticated || !currentUser}
|
||||||
>
|
className="h-full w-full outline-none border-ch-gray-400 border-2 rounded-full">
|
||||||
<button
|
{!loading && (
|
||||||
className="absolute inset-0 w-full h-full"
|
<ImageFallback
|
||||||
onClick={togglePopover}
|
width={80}
|
||||||
>
|
className="rounded-full object-cover"
|
||||||
{!loading && <Gravatar image={user?.image} />}
|
imageUrl={user?.image}
|
||||||
</button>
|
/>
|
||||||
</div>
|
)}
|
||||||
|
</Popover.Button>
|
||||||
|
{ currentUser && (
|
||||||
|
<Popover.Panel className="w-48 absolute z-10 right-0 bg-ch-gray-700 mt-4 px-3 py-2 rounded shadow-md overflow-hidden text-ch-gray-300">
|
||||||
|
<Link to={routes.user({ userName: user?.userName })}>
|
||||||
|
<h3 className="text-lg hover:text-ch-pink-300">
|
||||||
|
Hello {user?.name}
|
||||||
|
</h3>
|
||||||
|
</Link>
|
||||||
|
<hr className="my-2" />
|
||||||
|
<Link
|
||||||
|
className="my-2 mt-4 block hover:text-ch-pink-300"
|
||||||
|
to={routes.user({ userName: user?.userName })}>
|
||||||
|
<div>View Your Profile</div>
|
||||||
|
</Link>
|
||||||
|
<a href="#" onClick={logOut}
|
||||||
|
className="text-ch-gray-400 hover:text-ch-pink-300">
|
||||||
|
Logout
|
||||||
|
</a>
|
||||||
|
</Popover.Panel>
|
||||||
|
)}
|
||||||
|
</Popover>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
<a
|
<a
|
||||||
@@ -64,38 +86,6 @@ const ProfileSlashLogin = () => {
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{isAuthenticated && currentUser && (
|
|
||||||
<Popover
|
|
||||||
id={popoverId}
|
|
||||||
open={isOpen}
|
|
||||||
anchorEl={anchorEl}
|
|
||||||
onClose={closePopover}
|
|
||||||
anchorOrigin={{
|
|
||||||
vertical: 'bottom',
|
|
||||||
horizontal: 'right',
|
|
||||||
}}
|
|
||||||
transformOrigin={{
|
|
||||||
vertical: 'top',
|
|
||||||
horizontal: 'right',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className="p-4 w-48">
|
|
||||||
<Link to={routes.user({ userName: user?.userName })}>
|
|
||||||
<h3 className="text-indigo-800" style={{ fontWeight: '500' }}>
|
|
||||||
Hello {user?.name}
|
|
||||||
</h3>
|
|
||||||
</Link>
|
|
||||||
<hr />
|
|
||||||
<br />
|
|
||||||
<Link to={routes.user({ userName: user?.userName })}>
|
|
||||||
<div className="text-indigo-800">Your Profile</div>
|
|
||||||
</Link>
|
|
||||||
<a href="#" className="text-indigo-800" onClick={logOut}>
|
|
||||||
Logout
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</Popover>
|
|
||||||
)}
|
|
||||||
<LoginModal
|
<LoginModal
|
||||||
open={isLoginModalOpen}
|
open={isLoginModalOpen}
|
||||||
onClose={() => setIsLoginModalOpen(false)}
|
onClose={() => setIsLoginModalOpen(false)}
|
||||||
|
|||||||
Reference in New Issue
Block a user