Skip to content

Commit c71a516

Browse files
Merge pull request #361 from topcoder-platform/PROD-2008_toolselectornarrow-subroutes
PROD-2008 - hide param routes in ToolSelector narrow
2 parents 75833fb + 8a16c0b commit c71a516

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src-ts/header/tool-selectors/tool-selectors-narrow/tool-selector-narrow/ToolSelectorNarrow.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ interface ToolSelectorNarrowProps {
1010
route: PlatformRoute
1111
}
1212

13+
const isParamRoute: (route: string) => boolean = (route: string) => !!route.match(/^:[^/]+$/)
14+
1315
const ToolSelectorNarrow: FC<ToolSelectorNarrowProps> = (props: ToolSelectorNarrowProps) => {
1416

1517
const route: PlatformRoute = props.route
@@ -18,7 +20,7 @@ const ToolSelectorNarrow: FC<ToolSelectorNarrowProps> = (props: ToolSelectorNarr
1820
const baseClass: string = 'tool-selector-narrow'
1921
const isActive: boolean = routeIsActive(useLocation().pathname, path)
2022
const activeIndicaterClass: string = `${baseClass}-${isActive ? '' : 'in'}active`
21-
const hasChildren: boolean = !!route.children.some(child => !!child.route)
23+
const hasChildren: boolean = !!route.children.some(child => !!child.route && !isParamRoute(child.route))
2224

2325
return (
2426
<div className={styles[baseClass]}>

0 commit comments

Comments
 (0)