({ children }: NavWrapperProps)
| 27 | |
| 28 | /** Wraps the entire app and adds a navbar at the bottom or the top */ |
| 29 | export function NavWrapper({ children }: NavWrapperProps): JSX.Element { |
| 30 | const { navbarTop, navbarFloating } = useSettings(); |
| 31 | const contentRef = React.useRef(null); |
| 32 | const location = useLocation(); |
| 33 | |
| 34 | useEffect(() => { |
| 35 | contentRef?.current?.scrollTo(0, 0); |
| 36 | }, [location]); |
| 37 | |
| 38 | return ( |
| 39 | <> |
| 40 | {navbarTop && <NavBar />} |
| 41 | <SideBarWrapper> |
| 42 | <SideBar /> |
| 43 | <Content |
| 44 | ref={contentRef} |
| 45 | navbarTop={navbarTop} |
| 46 | navbarFloating={navbarFloating} |
| 47 | > |
| 48 | {children} |
| 49 | </Content> |
| 50 | </SideBarWrapper> |
| 51 | {!navbarTop && <NavBar />} |
| 52 | </> |
| 53 | ); |
| 54 | } |
| 55 | |
| 56 | interface ContentProps { |
| 57 | navbarTop: boolean; |
nothing calls this directly
no test coverage detected