From f49e8e3c5513a29f21e8014499f8eb9bc1a2f3b2 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 1 Aug 2026 23:04:36 +0000 Subject: [PATCH] =?UTF-8?q?CL7=20=E2=80=94=20Migrar=20apoiadores=20e=20org?= =?UTF-8?q?aniza=C3=A7=C3=B5es=20para=20OpsListPage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wire LIST_UNIFIED flag on /campanha/apoiadores and /campanha/organizacoes behind OpsListPage with full slot parity (KPI overview, filters, table, footer). Registry entries were already present from CL2; this completes the route delegation. Pins CL7 routes in opsListPage.unit.spec.ts. Co-authored-by: Francisco Solla --- docs/plans/cl7-apoiadores-organizacoes.md | 2 +- .../campanha/(app)/apoiadores/page.tsx | 110 +++++++++------- .../campanha/(app)/organizacoes/page.tsx | 117 +++++++++++------- tests/unit/opsListPage.unit.spec.ts | 15 +++ 4 files changed, 152 insertions(+), 92 deletions(-) diff --git a/docs/plans/cl7-apoiadores-organizacoes.md b/docs/plans/cl7-apoiadores-organizacoes.md index b9588e44..81b58535 100644 --- a/docs/plans/cl7-apoiadores-organizacoes.md +++ b/docs/plans/cl7-apoiadores-organizacoes.md @@ -1,6 +1,6 @@ # CL7 — Migrar apoiadores e organizações para a factory -Status: rascunho +Status: entregue Atualizado em: 2026-08-01 Issue: #161 Priority: P1 diff --git a/src/app/(campaign)/campanha/(app)/apoiadores/page.tsx b/src/app/(campaign)/campanha/(app)/apoiadores/page.tsx index 09596943..e93dd00e 100644 --- a/src/app/(campaign)/campanha/(app)/apoiadores/page.tsx +++ b/src/app/(campaign)/campanha/(app)/apoiadores/page.tsx @@ -1,7 +1,3 @@ -import { - CampaignListPendingBoundary, - CampaignListResults, -} from '@/components/campaign/shared/CampaignListPending' import config from '@payload-config' import { FileUpIcon, PlusIcon, SearchXIcon } from 'lucide-react' import Link from 'next/link' @@ -10,12 +6,18 @@ import { getPayload } from 'payload' import { CampaignListEmptyState } from '@/components/campaign/shared/CampaignListEmptyState' import { CampaignListFooter } from '@/components/campaign/shared/CampaignListFooter' +import { + CampaignListPendingBoundary, + CampaignListResults, +} from '@/components/campaign/shared/CampaignListPending' import { CampaignScopeBadge } from '@/components/campaign/shared/CampaignScopeBadge' +import { OpsListPage } from '@/components/campaign/shared/OpsListPage' import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell' import { SupporterFilters } from '@/components/campaign/supporter/SupporterFilters' import { SupporterList } from '@/components/campaign/supporter/SupporterList' import { SupporterListOverview } from '@/components/campaign/supporter/SupporterListOverview' import { Button } from '@/components/ui/button' +import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag' import { isCampaignCoordinator, isCampaignUnrestricted } from '@/utilities/campaignAccess' import { readCampaignColumnVisibility } from '@/utilities/campaignColumnVisibilityCookie' import { requireCampaignPageActor } from '@/utilities/campaignPageActor' @@ -45,37 +47,65 @@ export default async function SupportersPage({ searchParams }: SupportersPagePro if (redirectHref) redirect(redirectHref) const columnVisibility = await readCampaignColumnVisibility('apoiadores') - const listBody = ( - <> - {result.docs.length > 0 && overview ? ( - - ) : null} - toSupporterListItemViewModel(supporter))} - columnVisibility={columnVisibility} - empty={ - - - - } - /> - {result.docs.length > 0 ? ( - buildSupporterListHref(state, page)} - /> - ) : null} - + const overviewNode = + result.docs.length > 0 && overview ? ( + + ) : null + + const toolbarNode = ( + + ) + + const tableNode = ( + toSupporterListItemViewModel(supporter))} + columnVisibility={columnVisibility} + empty={ + + + + } + /> + ) + + const footerNode = result.docs.length > 0 ? ( + buildSupporterListHref(state, page)} + /> + ) : null + + const main = resolveListUnifiedEnabled() ? ( + + ) : ( + + {toolbarNode} + + {overviewNode} + {tableNode} + {footerNode} + + ) return ( @@ -110,15 +140,7 @@ export default async function SupportersPage({ searchParams }: SupportersPagePro - - - - {listBody} - + {main} ) } diff --git a/src/app/(campaign)/campanha/(app)/organizacoes/page.tsx b/src/app/(campaign)/campanha/(app)/organizacoes/page.tsx index 29928f38..cd6da1d3 100644 --- a/src/app/(campaign)/campanha/(app)/organizacoes/page.tsx +++ b/src/app/(campaign)/campanha/(app)/organizacoes/page.tsx @@ -11,10 +11,12 @@ import { } from '@/components/campaign/shared/CampaignListPending' import { CampaignSearchForm } from '@/components/campaign/shared/CampaignSearchForm' import { CampaignTable, type CampaignTableColumn } from '@/components/campaign/shared/CampaignTable' +import { OpsListPage } from '@/components/campaign/shared/OpsListPage' import { CampaignPageShell } from '@/components/campaign/shell/CampaignPageShell' import { Badge } from '@/components/ui/Badge' import { Button } from '@/components/ui/button' import { organizationKindLabels } from '@/lib/schemas/organization' +import { resolveListUnifiedEnabled } from '@/lib/opsListRegistry/opsListFlag' import { readCampaignColumnVisibility } from '@/utilities/campaignColumnVisibilityCookie' import { requireCampaignPageActor } from '@/utilities/campaignPageActor' import { @@ -72,6 +74,73 @@ export default async function OrganizationsPage({ searchParams }: OrganizationsP const { rows, totalDocs, totalPages } = await loadOrganizationListPageData(payload, user, state) const columnVisibility = await readCampaignColumnVisibility('organizacoes') + const toolbarNode = ( + + ) + + const tableNode = ( + row.id} + empty={ + + + + } + /> + ) + + const footerNode = rows.length ? ( + buildOrganizationListHref(state, page)} + /> + ) : null + + const main = resolveListUnifiedEnabled() ? ( + + ) : ( + + {toolbarNode} + + {tableNode} + {footerNode} + + + ) + return (
@@ -90,53 +159,7 @@ export default async function OrganizationsPage({ searchParams }: OrganizationsP
- - - - - row.id} - empty={ - - - - } - /> - {rows.length ? ( - buildOrganizationListHref(state, page)} - /> - ) : null} - - + {main}
) } diff --git a/tests/unit/opsListPage.unit.spec.ts b/tests/unit/opsListPage.unit.spec.ts index a8038c55..a4c02572 100644 --- a/tests/unit/opsListPage.unit.spec.ts +++ b/tests/unit/opsListPage.unit.spec.ts @@ -8,7 +8,12 @@ const ROUTE_PAGES = { liderancas: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/liderancas/page.tsx'), dobradinhas: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/dobradinhas/page.tsx'), demandas: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/demandas/page.tsx'), +<<<<<<< HEAD assessores: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/assessores/page.tsx'), +======= + apoiadores: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/apoiadores/page.tsx'), + organizacoes: join(process.cwd(), 'src/app/(campaign)/campanha/(app)/organizacoes/page.tsx'), +>>>>>>> dd10d3c (CL7 — Migrar apoiadores e organizações para OpsListPage) } as const const expectOpsListPageWiring = (source: string) => { @@ -33,10 +38,20 @@ describe('OpsListPage CL4 routes', () => { ) }) +<<<<<<< HEAD describe('OpsListPage assessores (CL5)', () => { it('wires LIST_UNIFIED behind OpsListPage on the assessores route', () => { const source = readFileSync(ROUTE_PAGES.assessores, 'utf8') expectOpsListPageWiring(source) expect(source).toContain('resolveAdvisorListUrl') }) +======= +describe('OpsListPage CL7 routes', () => { + it.each(['apoiadores', 'organizacoes'] as const)( + 'wires LIST_UNIFIED behind OpsListPage on the %s route', + (route) => { + expectOpsListPageWiring(readFileSync(ROUTE_PAGES[route], 'utf8')) + }, + ) +>>>>>>> dd10d3c (CL7 — Migrar apoiadores e organizações para OpsListPage) })