The Navbar is a fixed left-sidebar navigation component rendered insideDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Avendaosander/Plataforma-social/llms.txt
Use this file to discover all available pages before exploring further.
app/home/layout.tsx. It provides primary navigation links, a collapsible notification panel, a user menu (“Mas”) with secondary actions, and a dark mode toggle. Every /home/* page (except /home/my-profile/settings) displays the Navbar on the left edge of the viewport.
Rendering Context
The Navbar is mounted once inside the home layout’s<aside> element:
"use client" component, it has full access to React state, browser events, and Next.js client-side hooks (usePathname, useRouter).
The Navbar is hidden on the
/home/my-profile/settings route. This is implemented directly in the component: when pathname === '/home/my-profile/settings' the outermost <section> receives the hidden Tailwind class, giving the settings page full horizontal space.Navigation Links
Above the primary nav, the sidebar has a logo button (“UVM Dev House”) rendered withHomeIcon at large size. This button uses the same widthCondition sizing as the nav links and collapses to icon-only mode when the notification panel is open.
The primary <nav> lists six items. Each link is a Next.js <Link> wrapping a <Button> component. The active link is highlighted with bg-lima-400/30 dark:bg-biscay-950 background classes. The current pathname is detected with usePathname() from next/navigation.
| Label | Icon | Route | Description |
|---|---|---|---|
| Para ti | HomeIcon | /home | Main “for you” feed — all public posts. |
| Siguiendo | UserCheck | /home/followers | Posts from users the current user follows. |
| Populares | TrendingIcon | /home/trending | Trending / most-popular components. Note: the active-state check in the source currently compares against "/home?page=trending" rather than "/home/trending", so the active highlight does not fire on this route. |
| Buscar | SearchIcon | /home/search | Search results page with filter panel. |
| Notificaciones | BellIcon | (no href — toggles panel) | Toggles the notifications side panel. |
| Perfil | UserIcon | /home/my-profile | Current user’s profile page. |
pathname matches the link’s route:
Collapse Behavior (Notification Panel Open)
When the notification panel is open (notifyOpen === true), the Navbar collapses to icon-only mode. Every link button shrinks from w-full to w-auto h-11, and all text labels are hidden using a conditional expression directly in JSX:
widthCondition variable drives the button sizing:
Notifications Panel
Clicking the Notificaciones button (BellIcon) callsnotifyHandle(), which flips the notifyOpen state boolean. When open, a panel is rendered immediately to the right of the sidebar:
left-full (immediately right of the sidebar column), is 300px wide, and spans the full viewport height. It uses text-storm-100 for its text and bg-seagreen-900 (light mode) / dark:bg-storm-950 (dark mode) backgrounds.
Clicking anywhere outside the panel closes it. The Navbar registers a "click" event listener in a useEffect that checks whether the click target is outside the #notify element and sets notifyOpen to false if so. The same pattern applies to the “Mas” user menu (#main).
User Menu (“Mas”)
The Mas button at the bottom of the sidebar (MenuIcon) toggles amainActive state boolean. When active, a popover appears just above the button:
| Item | Icon | Action |
|---|---|---|
| Configuraciones | SettingsIcon | Navigate to /home/my-profile/settings |
| Guardados | BookmarksIcon | Navigate to /home/my-profile?bookmarks |
| (Dark mode toggle) | — | Renders <ButtonDarkMode /> inline |
| Salir | LogoutIcon | Calls the logout() function |
Logout
The logout flow uses NextAuth’ssignOut with redirect: false so the redirect URL can be handled programmatically by the router:
signOut returns an object containing the resolved callbackUrl. The component then uses router.push(data.url) to navigate to /login after the session is cleared, giving the client-side router control over the transition instead of a hard browser redirect.
Dark Mode Toggle
The<ButtonDarkMode /> component is rendered inside the “Mas” user menu. It is a self-contained client component that reads and writes localStorage to persist the dark mode preference across page loads.
Dark mode in Plataforma Social is class-based: toggling it adds or removes the dark class directly on document.documentElement (the <html> element). The component tracks its own isDarkMode boolean state, initialized from localStorage.getItem('darkMode') on first render:
| State | Label | Icon |
|---|---|---|
| Dark mode off | Modo Claro | LightIcon |
| Dark mode on | Modo Oscuro | MoonIcon |
useEffect ensures document.documentElement stays in sync with the isDarkMode state value whenever it changes.
SwitchButton Component
SwitchButton is a small custom toggle used on the /home/my-profile/settings page for privacy and notification preferences. It renders a pill-shaped toggle track with a sliding white knob:
translate-x-6) when checked is true (active) and returns to the left (translate-x-0) when false. The track background switches between seagreen-900 (on) and storm-950 (off). Each SwitchButton instance manages its own independent state — there is no shared store or form submission wired up yet.
Custom Color Palette
The Navbar uses several custom Tailwind color tokens defined in the project’s theme:| Token | Usage |
|---|---|
seagreen-900 | Navbar background (light mode), notification panel background, “Mas” popover background |
lima-400 | Active and hover tint for navigation links (bg-lima-400/30, bg-lima-400/50) |
biscay-950 | Dark mode active link background |
biscay-900 | Dark mode hover background for links |
storm-950 | Dark mode notification panel background |
storm-100 | Notification panel text color |
storm-900 | Dark mode “Mas” popover background |
Settings Page Visibility
The Navbar hides itself entirely when the user is on/home/my-profile/settings. The check runs on every render using the live pathname value from usePathname():
Because the settings layout has its own back-navigation button (an
ArrowLeft button positioned at right-full of the content area), hiding the Navbar prevents layout overlap and provides the settings page with a clean full-width experience.