teqo-backup/src/components/campaign/UpcomingActionPlansCard.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

60 lines
2.1 KiB
TypeScript

import { ArrowRightIcon } from 'lucide-react'
import Link from 'next/link'
import { Badge } from '@/components/ui/Badge'
import { Button } from '@/components/ui/button'
import { Card, CardAction, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
import { actionPlanKindLabels } from '@/lib/schemas/actionPlan'
import { cn } from '@/lib/utils'
import type { ActionPlanUpcomingPreviewRecord } from '@/utilities/actionPlanUpcomingPreview'
import { formatBahiaDateTimeLabel } from '@/utilities/campaignTime'
export const UpcomingActionPlansCard = ({
plans,
className,
}: {
plans: ActionPlanUpcomingPreviewRecord[]
className?: string
}) => (
<Card className={cn('flex h-full flex-col', className)}>
<CardHeader>
<CardTitle>Próximos eventos</CardTitle>
<CardAction>
<Button asChild variant="ghost" size="sm" className="min-h-11">
<Link href="/campanha/planos">
Ver todos
<ArrowRightIcon data-icon="inline-end" aria-hidden="true" />
</Link>
</Button>
</CardAction>
</CardHeader>
<CardContent className="flex-1">
{plans.length ? (
<ul className="m-0 flex list-none flex-col gap-2 p-0">
{plans.map((plan) => (
<li
key={plan.id}
className="flex flex-col gap-1 border-b pb-2 last:border-b-0 last:pb-0"
>
<div className="flex flex-wrap items-center gap-2">
<Badge variant="secondary">{actionPlanKindLabels[plan.kind]}</Badge>
<span className="text-sm text-muted-foreground">
{formatBahiaDateTimeLabel(plan.startAt)}
{plan.plazaName ? ` · ${plan.plazaName}` : ''}
</span>
</div>
<Link
href={`/campanha/planos/${plan.slug}`}
className="text-sm text-primary underline-offset-4 hover:underline"
>
{plan.title}
</Link>
</li>
))}
</ul>
) : (
<p className="text-sm text-muted-foreground">Nenhum evento agendado</p>
)}
</CardContent>
</Card>
)