From ac5d846c44b5ee87c24c690d0dd1a15bc3847090 Mon Sep 17 00:00:00 2001 From: Charles Zhao Date: Mon, 3 Jun 2024 20:15:30 +0800 Subject: [PATCH] refactor(console): click console logo should navigate to root page (#5981) --- packages/console/src/components/Topbar/index.module.scss | 1 + packages/console/src/components/Topbar/index.tsx | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/console/src/components/Topbar/index.module.scss b/packages/console/src/components/Topbar/index.module.scss index 583f80fed..4946b7d32 100644 --- a/packages/console/src/components/Topbar/index.module.scss +++ b/packages/console/src/components/Topbar/index.module.scss @@ -11,6 +11,7 @@ width: auto; height: 28px; color: var(--color-text); + cursor: pointer; } .line { diff --git a/packages/console/src/components/Topbar/index.tsx b/packages/console/src/components/Topbar/index.tsx index 3ce526724..dbce591d5 100644 --- a/packages/console/src/components/Topbar/index.tsx +++ b/packages/console/src/components/Topbar/index.tsx @@ -14,6 +14,7 @@ import DynamicT from '@/ds-components/DynamicT'; import Spacer from '@/ds-components/Spacer'; import TextLink from '@/ds-components/TextLink'; import useDocumentationUrl from '@/hooks/use-documentation-url'; +import useTenantPathname from '@/hooks/use-tenant-pathname'; import { onKeyDownHandler } from '@/utils/a11y'; import ContactModal from './ContactModal'; @@ -32,11 +33,17 @@ type Props = { function Topbar({ className, hideTenantSelector, hideTitle }: Props) { const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); + const { navigate } = useTenantPathname(); const LogtoLogo = isCloud ? CloudLogo : Logo; return (
- + { + navigate('/'); + }} + /> {isCloud && !hideTenantSelector && } {!isCloud && !hideTitle && ( <>