From 95bde28caba9a3dd7cab66502a577c0b68d93853 Mon Sep 17 00:00:00 2001 From: Innei Date: Tue, 25 Jul 2023 16:42:14 +0800 Subject: [PATCH] feat: go to dashboard --- .../layout/header/internal/UserAuth.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/layout/header/internal/UserAuth.tsx b/src/components/layout/header/internal/UserAuth.tsx index 42e8d4343e..f9d1cc12de 100644 --- a/src/components/layout/header/internal/UserAuth.tsx +++ b/src/components/layout/header/internal/UserAuth.tsx @@ -5,8 +5,9 @@ import { AnimatePresence } from 'framer-motion' import dynamic from 'next/dynamic' import { usePathname } from 'next/navigation' -import { useIsLogged } from '~/atoms' +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' @@ -34,9 +35,17 @@ const OwnerAvatar = () => { const ownerAvatar = useAggregationSelector((s) => s.user.avatar)! return ( -
+ { + const adminUrl = getAdminUrl() + if (!adminUrl) return + window.open(adminUrl, '_blank') + }} + className="pointer-events-auto flex h-10 w-10 items-center justify-center overflow-hidden rounded-full" + > + Go to dashboard site owner -
+ ) } export function UserAuth() {