diff --git a/web/app/components/main-nav/__tests__/layout.spec.tsx b/web/app/components/main-nav/__tests__/layout.spec.tsx
index 4937f4e9270..cd8432b762c 100644
--- a/web/app/components/main-nav/__tests__/layout.spec.tsx
+++ b/web/app/components/main-nav/__tests__/layout.spec.tsx
@@ -196,6 +196,31 @@ describe('MainNavLayout', () => {
expect(screen.getByRole('main')).toHaveTextContent('new knowledge detail')
})
+ it('hides the global main nav on a skill detail route', () => {
+ ;(usePathname as Mock).mockReturnValue('/skills/skill-1')
+
+ render(
+
+ skill detail
+ ,
+ )
+
+ expect(screen.queryByTestId('main-nav')).not.toBeInTheDocument()
+ expect(screen.getByRole('main')).toHaveTextContent('skill detail')
+ })
+
+ it('keeps the global main nav on the skills collection route', () => {
+ ;(usePathname as Mock).mockReturnValue('/skills')
+
+ render(
+
+ skills collection
+ ,
+ )
+
+ expect(screen.getByTestId('main-nav')).toBeInTheDocument()
+ })
+
it.each([
'/datasets/create',
'/datasets/new/create',
diff --git a/web/app/components/main-nav/routes.ts b/web/app/components/main-nav/routes.ts
index 2aaed683ace..a3506c3aecf 100644
--- a/web/app/components/main-nav/routes.ts
+++ b/web/app/components/main-nav/routes.ts
@@ -151,14 +151,21 @@ function isDatasetDetailPathname(pathname: string) {
return true
}
+function isSkillDetailPathname(pathname: string) {
+ const [section, skillId] = pathname.split('/').filter(Boolean)
+
+ return section === 'skills' && !!skillId
+}
+
export function shouldHideMainNavigation(pathname: string) {
const [section, namespace, knowledgeSpaceId] = pathname.split('/').filter(Boolean)
return (
- section === 'datasets' &&
- namespace === 'new' &&
- !!knowledgeSpaceId &&
- knowledgeSpaceId !== 'create'
+ (section === 'datasets' &&
+ namespace === 'new' &&
+ !!knowledgeSpaceId &&
+ knowledgeSpaceId !== 'create') ||
+ isSkillDetailPathname(pathname)
)
}