diff --git a/webui/src/components/Header/Header.tsx b/webui/src/components/Header/Header.tsx index 3064f6e458d8a0ac3ebad6ae83ab52aaf22b2d33..864b2c398f3e26e3c60512038ddf2f6c3835f659 100644 --- a/webui/src/components/Header/Header.tsx +++ b/webui/src/components/Header/Header.tsx @@ -67,14 +67,23 @@ const DisabledTabWithTooltip = (props: TabProps) => { function Header() { const classes = useStyles(); const location = useLocation(); - const [selectedTab, setTab] = React.useState(location.pathname); - const handleTabClick = ( - event: React.ChangeEvent<{}>, - newTabValue: string - ) => { - setTab(newTabValue); - }; + // Prevents error of invalid tab selection in + function highlightTab() { + switch (location.pathname) { + case '/': + return '/'; + case '/code': + return '/code'; + case '/pulls': + return '/pulls'; + case '/settings': + return '/settings'; + default: + // using false as value for tabs will result in no selected tab + return false; + } + } return ( <> @@ -92,12 +101,7 @@ function Header() {
- +