Skip to content

Commit

Permalink
feat: show site avatar if logged
Browse files Browse the repository at this point in the history
  • Loading branch information
Innei committed Jul 22, 2023
1 parent b3d834c commit d14362d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/components/layout/header/internal/UserAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import { AnimatePresence } from 'framer-motion'
import dynamic from 'next/dynamic'
import { usePathname } from 'next/navigation'

import { useIsLogged } from '~/atoms'
import { UserArrowLeftIcon } from '~/components/icons/user-arrow-left'
import { FloatPopover } from '~/components/ui/float-popover'
import { urlBuilder } from '~/lib/url-builder'
import { useAggregationSelector } from '~/providers/root/aggregation-data-provider'

import { HeaderActionButton } from './HeaderActionButton'

Expand All @@ -28,9 +30,24 @@ const SignInButton = dynamic(() =>
import('@clerk/nextjs').then((mod) => mod.SignInButton),
)

const OwnerAvatar = () => {
const ownerAvatar = useAggregationSelector((s) => s.user.avatar)!

return (
<div className="pointer-events-auto flex h-10 w-10 items-center justify-center overflow-hidden rounded-full">
<img src={ownerAvatar} alt="site owner" />
</div>
)
}
export function UserAuth() {
const pathname = usePathname()

const isLogged = useIsLogged()

if (isLogged) {
return <OwnerAvatar />
}

return (
<AnimatePresence>
<SignedIn key="user-info">
Expand Down

1 comment on commit d14362d

@vercel
Copy link

@vercel vercel bot commented on d14362d Jul 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

shiro – ./

shiro-git-main-innei.vercel.app
springtide.vercel.app
shiro-innei.vercel.app
innei.in

Please sign in to comment.