Skip to content

Commit

Permalink
fix: hide sign in
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Nov 7, 2023
1 parent 5ec1ae0 commit 211f951
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions src/components/layout/header/internal/UserAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,21 @@ import dynamic from 'next/dynamic'
import { usePathname } from 'next/navigation'

import { getAdminUrl, useIsLogged } from '~/atoms'
import { UserArrowLeftIcon } from '~/components/icons/user-arrow-left'
import { MotionButtonBase } from '~/components/ui/button'
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'

const UserAuthFromIcon = dynamic(() =>
import('./UserAuthFromIcon').then((mod) => mod.UserAuthFromIcon),
)

const SignedIn = dynamic(() =>
import('@clerk/nextjs').then((mod) => mod.SignedIn),
)
const SignedOut = dynamic(() =>
import('@clerk/nextjs').then((mod) => mod.SignedOut),
)

const UserButton = dynamic(() =>
import('@clerk/nextjs').then((mod) => mod.UserButton),
)
const SignInButton = dynamic(() =>
import('@clerk/nextjs').then((mod) => mod.SignInButton),
)

const OwnerAvatar = () => {
const ownerAvatar = useAggregationSelector((s) => s.user.avatar)!
Expand Down Expand Up @@ -74,26 +65,6 @@ export function UserAuth() {
</div>
</div>
</SignedIn>
<SignedOut key="sign-in">
<FloatPopover
TriggerComponent={TriggerComponent}
wrapperClassName="h-full w-full flex items-center justify-center"
type="tooltip"
>
登录
</FloatPopover>
</SignedOut>
</AnimatePresence>
)
}

const TriggerComponent = () => {
const pathname = usePathname()
return (
<SignInButton mode="modal" redirectUrl={urlBuilder(pathname).href}>
<HeaderActionButton aria-label="Guest Login">
<UserArrowLeftIcon className="h-4 w-4" />
</HeaderActionButton>
</SignInButton>
)
}

1 comment on commit 211f951

@vercel
Copy link

@vercel vercel bot commented on 211f951 Nov 7, 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
shiro-innei.vercel.app
innei.in
springtide.vercel.app

Please sign in to comment.