teqo-backup/src/components/campaign/activity/AgendaPeriodChrome.tsx
Francisco Solla f3c41d3382 feat(C101-ux): agenda mobile — navegação por teclado (região focável) + affordance do tap no título
- useAgendaKeyboardNavigation: ArrowLeft/Right → prev/next no mobile
  (FullCalendar v7 não tem setas no grid — verificado no bundle); skips
  para modificadores/dialog/menu/inputs; restore de foco na região
- Região de teclado mobile-only: tabIndex/role/aria-label gateados por
  isMobile (desktop mantém a toolbar e sua árvore a11y intacta)
- onTitleClick ganha icon?: LucideIcon (glyph da página, aria-hidden);
  agenda passa RotateCcw como affordance do 'voltar para hoje'
- E2E: teste de teclado (dia e mês), glyph no título, hardening do swipe
  CDP (pacing 25ms — burst era classificado como flick pelo Chromium e
  disparava back-nav ~35% das runs)
- Unit: 14 testes do hook/pura + 4 do renderer do glyph; impl plan
  docs/plans/c101-ux-pos-critique-impl.md (aprovado pelo humano)

Closes #512
2026-08-10 00:53:19 -03:00

39 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use client'
import { RotateCcw } from 'lucide-react'
import { useMemo } from 'react'
import { SetCampaignPageChrome } from '@/components/campaign/shell/CampaignPageChromeContext'
/**
* C101 — agenda page → app header bridge for the period context: while the
* mobile calendar navigates, the top bar title shows the visible period
* ("9 Agosto", "3–9 Agosto", "Agosto") instead of the catalog "Agenda", and
* tapping it returns to today (the "Hoje" toolbar button is hidden on
* phones). Desktop never mounts this — the agenda only renders it when the
* mobile top bar is the visible chrome.
* C101-ux — the tap affordance: the RotateCcw glyph (aria-hidden in the
* shared chrome) signals the title is tappable without a hover-only tooltip.
*/
export const AgendaPeriodChrome = ({
label,
onToday,
}: {
label: string | null
onToday: () => void
}) => {
const chrome = useMemo(
() =>
label
? {
title: label,
onTitleClick: { action: onToday, hint: 'Voltar para hoje', icon: RotateCcw },
}
: null,
[label, onToday],
)
if (!chrome) return null
return <SetCampaignPageChrome chrome={chrome} />
}