Skip to main content

Navigation Feature Reference

Layout structure

  • frontend/src/layouts/SidebarLayout/index.js:20 is the root shell for authenticated routes, orchestrating header, sidebar, footer and socket listeners.
  • The sidebar itself lives in frontend/src/layouts/SidebarLayout/Sidebar/index.js:17, wrapping SidebarMenu in a scrollable drawer.
  • Favourites and recents are fetched via frontend/src/components/ClubFavList/index.js:42 (GET /u/cbfav) with removal handled at line 72 (POST /u/cbfavrem/:cid).

Search and quick actions

  • frontend/src/layouts/SidebarLayout/Header/HeaderButtons/HeaderSearch/index.js:74 debounces lookups to GET /s/cbustp/{query} (see backend/r/search.js:61) so clubs, topics and users are returned in one payload.
  • Header badges fetch aggregated counts from GET /n/notiusercountnew using the polling loop in frontend/src/layouts/SidebarLayout/Header/HeaderButtons/index.js:44.

Home feed

  • frontend/src/components/PostsHome/index.js:91 pages through GET /home?skip={n}; the route is protected by backend/r/homepage.js:13 and handled by postController.getPostsHomePage.
  • New posts, edits and deletions propagate through jotai atoms (newPostAtom, delPostAtom) consumed inside PostsHome, keeping the timeline reactive.

State hydration

  • On layout mount the auth slice is read from local storage and verifyTokenService (see frontend/src/context/authContext/actions/authActions.js:337) refreshes user settings, ensuring the sidebar lists remain in sync with the server.
  • Socket listeners in the layout increment unread chat counts unless the /chat/{id} route is active, avoiding double notifications.