mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-13 15:13:07 +00:00
Fase 2 do plano aprovado. Três módulos em src/utilities/contacts/:
- contactListUrl: contrato de params (q|gender|state|city|ausencia|vinculo|sort|dir|page),
canonicalize, hrefs de sort e where de fonte com 'phones.value' like (ILIKE verificado
no Postgres local).
- contactListData: loader com UM find em contact (user threadado, overrideAccess false),
vínculos (liderancas/dobradinhas/assessores/equipe) como facets sobre o conjunto
legível, filtro/sort/paginação em memória, nulos no fim (precedente B15).
- contactNameInvariant: lock contact-name:{normalized} + prefilter ILIKE + veredito
exato em memória; mensagem de conflito pt-BR.
38 testes unit novos; format + tsc limpos.
31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
import {
|
|
homeActionsForRole,
|
|
toHomeActionButtonProps,
|
|
type ResolvedCampaignHomeAction,
|
|
} from '@/lib/campaignHomeActions'
|
|
import type { CampaignQuickActionContext } from '@/lib/campaignQuickActionContext'
|
|
import type { CampaignQuickAction } from '@/lib/campaignQuickActionTypes'
|
|
import type { CampaignRole } from '@/lib/campaignRoles'
|
|
|
|
/** In-page anchors on `/campanha/meus-contatos` — hash navigation from the B89 drawer. */
|
|
export const LEADER_CONTACT_FORM_HASH = '#leader-contact-form' as const
|
|
export const LEADER_CONTACTS_LIST_HASH = '#leader-contacts-list' as const
|
|
|
|
const toLeaderContactsQuickAction = (action: ResolvedCampaignHomeAction): CampaignQuickAction => {
|
|
if (action.id === 'register-supporter') {
|
|
return { ...action, href: LEADER_CONTACT_FORM_HASH }
|
|
}
|
|
if (action.id === 'my-contacts') {
|
|
return { ...action, href: LEADER_CONTACTS_LIST_HASH }
|
|
}
|
|
return action
|
|
}
|
|
|
|
export const resolveLeaderContactsQuickActions = (
|
|
role: CampaignRole,
|
|
_context: CampaignQuickActionContext,
|
|
): readonly CampaignQuickAction[] => {
|
|
if (role !== 'leader') return []
|
|
|
|
return toHomeActionButtonProps(homeActionsForRole('leader')).map(toLeaderContactsQuickAction)
|
|
}
|