feat: implement immersive routes with Large Title component

- Added Large Title component to manage immersive screen headers.
- Created ImmersiveBarProvider to handle the sticky bar for immersive routes.
- Updated RootLayout to conditionally render Header based on immersive routes.
- Modified Sidebar to adjust its position and height in immersive mode.
- Integrated Large Title in ClassAttendanceView and AnalyticsView for consistent header display.
- Updated GroupHeader to use Large Title for better layout management.
- Implemented isImmersiveRoute function to determine immersive routes.
- Added tests for immersive route detection.
This commit is contained in:
Jose Selesan
2026-09-29 21:23:56 -03:00
parent 81ed5747f3
commit 581cf2f2b2
13 changed files with 516 additions and 163 deletions

View File

@@ -0,0 +1,33 @@
/* Rutas "immersive": las que arman su propia barra de navegación con
`LargeTitle` (título grande que colapsa) y por eso no muestran el header
global con logo + toggle de tema + avatar.
El patrón se resuelve a mano y no con `matchRoute` porque las dos rutas
llevan parámetros (`matchRoute` los exige) y porque las rutas hijas NO son
immersive aunque compartan prefijo: `/groups/:id/attendees/new` sigue usando
el header global. */
const IMMERSIVE_SEGMENTS: ReadonlyArray<readonly string[]> = [
['groups', ':id'],
['groups', ':id', 'analytics'],
['class', ':id', 'attendance'],
]
/* Rutas estáticas que ocupan el lugar de un parámetro. Sin esta lista
`/groups/new` (crear grupo) se tomaría por una ficha de grupo y perdería el
header global. */
const STATIC_SEGMENTS: ReadonlySet<string> = new Set(['new'])
export function isImmersiveRoute(pathname: string) {
const segments = pathname.split('/').filter(Boolean)
return IMMERSIVE_SEGMENTS.some(
(pattern) =>
pattern.length === segments.length &&
pattern.every((part, index) => {
const segment = segments[index]
if (part.startsWith(':')) return !STATIC_SEGMENTS.has(segment)
return part === segment
}),
)
}