mirror of
https://github.com/fsolla/teqo.git
synced 2026-12-02 13:13:06 +00:00
Pass 2 W4f: varredura de copy Praca -> Municipio
- ~70 strings visiveis + labels de admin (headers de coluna, APIErrors, empty states, dashboard, mapa, formularios, filtros) com concordancia de genero corrigida
- apoiadores desambiguado: cidade do contato vira 'Cidade'; a unidade operacional assume 'Municipio' (filtro, coluna, ficha)
- comentarios de codigo atualizados; payload-types regenerado
- fora por decisao D6: textos provisorios de consent do Onda 0 (lote juridico) e migrations congeladas
- e2e do plano de acao acompanha o label ('Municipio *')
This commit is contained in:
parent
11d3fcd24c
commit
e357c3cc19
51 changed files with 93 additions and 93 deletions
|
|
@ -72,7 +72,7 @@ export default async function SupporterDetailPage({ params }: SupporterDetailPag
|
||||||
<CampaignScopeBadge>{campaignRoleLabels[user.role]}</CampaignScopeBadge>
|
<CampaignScopeBadge>{campaignRoleLabels[user.role]}</CampaignScopeBadge>
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">{supporter.name}</h1>
|
<h1 className="text-2xl font-semibold tracking-tight">{supporter.name}</h1>
|
||||||
<p className="text-muted-foreground">
|
<p className="text-muted-foreground">
|
||||||
{supporter.city ?? 'Município não informado'}
|
{supporter.city ?? 'Cidade não informada'}
|
||||||
{supporter.territory ? ` · ${supporter.territory}` : ''}
|
{supporter.territory ? ` · ${supporter.territory}` : ''}
|
||||||
</p>
|
</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
@ -109,7 +109,7 @@ export default async function SupporterDetailPage({ params }: SupporterDetailPag
|
||||||
<p>
|
<p>
|
||||||
{supporter.municipalityName ? (
|
{supporter.municipalityName ? (
|
||||||
<>
|
<>
|
||||||
Praça:{' '}
|
Município:{' '}
|
||||||
<Link
|
<Link
|
||||||
href={`/campanha/municipios/${supporter.municipalitySlug}`}
|
href={`/campanha/municipios/${supporter.municipalitySlug}`}
|
||||||
className="font-medium text-primary underline-offset-4 hover:underline"
|
className="font-medium text-primary underline-offset-4 hover:underline"
|
||||||
|
|
@ -118,7 +118,7 @@ export default async function SupporterDetailPage({ params }: SupporterDetailPag
|
||||||
</Link>
|
</Link>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<span className="text-muted-foreground">Sem Praça vinculada</span>
|
<span className="text-muted-foreground">Sem município vinculado</span>
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ export type SupporterFormValues = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const safeActionMessages = [
|
const safeActionMessages = [
|
||||||
'Esta pessoa já está cadastrada como apoiador nesta Praça.',
|
'Esta pessoa já está cadastrada como apoiador neste município.',
|
||||||
'Existe mais de um contato com este celular. Resolva a duplicidade no admin antes de continuar.',
|
'Existe mais de um contato com este celular. Resolva a duplicidade no admin antes de continuar.',
|
||||||
'Somente a coordenação e a assessoria podem gerenciar apoiadores.',
|
'Somente a coordenação e a assessoria podem gerenciar apoiadores.',
|
||||||
'Somente o Coordenador Geral pode cadastrar apoiadores sem município.',
|
'Somente o Coordenador Geral pode cadastrar apoiadores sem município.',
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ export default async function SupportersPage({ searchParams }: SupportersPagePro
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">Apoiadores</h1>
|
<h1 className="text-2xl font-semibold tracking-tight">Apoiadores</h1>
|
||||||
<p className="text-muted-foreground">
|
<p className="text-muted-foreground">
|
||||||
Base nominal de apoio com intenção de voto e vínculo opcional a Praças.
|
Base nominal de apoio com intenção de voto e vínculo opcional a municípios.
|
||||||
</p>
|
</p>
|
||||||
<CampaignScopeBadge>
|
<CampaignScopeBadge>
|
||||||
{isCampaignUnrestricted(user)
|
{isCampaignUnrestricted(user)
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ export default async function NewDemandPage({ searchParams }: NewDemandPageProps
|
||||||
</Button>
|
</Button>
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">Nova demanda</h1>
|
<h1 className="text-2xl font-semibold tracking-tight">Nova demanda</h1>
|
||||||
<p className="text-muted-foreground">
|
<p className="text-muted-foreground">
|
||||||
Descreva a necessidade (material, transporte, espaço, apoio…) e a Praça. A assessoria
|
Descreva a necessidade (material, transporte, espaço, apoio…) e o município. A assessoria
|
||||||
revisa e responde por aqui.
|
revisa e responde por aqui.
|
||||||
</p>
|
</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ const demandColumns: Array<CampaignTableColumn<DemandRowViewModel>> = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'municipality',
|
id: 'municipality',
|
||||||
head: <CampaignTableHead>Praça</CampaignTableHead>,
|
head: <CampaignTableHead>Município</CampaignTableHead>,
|
||||||
cellClassName: 'text-muted-foreground',
|
cellClassName: 'text-muted-foreground',
|
||||||
cell: (row) => row.municipalityName,
|
cell: (row) => row.municipalityName,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ const leadershipColumns: Array<CampaignTableColumn<LeadershipRowViewModel>> = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'municipalities',
|
id: 'municipalities',
|
||||||
head: <CampaignTableHead>Praças</CampaignTableHead>,
|
head: <CampaignTableHead>Municípios</CampaignTableHead>,
|
||||||
cellClassName: 'max-w-64 whitespace-normal text-muted-foreground',
|
cellClassName: 'max-w-64 whitespace-normal text-muted-foreground',
|
||||||
cell: (row) => row.municipalityNames.join(', ') || '—',
|
cell: (row) => row.municipalityNames.join(', ') || '—',
|
||||||
},
|
},
|
||||||
|
|
@ -90,7 +90,7 @@ export default async function LeadershipsPage({ searchParams }: LeadershipsPageP
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">Lideranças</h1>
|
<h1 className="text-2xl font-semibold tracking-tight">Lideranças</h1>
|
||||||
<p className="text-muted-foreground">
|
<p className="text-muted-foreground">
|
||||||
Uma ficha por pessoa — cada liderança pode atuar em várias Praças e organizações.
|
Uma ficha por pessoa — cada liderança pode atuar em vários municípios e organizações.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<Button asChild className="min-h-11">
|
<Button asChild className="min-h-11">
|
||||||
|
|
@ -126,7 +126,7 @@ export default async function LeadershipsPage({ searchParams }: LeadershipsPageP
|
||||||
<CampaignListEmptyState
|
<CampaignListEmptyState
|
||||||
icon={SearchXIcon}
|
icon={SearchXIcon}
|
||||||
title="Nenhuma liderança encontrada"
|
title="Nenhuma liderança encontrada"
|
||||||
description="Cadastre a primeira liderança ou ajuste a busca. Você só vê lideranças das suas Praças."
|
description="Cadastre a primeira liderança ou ajuste a busca. Você só vê lideranças dos seus municípios."
|
||||||
>
|
>
|
||||||
<Button asChild className="min-h-11">
|
<Button asChild className="min-h-11">
|
||||||
<Link href="/campanha/liderancas/nova">
|
<Link href="/campanha/liderancas/nova">
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ export default async function MunicipalityEditPage({ params }: MunicipalityEditP
|
||||||
</Button>
|
</Button>
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">Editar {view.name}</h1>
|
<h1 className="text-2xl font-semibold tracking-tight">Editar {view.name}</h1>
|
||||||
<p className="text-muted-foreground">
|
<p className="text-muted-foreground">
|
||||||
A geografia da Praça é pré-definida e não pode ser alterada. Aqui você edita metas,
|
A geografia do município é pré-definida e não pode ser alterada. Aqui você edita metas,
|
||||||
votos estimados, inteligência e tendência política.
|
votos estimados, inteligência e tendência política.
|
||||||
</p>
|
</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ export default async function MunicipalityDetailPage({
|
||||||
{activeTab === 'demands' ? (
|
{activeTab === 'demands' ? (
|
||||||
<section className="rounded-xl border px-4 py-6">
|
<section className="rounded-xl border px-4 py-6">
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
As demandas desta Praça aparecem em{' '}
|
As demandas deste município aparecem em{' '}
|
||||||
<Link
|
<Link
|
||||||
href="/campanha/demandas"
|
href="/campanha/demandas"
|
||||||
className="text-primary underline-offset-4 hover:underline"
|
className="text-primary underline-offset-4 hover:underline"
|
||||||
|
|
@ -314,7 +314,7 @@ const ElectionsTab = async ({
|
||||||
Comparativo entre candidatos
|
Comparativo entre candidatos
|
||||||
</h2>
|
</h2>
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
Compare a votação de deputados federais nesta Praça através dos anos (fonte TSE, votos
|
Compare a votação de deputados federais neste município através dos anos (fonte TSE, votos
|
||||||
nominais do 1º turno).
|
nominais do 1º turno).
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ const organizationColumns: Array<CampaignTableColumn<OrganizationRowViewModel>>
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'municipalities',
|
id: 'municipalities',
|
||||||
head: <CampaignTableHead>Praças de atuação</CampaignTableHead>,
|
head: <CampaignTableHead>Municípios de atuação</CampaignTableHead>,
|
||||||
cellClassName: 'max-w-64 whitespace-normal text-muted-foreground',
|
cellClassName: 'max-w-64 whitespace-normal text-muted-foreground',
|
||||||
cell: (row) => row.municipalityNames.join(', ') || '—',
|
cell: (row) => row.municipalityNames.join(', ') || '—',
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ export default async function ActionPlanDetailPage({
|
||||||
)}
|
)}
|
||||||
<dl className="grid gap-2 sm:grid-cols-2">
|
<dl className="grid gap-2 sm:grid-cols-2">
|
||||||
<div>
|
<div>
|
||||||
<dt className="text-muted-foreground">Praça</dt>
|
<dt className="text-muted-foreground">Município</dt>
|
||||||
<dd>
|
<dd>
|
||||||
{view.municipality ? (
|
{view.municipality ? (
|
||||||
<Link
|
<Link
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ const createValidatedSupporter = async (payload: Payload, actor: CampaignUser, i
|
||||||
)
|
)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (isUniqueSupporterConflict(error)) {
|
if (isUniqueSupporterConflict(error)) {
|
||||||
throw new Error('Esta pessoa já está cadastrada como apoiador nesta Praça.')
|
throw new Error('Esta pessoa já está cadastrada como apoiador neste município.')
|
||||||
}
|
}
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -395,7 +395,7 @@ export const ActionPlan: CollectionConfig = {
|
||||||
name: 'municipality',
|
name: 'municipality',
|
||||||
type: 'relationship',
|
type: 'relationship',
|
||||||
relationTo: 'municipality',
|
relationTo: 'municipality',
|
||||||
label: 'Praça',
|
label: 'Município',
|
||||||
required: true,
|
required: true,
|
||||||
index: true,
|
index: true,
|
||||||
},
|
},
|
||||||
|
|
@ -574,7 +574,7 @@ export const ActionPlan: CollectionConfig = {
|
||||||
},
|
},
|
||||||
admin: {
|
admin: {
|
||||||
description:
|
description:
|
||||||
'O que aconteceu, público, aprendizados. Vira base para futuras atividades na mesma Praça.',
|
'O que aconteceu, público, aprendizados. Vira base para futuras atividades no mesmo município.',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ const lockMunicipalitiesBeforeChange: CollectionBeforeChangeHook = async ({
|
||||||
relationshipId(originalDoc?.municipality),
|
relationshipId(originalDoc?.municipality),
|
||||||
relationshipId(data.municipality ?? originalDoc?.municipality),
|
relationshipId(data.municipality ?? originalDoc?.municipality),
|
||||||
])
|
])
|
||||||
if (municipalityIDs.length === 0) throw new APIError('Praça da atualização inválida.', 500)
|
if (municipalityIDs.length === 0) throw new APIError('Município da atualização inválido.', 500)
|
||||||
|
|
||||||
await acquireMunicipalityUpdateLocks(req, municipalityIDs)
|
await acquireMunicipalityUpdateLocks(req, municipalityIDs)
|
||||||
return data
|
return data
|
||||||
|
|
@ -147,7 +147,7 @@ const lockMunicipalityBeforeDelete: CollectionBeforeDeleteHook = async ({ contex
|
||||||
req,
|
req,
|
||||||
})
|
})
|
||||||
const municipalityIDs = uniqueSortedMunicipalityIDs([relationshipId(doc.municipality)])
|
const municipalityIDs = uniqueSortedMunicipalityIDs([relationshipId(doc.municipality)])
|
||||||
if (municipalityIDs.length === 0) throw new APIError('Praça da atualização inválida.', 500)
|
if (municipalityIDs.length === 0) throw new APIError('Município da atualização inválido.', 500)
|
||||||
|
|
||||||
await acquireMunicipalityUpdateLocks(req, municipalityIDs)
|
await acquireMunicipalityUpdateLocks(req, municipalityIDs)
|
||||||
}
|
}
|
||||||
|
|
@ -164,7 +164,7 @@ const recomputeChangedMunicipalities: CollectionAfterChangeHook = async ({
|
||||||
relationshipId(previousDoc?.municipality),
|
relationshipId(previousDoc?.municipality),
|
||||||
relationshipId(doc.municipality),
|
relationshipId(doc.municipality),
|
||||||
])
|
])
|
||||||
if (municipalityIDs.length === 0) throw new APIError('Praça da atualização inválida.', 500)
|
if (municipalityIDs.length === 0) throw new APIError('Município da atualização inválido.', 500)
|
||||||
|
|
||||||
await acquireMunicipalityUpdateLocks(req, municipalityIDs)
|
await acquireMunicipalityUpdateLocks(req, municipalityIDs)
|
||||||
await recomputeMunicipalityLastUpdateAt(req, municipalityIDs)
|
await recomputeMunicipalityLastUpdateAt(req, municipalityIDs)
|
||||||
|
|
@ -175,7 +175,7 @@ const recomputeDeletedMunicipality: CollectionAfterDeleteHook = async ({ context
|
||||||
if (context[DERIVED_MUNICIPALITY_UPDATE_CONTEXT]) return doc
|
if (context[DERIVED_MUNICIPALITY_UPDATE_CONTEXT]) return doc
|
||||||
|
|
||||||
const municipalityIDs = uniqueSortedMunicipalityIDs([relationshipId(doc.municipality)])
|
const municipalityIDs = uniqueSortedMunicipalityIDs([relationshipId(doc.municipality)])
|
||||||
if (municipalityIDs.length === 0) throw new APIError('Praça da atualização inválida.', 500)
|
if (municipalityIDs.length === 0) throw new APIError('Município da atualização inválido.', 500)
|
||||||
|
|
||||||
await acquireMunicipalityUpdateLocks(req, municipalityIDs)
|
await acquireMunicipalityUpdateLocks(req, municipalityIDs)
|
||||||
await recomputeMunicipalityLastUpdateAt(req, municipalityIDs)
|
await recomputeMunicipalityLastUpdateAt(req, municipalityIDs)
|
||||||
|
|
@ -185,8 +185,8 @@ const recomputeDeletedMunicipality: CollectionAfterDeleteHook = async ({ context
|
||||||
export const MunicipalityUpdate: CollectionConfig = {
|
export const MunicipalityUpdate: CollectionConfig = {
|
||||||
slug: 'municipalityUpdate',
|
slug: 'municipalityUpdate',
|
||||||
labels: {
|
labels: {
|
||||||
singular: 'Atualização da Praça',
|
singular: 'Atualização do Município',
|
||||||
plural: 'Atualizações das Praças',
|
plural: 'Atualizações dos Municípios',
|
||||||
},
|
},
|
||||||
admin: {
|
admin: {
|
||||||
group: 'Campanha',
|
group: 'Campanha',
|
||||||
|
|
@ -211,7 +211,7 @@ export const MunicipalityUpdate: CollectionConfig = {
|
||||||
name: 'municipality',
|
name: 'municipality',
|
||||||
type: 'relationship',
|
type: 'relationship',
|
||||||
relationTo: 'municipality',
|
relationTo: 'municipality',
|
||||||
label: 'Praça',
|
label: 'Município',
|
||||||
required: true,
|
required: true,
|
||||||
index: true,
|
index: true,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ export const Supporter: CollectionConfig = {
|
||||||
name: 'municipality',
|
name: 'municipality',
|
||||||
type: 'relationship',
|
type: 'relationship',
|
||||||
relationTo: 'municipality',
|
relationTo: 'municipality',
|
||||||
label: 'Praça',
|
label: 'Município',
|
||||||
index: true,
|
index: true,
|
||||||
access: {
|
access: {
|
||||||
update: canManageCampaignStaffField,
|
update: canManageCampaignStaffField,
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ const validatePledgeIntegrity: CollectionBeforeChangeHook = async ({
|
||||||
const leadershipID = relationshipId(data.leadership ?? originalDoc?.leadership)
|
const leadershipID = relationshipId(data.leadership ?? originalDoc?.leadership)
|
||||||
const municipalityID = relationshipId(data.municipality ?? originalDoc?.municipality)
|
const municipalityID = relationshipId(data.municipality ?? originalDoc?.municipality)
|
||||||
if (!leadershipID || !municipalityID) {
|
if (!leadershipID || !municipalityID) {
|
||||||
throw new APIError('Informe a liderança e a Praça do compromisso de votos.', 400)
|
throw new APIError('Informe a liderança e o município do compromisso de votos.', 400)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation === 'update') {
|
if (operation === 'update') {
|
||||||
|
|
@ -74,7 +74,7 @@ const validatePledgeIntegrity: CollectionBeforeChangeHook = async ({
|
||||||
(data.leadership !== undefined && leadershipID !== previousLeadership) ||
|
(data.leadership !== undefined && leadershipID !== previousLeadership) ||
|
||||||
(data.municipality !== undefined && municipalityID !== previousMunicipality)
|
(data.municipality !== undefined && municipalityID !== previousMunicipality)
|
||||||
) {
|
) {
|
||||||
throw new APIError('A liderança e a Praça do compromisso não podem ser alteradas.', 409)
|
throw new APIError('A liderança e o município do compromisso não podem ser alterados.', 409)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -90,7 +90,7 @@ const validatePledgeIntegrity: CollectionBeforeChangeHook = async ({
|
||||||
.filter((id): id is number => id !== null)
|
.filter((id): id is number => id !== null)
|
||||||
|
|
||||||
if (!linkedMunicipalityIDs.includes(municipalityID)) {
|
if (!linkedMunicipalityIDs.includes(municipalityID)) {
|
||||||
throw new APIError('A liderança precisa estar vinculada à Praça para declarar votos nela.', 409)
|
throw new APIError('A liderança precisa estar vinculada ao município para declarar votos nele.', 409)
|
||||||
}
|
}
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
@ -172,7 +172,7 @@ export const VotePledge: CollectionConfig = {
|
||||||
name: 'municipality',
|
name: 'municipality',
|
||||||
type: 'relationship',
|
type: 'relationship',
|
||||||
relationTo: 'municipality',
|
relationTo: 'municipality',
|
||||||
label: 'Praça',
|
label: 'Município',
|
||||||
required: true,
|
required: true,
|
||||||
index: true,
|
index: true,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -186,14 +186,14 @@ export const ActionPlanFilters = ({
|
||||||
</Field>
|
</Field>
|
||||||
) : null}
|
) : null}
|
||||||
<Field>
|
<Field>
|
||||||
<FieldLabel htmlFor="action-plan-municipality">Praça</FieldLabel>
|
<FieldLabel htmlFor="action-plan-municipality">Município</FieldLabel>
|
||||||
<NativeSelect
|
<NativeSelect
|
||||||
id="action-plan-municipality"
|
id="action-plan-municipality"
|
||||||
value={values.municipality}
|
value={values.municipality}
|
||||||
onChange={(event) => updateMunicipality(event.target.value)}
|
onChange={(event) => updateMunicipality(event.target.value)}
|
||||||
className="w-full **:data-[slot=native-select]:min-h-11 **:data-[slot=native-select]:rounded-[6px]"
|
className="w-full **:data-[slot=native-select]:min-h-11 **:data-[slot=native-select]:rounded-[6px]"
|
||||||
>
|
>
|
||||||
<NativeSelectOption value="">Todas as Praças</NativeSelectOption>
|
<NativeSelectOption value="">Todos os municípios</NativeSelectOption>
|
||||||
{municipalityOptions.map((option) => (
|
{municipalityOptions.map((option) => (
|
||||||
<NativeSelectOption key={option.id} value={String(option.id)}>
|
<NativeSelectOption key={option.id} value={String(option.id)}>
|
||||||
{option.name}
|
{option.name}
|
||||||
|
|
|
||||||
|
|
@ -283,7 +283,7 @@ export const ActionPlanFormFields = ({
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<FieldGroup>
|
<FieldGroup>
|
||||||
<Field data-invalid={Boolean(errorFor('municipality'))}>
|
<Field data-invalid={Boolean(errorFor('municipality'))}>
|
||||||
<FieldLabel htmlFor="municipality">Praça *</FieldLabel>
|
<FieldLabel htmlFor="municipality">Município *</FieldLabel>
|
||||||
<NativeSelect
|
<NativeSelect
|
||||||
id="municipality"
|
id="municipality"
|
||||||
name="municipality"
|
name="municipality"
|
||||||
|
|
@ -293,7 +293,7 @@ export const ActionPlanFormFields = ({
|
||||||
aria-describedby={errorFor('municipality') ? 'municipality-error' : undefined}
|
aria-describedby={errorFor('municipality') ? 'municipality-error' : undefined}
|
||||||
className="w-full **:data-[slot=native-select]:min-h-11"
|
className="w-full **:data-[slot=native-select]:min-h-11"
|
||||||
>
|
>
|
||||||
<NativeSelectOption value="">Selecione a Praça</NativeSelectOption>
|
<NativeSelectOption value="">Selecione o município</NativeSelectOption>
|
||||||
{municipalityOptions.map((option) => (
|
{municipalityOptions.map((option) => (
|
||||||
<NativeSelectOption key={option.id} value={String(option.id)}>
|
<NativeSelectOption key={option.id} value={String(option.id)}>
|
||||||
{option.name}
|
{option.name}
|
||||||
|
|
|
||||||
|
|
@ -46,28 +46,28 @@ export const CampaignDashboard = ({
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">Olá, {userName}</h1>
|
<h1 className="text-2xl font-semibold tracking-tight">Olá, {userName}</h1>
|
||||||
<p className="text-muted-foreground">
|
<p className="text-muted-foreground">
|
||||||
{view.role === 'advisor'
|
{view.role === 'advisor'
|
||||||
? 'Quadro das Praças sob sua assessoria.'
|
? 'Quadro dos municípios sob sua assessoria.'
|
||||||
: 'Quadro geral da campanha por Praça.'}
|
: 'Quadro geral da campanha por município.'}
|
||||||
</p>
|
</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
{mapSlot}
|
{mapSlot}
|
||||||
|
|
||||||
<section
|
<section
|
||||||
aria-label="Indicadores das Praças"
|
aria-label="Indicadores dos municípios"
|
||||||
className={`rounded-xl ${campaignPrioritySurfaceClassName}`}
|
className={`rounded-xl ${campaignPrioritySurfaceClassName}`}
|
||||||
>
|
>
|
||||||
<CampaignMetricStrip
|
<CampaignMetricStrip
|
||||||
metrics={[
|
metrics={[
|
||||||
{
|
{
|
||||||
label: `${voteEstimateScenarioLabels.central} nas Praças`,
|
label: `${voteEstimateScenarioLabels.central} nos municípios`,
|
||||||
value: formatElectionNumber(view.staffVoteTotalByScenario.central),
|
value: formatElectionNumber(view.staffVoteTotalByScenario.central),
|
||||||
detail: formatVoteEstimateEndpointsLabel(view.staffVoteTotalByScenario) ?? undefined,
|
detail: formatVoteEstimateEndpointsLabel(view.staffVoteTotalByScenario) ?? undefined,
|
||||||
emphasize: true,
|
emphasize: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Cobertura de assessoria',
|
label: 'Cobertura de assessoria',
|
||||||
value: `${view.withAdvisorCount} de ${view.municipalityCount} Praças`,
|
value: `${view.withAdvisorCount} de ${view.municipalityCount} municípios`,
|
||||||
progress:
|
progress:
|
||||||
view.municipalityCount > 0
|
view.municipalityCount > 0
|
||||||
? Math.round((view.withAdvisorCount / view.municipalityCount) * 100)
|
? Math.round((view.withAdvisorCount / view.municipalityCount) * 100)
|
||||||
|
|
@ -158,7 +158,7 @@ export const CampaignDashboard = ({
|
||||||
{view.priorityMunicipalities.length ? (
|
{view.priorityMunicipalities.length ? (
|
||||||
<section aria-labelledby="dashboard-priority-title" className="flex flex-col gap-3">
|
<section aria-labelledby="dashboard-priority-title" className="flex flex-col gap-3">
|
||||||
<h2 id="dashboard-priority-title" className="text-base font-medium">
|
<h2 id="dashboard-priority-title" className="text-base font-medium">
|
||||||
Praças prioritárias
|
Municípios prioritários
|
||||||
</h2>
|
</h2>
|
||||||
<ul className="flex flex-wrap gap-2">
|
<ul className="flex flex-wrap gap-2">
|
||||||
{view.priorityMunicipalities.map((municipality) => (
|
{view.priorityMunicipalities.map((municipality) => (
|
||||||
|
|
@ -177,7 +177,7 @@ export const CampaignDashboard = ({
|
||||||
<div>
|
<div>
|
||||||
<Button asChild className="min-h-11">
|
<Button asChild className="min-h-11">
|
||||||
<Link href="/campanha/municipios">
|
<Link href="/campanha/municipios">
|
||||||
Ver todas as Praças
|
Ver todos os municípios
|
||||||
<ArrowRightIcon data-icon="inline-end" aria-hidden="true" />
|
<ArrowRightIcon data-icon="inline-end" aria-hidden="true" />
|
||||||
</Link>
|
</Link>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ export const LeaderContactForm = ({
|
||||||
defaultValue={values?.municipality ?? ''}
|
defaultValue={values?.municipality ?? ''}
|
||||||
className="w-full **:data-[slot=native-select]:min-h-11 **:data-[slot=native-select]:rounded-[6px]"
|
className="w-full **:data-[slot=native-select]:min-h-11 **:data-[slot=native-select]:rounded-[6px]"
|
||||||
>
|
>
|
||||||
<NativeSelectOption value="">Selecione a Praça</NativeSelectOption>
|
<NativeSelectOption value="">Selecione o município</NativeSelectOption>
|
||||||
{municipalityOptions.map((municipality) => (
|
{municipalityOptions.map((municipality) => (
|
||||||
<NativeSelectOption key={municipality.id} value={String(municipality.id)}>
|
<NativeSelectOption key={municipality.id} value={String(municipality.id)}>
|
||||||
{municipality.name}
|
{municipality.name}
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ export const LeaderContactsPanel = ({
|
||||||
|
|
||||||
{municipalityOptions.length === 0 ? (
|
{municipalityOptions.length === 0 ? (
|
||||||
<p className="rounded-xl border px-4 py-6 text-sm text-muted-foreground">
|
<p className="rounded-xl border px-4 py-6 text-sm text-muted-foreground">
|
||||||
Você ainda não está vinculada a nenhuma Praça. Fale com a assessoria da campanha.
|
Você ainda não está vinculada a nenhum município. Fale com a assessoria da campanha.
|
||||||
</p>
|
</p>
|
||||||
) : (
|
) : (
|
||||||
<LeaderContactForm
|
<LeaderContactForm
|
||||||
|
|
|
||||||
|
|
@ -96,11 +96,11 @@ export const LeadershipForm = ({
|
||||||
|
|
||||||
<RelationMultiSelect
|
<RelationMultiSelect
|
||||||
name="municipalities"
|
name="municipalities"
|
||||||
label="Praças em que atua"
|
label="Municípios em que atua"
|
||||||
options={municipalityOptions}
|
options={municipalityOptions}
|
||||||
initialSelectedIDs={initialMunicipalityIDs}
|
initialSelectedIDs={initialMunicipalityIDs}
|
||||||
error={fieldError(state.fieldErrors, 'municipalities')}
|
error={fieldError(state.fieldErrors, 'municipalities')}
|
||||||
placeholder="Adicionar Praça…"
|
placeholder="Adicionar município…"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<RelationMultiSelect
|
<RelationMultiSelect
|
||||||
|
|
|
||||||
|
|
@ -61,11 +61,11 @@ export const LeadershipInternalForm = ({
|
||||||
|
|
||||||
<RelationMultiSelect
|
<RelationMultiSelect
|
||||||
name="municipalities"
|
name="municipalities"
|
||||||
label="Praças em que atua"
|
label="Municípios em que atua"
|
||||||
options={municipalityOptions}
|
options={municipalityOptions}
|
||||||
initialSelectedIDs={leadership.municipalityIDs}
|
initialSelectedIDs={leadership.municipalityIDs}
|
||||||
error={fieldError(state.fieldErrors, 'municipalities')}
|
error={fieldError(state.fieldErrors, 'municipalities')}
|
||||||
placeholder="Adicionar Praça…"
|
placeholder="Adicionar município…"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<RelationMultiSelect
|
<RelationMultiSelect
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ const statusPresentation = {
|
||||||
engajado: {
|
engajado: {
|
||||||
label: 'Engajado',
|
label: 'Engajado',
|
||||||
variant: 'support-engaged',
|
variant: 'support-engaged',
|
||||||
summary: 'Participa ativamente da campanha nas suas Praças e pode ter acesso ao app.',
|
summary: 'Participa ativamente da campanha nos seus municípios e pode ter acesso ao app.',
|
||||||
},
|
},
|
||||||
a_abordar: {
|
a_abordar: {
|
||||||
label: 'A abordar',
|
label: 'A abordar',
|
||||||
|
|
|
||||||
|
|
@ -87,14 +87,14 @@ export const MapFeatureReadout = ({
|
||||||
) : null}
|
) : null}
|
||||||
{navigation?.kind === 'zones' ? (
|
{navigation?.kind === 'zones' ? (
|
||||||
<p className="text-xs text-muted-foreground">
|
<p className="text-xs text-muted-foreground">
|
||||||
Toque de novo no mapa ou role até as Praças por zona abaixo.
|
Toque de novo no mapa ou role até os Municípios por zona abaixo.
|
||||||
</p>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{navigation?.kind === 'navigate' ? (
|
{navigation?.kind === 'navigate' ? (
|
||||||
<Button asChild className="min-h-11 shrink-0">
|
<Button asChild className="min-h-11 shrink-0">
|
||||||
<Link href={`/campanha/municipios/${navigation.slug}`}>Abrir Praça</Link>
|
<Link href={`/campanha/municipios/${navigation.slug}`}>Abrir município</Link>
|
||||||
</Button>
|
</Button>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ export const MunicipalityMapPanel = ({
|
||||||
<div className="flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between">
|
<div className="flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between">
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<h2 id="municipality-map-title" className="text-base font-medium">
|
<h2 id="municipality-map-title" className="text-base font-medium">
|
||||||
Mapa das Praças
|
Mapa dos Municípios
|
||||||
</h2>
|
</h2>
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
{comparisonActive && comparison
|
{comparisonActive && comparison
|
||||||
|
|
@ -277,7 +277,7 @@ export const MunicipalityMapPanel = ({
|
||||||
{/* zone breakdown below */}
|
{/* zone breakdown below */}
|
||||||
{bundle.zoneBreakdown.length > 0 && !comparisonActive ? (
|
{bundle.zoneBreakdown.length > 0 && !comparisonActive ? (
|
||||||
<div id="municipality-zone-breakdown" className="flex flex-col gap-2">
|
<div id="municipality-zone-breakdown" className="flex flex-col gap-2">
|
||||||
<h3 className="text-sm font-medium">Praças por zona eleitoral</h3>
|
<h3 className="text-sm font-medium">Municípios por zona eleitoral</h3>
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
Zonas não têm polígono oficial — Salvador e Camaçari aparecem agregadas no mapa e
|
Zonas não têm polígono oficial — Salvador e Camaçari aparecem agregadas no mapa e
|
||||||
detalhadas aqui.
|
detalhadas aqui.
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,9 @@ export const MunicipalityAdvisorsForm = ({
|
||||||
return (
|
return (
|
||||||
<form action={submitAction} className="flex flex-col gap-4 rounded-xl border p-4">
|
<form action={submitAction} className="flex flex-col gap-4 rounded-xl border p-4">
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<h2 className="text-base font-medium">Assessores da Praça</h2>
|
<h2 className="text-base font-medium">Assessores do município</h2>
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
O assessor vê e gerencia somente as Praças que administra.
|
O assessor vê e gerencia somente os municípios que administra.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<input type="hidden" name="municipalityId" value={municipalityID} />
|
<input type="hidden" name="municipalityId" value={municipalityID} />
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@ export const MunicipalityGoalAccountCard = ({
|
||||||
</dl>
|
</dl>
|
||||||
{!usesMesaEstimate && suggestedGoal <= 0 ? (
|
{!usesMesaEstimate && suggestedGoal <= 0 ? (
|
||||||
<p className="text-xs text-muted-foreground">
|
<p className="text-xs text-muted-foreground">
|
||||||
Sem votação própria em 2022 aqui, então não há meta sugerida — é praça de expansão:
|
Sem votação própria em 2022 aqui, então não há meta sugerida — é município de expansão:
|
||||||
cadastre a estimativa da mesa manualmente se decidir investir.
|
cadastre a estimativa da mesa manualmente se decidir investir.
|
||||||
</p>
|
</p>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,10 @@ export const MunicipalityLeadershipsPanel = ({
|
||||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<h2 id="municipality-leaderships-title" className="text-base font-medium">
|
<h2 id="municipality-leaderships-title" className="text-base font-medium">
|
||||||
Lideranças desta Praça
|
Lideranças deste município
|
||||||
</h2>
|
</h2>
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
Uma liderança pode atuar em várias Praças e organizações.
|
Uma liderança pode atuar em vários municípios e organizações.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<Button asChild className="min-h-11">
|
<Button asChild className="min-h-11">
|
||||||
|
|
@ -74,7 +74,7 @@ export const MunicipalityLeadershipsPanel = ({
|
||||||
</div>
|
</div>
|
||||||
{leadership.municipalityNames.length > 1 ? (
|
{leadership.municipalityNames.length > 1 ? (
|
||||||
<span className="text-sm text-muted-foreground">
|
<span className="text-sm text-muted-foreground">
|
||||||
Atua em {leadership.municipalityNames.length} Praças
|
Atua em {leadership.municipalityNames.length} municípios
|
||||||
</span>
|
</span>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -90,7 +90,7 @@ export const MunicipalityLeadershipsPanel = ({
|
||||||
</ul>
|
</ul>
|
||||||
) : (
|
) : (
|
||||||
<p className="rounded-xl border px-4 py-6 text-sm text-muted-foreground">
|
<p className="rounded-xl border px-4 py-6 text-sm text-muted-foreground">
|
||||||
Nenhuma liderança vinculada a esta Praça ainda.
|
Nenhuma liderança vinculada a este município ainda.
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ export const MunicipalityPledgesPanel = ({
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
Nenhuma liderança declarou votos nesta Praça ainda.
|
Nenhuma liderança declarou votos neste município ainda.
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export const MunicipalityTabNav = ({
|
||||||
searchParams: MunicipalityDetailSearchParams
|
searchParams: MunicipalityDetailSearchParams
|
||||||
}) => (
|
}) => (
|
||||||
<nav
|
<nav
|
||||||
aria-label="Seções da Praça"
|
aria-label="Seções do município"
|
||||||
className="h-14 min-w-0 overflow-x-auto overflow-y-hidden border-b print:hidden"
|
className="h-14 min-w-0 overflow-x-auto overflow-y-hidden border-b print:hidden"
|
||||||
>
|
>
|
||||||
<ul
|
<ul
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ export const MunicipalityZoneNeighborhoodsCard = ({ municipalitySlug }: { munici
|
||||||
>
|
>
|
||||||
<div className="flex flex-col gap-1">
|
<div className="flex flex-col gap-1">
|
||||||
<h2 id="municipality-zone-neighborhoods-title" className="text-base font-medium">
|
<h2 id="municipality-zone-neighborhoods-title" className="text-base font-medium">
|
||||||
Bairros desta Praça
|
Bairros deste município
|
||||||
</h2>
|
</h2>
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
{neighborhoods.length}{' '}
|
{neighborhoods.length}{' '}
|
||||||
|
|
|
||||||
|
|
@ -80,11 +80,11 @@ export const OrganizationForm = ({
|
||||||
|
|
||||||
<RelationMultiSelect
|
<RelationMultiSelect
|
||||||
name="municipalities"
|
name="municipalities"
|
||||||
label="Praças de atuação"
|
label="Municípios de atuação"
|
||||||
options={municipalityOptions}
|
options={municipalityOptions}
|
||||||
initialSelectedIDs={initial?.municipalityIDs ?? []}
|
initialSelectedIDs={initial?.municipalityIDs ?? []}
|
||||||
error={fieldError(state.fieldErrors, 'municipalities')}
|
error={fieldError(state.fieldErrors, 'municipalities')}
|
||||||
placeholder="Adicionar Praça…"
|
placeholder="Adicionar município…"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Field>
|
<Field>
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ const FilterFields = ({
|
||||||
</NativeSelect>
|
</NativeSelect>
|
||||||
</Field>
|
</Field>
|
||||||
<Field>
|
<Field>
|
||||||
<FieldLabel htmlFor="supporter-city">Município</FieldLabel>
|
<FieldLabel htmlFor="supporter-city">Cidade</FieldLabel>
|
||||||
<StrictCombobox
|
<StrictCombobox
|
||||||
id="supporter-city"
|
id="supporter-city"
|
||||||
options={municipalityComboboxOptions()}
|
options={municipalityComboboxOptions()}
|
||||||
|
|
@ -80,7 +80,7 @@ const FilterFields = ({
|
||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
<Field>
|
<Field>
|
||||||
<FieldLabel htmlFor="supporter-municipality">Praça</FieldLabel>
|
<FieldLabel htmlFor="supporter-municipality">Município</FieldLabel>
|
||||||
<NativeSelect
|
<NativeSelect
|
||||||
id="supporter-municipality"
|
id="supporter-municipality"
|
||||||
name="municipality"
|
name="municipality"
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ export const SupporterForm = ({
|
||||||
</Field>
|
</Field>
|
||||||
|
|
||||||
<Field data-invalid={municipalityField.invalid}>
|
<Field data-invalid={municipalityField.invalid}>
|
||||||
<FieldLabel htmlFor="supporter-municipality">Praça{requireMunicipality ? ' *' : ''}</FieldLabel>
|
<FieldLabel htmlFor="supporter-municipality">Município{requireMunicipality ? ' *' : ''}</FieldLabel>
|
||||||
<NativeSelect
|
<NativeSelect
|
||||||
id="supporter-municipality"
|
id="supporter-municipality"
|
||||||
name="municipality"
|
name="municipality"
|
||||||
|
|
@ -221,7 +221,7 @@ export const SupporterForm = ({
|
||||||
defaultValue={values?.municipality ?? ''}
|
defaultValue={values?.municipality ?? ''}
|
||||||
className="w-full **:data-[slot=native-select]:min-h-11 **:data-[slot=native-select]:rounded-[6px]"
|
className="w-full **:data-[slot=native-select]:min-h-11 **:data-[slot=native-select]:rounded-[6px]"
|
||||||
>
|
>
|
||||||
{!requireMunicipality ? <NativeSelectOption value="">Sem Praça</NativeSelectOption> : null}
|
{!requireMunicipality ? <NativeSelectOption value="">Sem município</NativeSelectOption> : null}
|
||||||
{municipalityOptions.map((municipality) => (
|
{municipalityOptions.map((municipality) => (
|
||||||
<NativeSelectOption key={municipality.id} value={String(municipality.id)}>
|
<NativeSelectOption key={municipality.id} value={String(municipality.id)}>
|
||||||
{municipality.name}
|
{municipality.name}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ const SupporterCard = ({ supporter }: { supporter: SupporterListItemViewModel })
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
{supporter.city ?? 'Município não informado'}
|
{supporter.city ?? 'Cidade não informada'}
|
||||||
</p>
|
</p>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="flex flex-col gap-3">
|
<CardContent className="flex flex-col gap-3">
|
||||||
|
|
@ -65,7 +65,7 @@ const SupporterCard = ({ supporter }: { supporter: SupporterListItemViewModel })
|
||||||
{supporter.municipalityName}
|
{supporter.municipalityName}
|
||||||
</Link>
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
<span className="text-muted-foreground">Sem Praça vinculada</span>
|
<span className="text-muted-foreground">Sem município vinculado</span>
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
{supporter.phone ? (
|
{supporter.phone ? (
|
||||||
|
|
@ -99,12 +99,12 @@ const supporterColumns: Array<CampaignTableColumn<SupporterListItemViewModel>> =
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'city',
|
id: 'city',
|
||||||
head: <CampaignTableHead>Município</CampaignTableHead>,
|
head: <CampaignTableHead>Cidade</CampaignTableHead>,
|
||||||
cell: (supporter) => supporter.city ?? '—',
|
cell: (supporter) => supporter.city ?? '—',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'municipality',
|
id: 'municipality',
|
||||||
head: <CampaignTableHead>Praça</CampaignTableHead>,
|
head: <CampaignTableHead>Município</CampaignTableHead>,
|
||||||
cellClassName: 'max-w-48 whitespace-normal',
|
cellClassName: 'max-w-48 whitespace-normal',
|
||||||
cell: (supporter) =>
|
cell: (supporter) =>
|
||||||
supporter.municipalityName ? (
|
supporter.municipalityName ? (
|
||||||
|
|
@ -115,7 +115,7 @@ const supporterColumns: Array<CampaignTableColumn<SupporterListItemViewModel>> =
|
||||||
{supporter.municipalityName}
|
{supporter.municipalityName}
|
||||||
</Link>
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
<span className="text-muted-foreground">Sem Praça vinculada</span>
|
<span className="text-muted-foreground">Sem município vinculado</span>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ export const CAMPAIGN_LEADERSHIP_LOGIN_RECOVERY_HINT =
|
||||||
'Conta só com celular? Peça um novo convite ao coordenador — a recuperação por e-mail não funciona sem e-mail cadastrado.'
|
'Conta só com celular? Peça um novo convite ao coordenador — a recuperação por e-mail não funciona sem e-mail cadastrado.'
|
||||||
|
|
||||||
export const CAMPAIGN_FIRST_ACCESS_HINT =
|
export const CAMPAIGN_FIRST_ACCESS_HINT =
|
||||||
'Peça um convite no WhatsApp ao assessor da sua Praça.'
|
'Peça um convite no WhatsApp ao assessor do seu município.'
|
||||||
|
|
||||||
export const CAMPAIGN_LOGIN_SUBTITLE = 'Use o e-mail ou o celular cadastrado na sua conta.'
|
export const CAMPAIGN_LOGIN_SUBTITLE = 'Use o e-mail ou o celular cadastrado na sua conta.'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ export interface MunicipalityCatalogEntry {
|
||||||
/** Display name, e.g. "Feira de Santana" or "Salvador — ZE 3". */
|
/** Display name, e.g. "Feira de Santana" or "Salvador — ZE 3". */
|
||||||
readonly name: string
|
readonly name: string
|
||||||
readonly kind: MunicipalityKind
|
readonly kind: MunicipalityKind
|
||||||
/** Canonical municipality name (every Praça is single-municipality). */
|
/** Canonical municipality name (every catalog unit is single-municipality). */
|
||||||
readonly city: string
|
readonly city: string
|
||||||
/** Official Bahia identity territory (TI) of the municipality. */
|
/** Official Bahia identity territory (TI) of the municipality. */
|
||||||
readonly region: BahiaIdentityTerritory
|
readonly region: BahiaIdentityTerritory
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ export const MAX_LEADERSHIP_STATE_DEPUTIES = 20
|
||||||
|
|
||||||
const municipalitiesArraySchema = z
|
const municipalitiesArraySchema = z
|
||||||
.array(positiveRelationshipId)
|
.array(positiveRelationshipId)
|
||||||
.min(1, 'Vincule a liderança a pelo menos uma Praça.')
|
.min(1, 'Vincule a liderança a pelo menos um município.')
|
||||||
.max(MAX_LEADERSHIP_MUNICIPALITIES)
|
.max(MAX_LEADERSHIP_MUNICIPALITIES)
|
||||||
.transform((ids) => [...new Set(ids)])
|
.transform((ids) => [...new Set(ids)])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -683,7 +683,7 @@ export interface ActionPlan {
|
||||||
}[]
|
}[]
|
||||||
| null;
|
| null;
|
||||||
/**
|
/**
|
||||||
* O que aconteceu, público, aprendizados. Vira base para futuras atividades na mesma Praça.
|
* O que aconteceu, público, aprendizados. Vira base para futuras atividades no mesmo município.
|
||||||
*/
|
*/
|
||||||
resultSummary?: string | null;
|
resultSummary?: string | null;
|
||||||
resultMedia?: (number | Media)[] | null;
|
resultMedia?: (number | Media)[] | null;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Municipalities (Praças)
|
// Municipalities (Municípios)
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
import type { Access, FieldAccess, Payload, PayloadRequest } from 'payload'
|
import type { Access, FieldAccess, Payload, PayloadRequest } from 'payload'
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ export const actionPlanMunicipalitySummary = (
|
||||||
? { id: municipality.id, name: municipality.name, slug: municipality.slug }
|
? { id: municipality.id, name: municipality.name, slug: municipality.slug }
|
||||||
: null
|
: null
|
||||||
|
|
||||||
/** Short "where" line, e.g. "Praça de Itabuna · Feira do Malhado". */
|
/** Short "where" line, e.g. "Itabuna · Feira do Malhado". */
|
||||||
export const formatActionPlanLocationLabel = ({
|
export const formatActionPlanLocationLabel = ({
|
||||||
municipalityName,
|
municipalityName,
|
||||||
locality,
|
locality,
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ export const getCampaignDashboardData = async (
|
||||||
: 'Contato'
|
: 'Contato'
|
||||||
return {
|
return {
|
||||||
pledgeID: pledge.id,
|
pledgeID: pledge.id,
|
||||||
municipalityName: municipality?.name ?? 'Praça',
|
municipalityName: municipality?.name ?? 'Município',
|
||||||
municipalitySlug: municipality?.slug ?? '',
|
municipalitySlug: municipality?.slug ?? '',
|
||||||
contactName,
|
contactName,
|
||||||
declaredVotes: pledge.declaredVotes,
|
declaredVotes: pledge.declaredVotes,
|
||||||
|
|
@ -180,7 +180,7 @@ export const getCampaignDashboardData = async (
|
||||||
const author = authorsById.get(relationshipId(update.author) ?? -1)
|
const author = authorsById.get(relationshipId(update.author) ?? -1)
|
||||||
return {
|
return {
|
||||||
id: update.id,
|
id: update.id,
|
||||||
municipalityName: municipality?.name ?? 'Praça',
|
municipalityName: municipality?.name ?? 'Município',
|
||||||
municipalitySlug: municipality?.slug ?? '',
|
municipalitySlug: municipality?.slug ?? '',
|
||||||
authorName: String(author?.name ?? 'Usuário'),
|
authorName: String(author?.name ?? 'Usuário'),
|
||||||
createdAt: update.createdAt,
|
createdAt: update.createdAt,
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ const toDemandRow = (
|
||||||
slug: demand.slug,
|
slug: demand.slug,
|
||||||
kind: demand.kind as CampaignDemandKind,
|
kind: demand.kind as CampaignDemandKind,
|
||||||
status: demand.status as CampaignDemandStatus,
|
status: demand.status as CampaignDemandStatus,
|
||||||
municipalityName: municipality?.name ?? 'Praça',
|
municipalityName: municipality?.name ?? 'Município',
|
||||||
municipalitySlug: municipality?.slug ?? '',
|
municipalitySlug: municipality?.slug ?? '',
|
||||||
requesterName: leadershipID ? (requesterBy.get(leadershipID) ?? null) : null,
|
requesterName: leadershipID ? (requesterBy.get(leadershipID) ?? null) : null,
|
||||||
createdAt: demand.createdAt,
|
createdAt: demand.createdAt,
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ const toLeadershipRows = async (
|
||||||
municipalityNames: (doc.municipalities ?? [])
|
municipalityNames: (doc.municipalities ?? [])
|
||||||
.map(relationshipId)
|
.map(relationshipId)
|
||||||
.filter((id): id is number => id !== null)
|
.filter((id): id is number => id !== null)
|
||||||
.map((id) => municipalityNames.get(id) ?? 'Praça'),
|
.map((id) => municipalityNames.get(id) ?? 'Município'),
|
||||||
organizationNames: (doc.organizations ?? [])
|
organizationNames: (doc.organizations ?? [])
|
||||||
.map(relationshipId)
|
.map(relationshipId)
|
||||||
.filter((id): id is number => id !== null)
|
.filter((id): id is number => id !== null)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ export type CandidateComparisonRow = {
|
||||||
/**
|
/**
|
||||||
* Vote comparison between Jorge Solla and selected federal-deputy candidates
|
* Vote comparison between Jorge Solla and selected federal-deputy candidates
|
||||||
* inside one municipality geography, across the TSE series years. This is the
|
* inside one municipality geography, across the TSE series years. This is the
|
||||||
* coordination's core analysis tool ("com quem comparar nesta Praça?").
|
* coordination's core analysis tool ("com quem comparar neste município?").
|
||||||
*/
|
*/
|
||||||
/** Cross-request cached core — immutable TSE series, busted with `election-tse`. */
|
/** Cross-request cached core — immutable TSE series, busted with `election-tse`. */
|
||||||
const loadMunicipalityCandidateComparisonCached = unstable_cache(
|
const loadMunicipalityCandidateComparisonCached = unstable_cache(
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@ import type { Where } from 'payload'
|
||||||
import { getMunicipalityCatalogEntry, type MunicipalityCatalogEntry } from '@/lib/municipalityCatalog'
|
import { getMunicipalityCatalogEntry, type MunicipalityCatalogEntry } from '@/lib/municipalityCatalog'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Election-data geography of a Praça: exactly one municipality (TSE cityCode)
|
* Election-data geography of a Município: exactly one municipality (TSE cityCode)
|
||||||
* and either all of its official zones (municipality Praça) or the single
|
* and either all of its official zones (whole-municipality unit) or the single
|
||||||
* zone (zone Praça). Election collections are keyed by cityCode × zoneNumber,
|
* zone (zona unit). Election collections are keyed by cityCode × zoneNumber,
|
||||||
* so the cut at the municipal boundary is exact.
|
* so the cut at the municipal boundary is exact.
|
||||||
*/
|
*/
|
||||||
export type MunicipalityElectionGeography = {
|
export type MunicipalityElectionGeography = {
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ export type CandidateVotesByCity = Map<string, number>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Statewide nominal votes of one federal-deputy candidate in one year, grouped
|
* Statewide nominal votes of one federal-deputy candidate in one year, grouped
|
||||||
* by TSE cityCode. Used by the Praças map (choropleth per municipality).
|
* by TSE cityCode. Used by the municipalities map (choropleth per municipality).
|
||||||
*/
|
*/
|
||||||
export const loadCandidateVotesByCity = async (
|
export const loadCandidateVotesByCity = async (
|
||||||
payload: Payload,
|
payload: Payload,
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ export const buildMunicipalityMapBundleFromMunicipalities = async (
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map data for the Praças overview: municipalities matching the list URL filters (and
|
* Map data for the municipalities overview: municipalities matching the list URL filters (and
|
||||||
* role access) contribute their geography's votes (or 2026 pledge estimates)
|
* role access) contribute their geography's votes (or 2026 pledge estimates)
|
||||||
* to municipality polygons. When `state.compare` is set, TSE years also carry
|
* to municipality polygons. When `state.compare` is set, TSE years also carry
|
||||||
* a red↔white↔blue diff (Solla − other candidate).
|
* a red↔white↔blue diff (Solla − other candidate).
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ export const loadOrganizationListPageData = async (
|
||||||
municipalityNames: (doc.municipalities ?? [])
|
municipalityNames: (doc.municipalities ?? [])
|
||||||
.map(relationshipId)
|
.map(relationshipId)
|
||||||
.filter((id): id is number => id !== null)
|
.filter((id): id is number => id !== null)
|
||||||
.map((id) => municipalityNames.get(id) ?? 'Praça'),
|
.map((id) => municipalityNames.get(id) ?? 'Município'),
|
||||||
leadershipCount: leadershipCounts.get(doc.id) ?? 0,
|
leadershipCount: leadershipCounts.get(doc.id) ?? 0,
|
||||||
})),
|
})),
|
||||||
totalDocs: result.totalDocs,
|
totalDocs: result.totalDocs,
|
||||||
|
|
@ -221,7 +221,7 @@ export const loadOrganizationDetail = async (
|
||||||
kind: organization.kind as OrganizationKind,
|
kind: organization.kind as OrganizationKind,
|
||||||
notes: organization.notes ?? null,
|
notes: organization.notes ?? null,
|
||||||
municipalityIDs,
|
municipalityIDs,
|
||||||
municipalityNames: municipalityIDs.map((id) => municipalityNames.get(id) ?? 'Praça'),
|
municipalityNames: municipalityIDs.map((id) => municipalityNames.get(id) ?? 'Município'),
|
||||||
leaderships: leaderships.docs.map((leadership) => {
|
leaderships: leaderships.docs.map((leadership) => {
|
||||||
const contact = leadership.contact
|
const contact = leadership.contact
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ export const resolveSupporterListUrl = (
|
||||||
})
|
})
|
||||||
|
|
||||||
export const getSupporterScopeLabel = (total: number): string =>
|
export const getSupporterScopeLabel = (total: number): string =>
|
||||||
`${total} ${total === 1 ? 'apoiador nas suas Praças' : 'apoiadores nas suas Praças'}`
|
`${total} ${total === 1 ? 'apoiador nos seus municípios' : 'apoiadores nos seus municípios'}`
|
||||||
|
|
||||||
/** Staff roles with supporter-area access — matches collection-level supporter access. */
|
/** Staff roles with supporter-area access — matches collection-level supporter access. */
|
||||||
export const canAccessSupporterArea = (role: CampaignUser['role']): boolean =>
|
export const canAccessSupporterArea = (role: CampaignUser['role']): boolean =>
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ test.describe('Planos de ação — registro-fundação', () => {
|
||||||
await page.getByLabel('Título *').fill(planTitle)
|
await page.getByLabel('Título *').fill(planTitle)
|
||||||
await page.getByLabel('Tipo de ação *').selectOption('caminhada')
|
await page.getByLabel('Tipo de ação *').selectOption('caminhada')
|
||||||
await page.getByLabel('Origem da ação').selectOption('obrigacao_politica')
|
await page.getByLabel('Origem da ação').selectOption('obrigacao_politica')
|
||||||
await page.getByLabel('Praça *').selectOption(String(municipality.id))
|
await page.getByLabel('Município *').selectOption(String(municipality.id))
|
||||||
|
|
||||||
await page.getByRole('button', { name: 'Adicionar demanda' }).click()
|
await page.getByRole('button', { name: 'Adicionar demanda' }).click()
|
||||||
await page.getByLabel('Título da demanda 1').fill(transportDemand)
|
await page.getByLabel('Título da demanda 1').fill(transportDemand)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue