()
| 24 | } |
| 25 | |
| 26 | export default function NavBar() { |
| 27 | const navItems = [ |
| 28 | { |
| 29 | name: "首页", |
| 30 | path: "/", |
| 31 | }, { |
| 32 | name: "申请季数据汇总", |
| 33 | path: "/datapoints", |
| 34 | }, { |
| 35 | name: "项目信息表", |
| 36 | path: "/programs", |
| 37 | }, { |
| 38 | name: "经验分享帖", |
| 39 | path: "/posts", |
| 40 | }, { |
| 41 | name: "帮助中心", |
| 42 | path: "/FAQ", |
| 43 | } |
| 44 | ] |
| 45 | const routeMatch = useRouteMatch(navItems.map((item) => item.path)); |
| 46 | const currentTab = routeMatch ?? false; |
| 47 | |
| 48 | if (!useUser()) { |
| 49 | return null; |
| 50 | } |
| 51 | return ( |
| 52 | <Tabs |
| 53 | value={currentTab} |
| 54 | variant="scrollable" |
| 55 | scrollButtons |
| 56 | allowScrollButtonsMobile |
| 57 | role="navigation" |
| 58 | > |
| 59 | {navItems.map((item, index) => ( |
| 60 | <Tab |
| 61 | key={index} |
| 62 | label={item.name} |
| 63 | value={item.path} |
| 64 | to={item.path} |
| 65 | component={Link} |
| 66 | /> |
| 67 | ))} |
| 68 | </Tabs> |
| 69 | ); |
| 70 | } |
nothing calls this directly
no test coverage detected