teqo-backup/src/components/campaign/CampaignBottomNav.tsx
Francisco Ignácio Fontoura Solla cf13c441aa Remodel /campanha around predefined Praças replacing electoral nuclei.
436 seeded Praças (municipality-based; per-TSE-zone in Salvador/Camaçari) become
the operational unit; roles renamed to coordinator/advisor/leader with advisors
scoped to administered Praças. Leadership is one record per person across many
Praças/organizations; vote pledges split leader-declared vs staff-estimated
(estimates never serialized to leaders). Adds organizations, demand workflow
with staff-only cost/receipts, action-plan results with deputy presence, manual
political trend, multi-candidate comparison and the diverging red/white/blue
map mode. Migration 20260721_020109_remodel_plazas deliberately resets the
campaign vertical in production (public site untouched); test suite ported to
the new model (unit 187 / int 306 / e2e 9 green).
2026-07-21 02:28:00 -03:00

45 lines
1.5 KiB
TypeScript

'use client'
import Link from 'next/link'
import { usePathname } from 'next/navigation'
import { getCampaignBottomNav, isCampaignNavActive } from '@/components/campaign/nav'
import { cn } from '@/lib/utils'
import type { CampaignUser } from '@/payload-types'
export const CampaignBottomNav = ({ role }: { role: CampaignUser['role'] }) => {
const pathname = usePathname()
const navItems = getCampaignBottomNav(role)
return (
<nav
aria-label="Navegação principal"
className="fixed inset-x-0 bottom-0 border-t bg-background pb-[env(safe-area-inset-bottom)] md:hidden"
>
<ul
className="m-0 grid list-none p-0"
style={{ gridTemplateColumns: `repeat(${navItems.length}, minmax(0, 1fr))` }}
>
{navItems.map((item) => {
const active = isCampaignNavActive(pathname, item.href)
return (
<li key={item.href} className="m-0 p-0">
<Link
href={item.href}
aria-current={active ? 'page' : undefined}
className={cn(
'flex min-h-12 flex-col items-center justify-center gap-0.5 px-3 py-1.5 text-xs font-medium text-muted-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring',
active && 'text-primary',
)}
>
<item.icon aria-hidden="true" />
<span>{item.title}</span>
</Link>
</li>
)
})}
</ul>
</nav>
)
}