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

@@ -1,6 +1,7 @@
import { Link, useNavigate } from '@tanstack/react-router'
import { ArrowLeft, BarChart3, Share2, UserPlus } from 'lucide-react'
import { Badge, Button, Tooltip } from '../../../components/ui'
import { LargeTitle } from '../../../components/layout/LargeTitle'
import { cn } from '../../../lib/utils'
import { RISK_HINT, RISK_LABELS } from '../constants'
import { useGroupDetail } from './GroupDetailProvider'
@@ -30,27 +31,21 @@ export function GroupHeader() {
return (
<div>
<Link
to="/groups"
className="mb-3 hidden items-center gap-1 text-sm text-foreground/80 transition-colors hover:text-primary lg:inline-flex"
<LargeTitle
title={group?.name ?? ''}
leading={
<Link
to="/groups"
className="hidden shrink-0 items-center gap-1 text-sm text-foreground/80 transition-colors hover:text-primary lg:inline-flex"
>
<ArrowLeft className="size-4" />
<span>Volver a grupos</span>
</Link>
}
>
<ArrowLeft className="size-4" />
<span>Volver a grupos</span>
</Link>
{/* El título se queda con el ancho completo: los estados bajan a su propia
fila compacta en vez de competir con el nombre por el espacio. */}
<div className="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-6">
<div className="min-w-0 sm:max-w-2xl">
<h1 className="text-balance text-2xl font-bold leading-tight text-primary sm:text-[1.75rem]">
{group?.name}
</h1>
{group?.description ? (
<p className="mt-1.5 text-sm leading-relaxed text-foreground/80">{group.description}</p>
) : null}
</div>
<div className="flex flex-wrap items-center gap-2 sm:shrink-0 sm:justify-end">
{/* Los estados cuelgan del título y no de la barra: en la barra
colapsada solo va el nombre, que es lo que se usa para orientarse. */}
<div className="mt-3 flex flex-wrap items-center gap-2">
<Badge variant="success" className="gap-1.5 text-[11px]">
<span className="size-1.5 rounded-full bg-success" aria-hidden="true" />
Activo
@@ -75,7 +70,13 @@ export function GroupHeader() {
</Tooltip>
) : null}
</div>
</div>
{group?.description ? (
<p className="mt-2 text-pretty text-sm leading-relaxed text-foreground/80">
{group.description}
</p>
) : null}
</LargeTitle>
<div className="mt-4 grid grid-cols-2 gap-2.5 sm:mt-5 sm:flex sm:flex-wrap sm:items-center sm:justify-end sm:gap-2.5">
{/* `h-11` (44px) para todos: objetivo táctil mínimo. */}