mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-14 08:53:11 +00:00
Phase 1 UX: StrictCombobox municipality in SupporterForm, AlertDialog in RemoveSupporterDataButton. Phase 2 DRY: campaignListUrl + CampaignListPagination + campaignFormFields + mapCampaignFormActionError shared across nuclei, supporters and action plans. Phase 3: single SQL aggregate for supporter list KPIs via drizzle in the Payload txn. Phase 4: bulk drizzle insert for CSV import inside the existing Payload txn with ON CONFLICT DO NOTHING, plus a fail-closed skipContactPhoneInvariant context flag. Phase 5: HMAC-signed single-use import token backed by a new supporterImportBatch staging collection so the full ok-row set never crosses the Server Action boundary twice.
21 lines
532 B
TypeScript
21 lines
532 B
TypeScript
export const fieldError = (
|
|
fieldErrors: Record<string, string[]> | undefined,
|
|
field: string,
|
|
): string | undefined => fieldErrors?.[field]?.[0]
|
|
|
|
export const errorProps = (
|
|
fieldErrors: Record<string, string[]> | undefined,
|
|
field: string,
|
|
idPrefix: string,
|
|
): {
|
|
error: string | undefined
|
|
invalid: boolean
|
|
describedBy: string | undefined
|
|
} => {
|
|
const error = fieldError(fieldErrors, field)
|
|
return {
|
|
error,
|
|
invalid: Boolean(error),
|
|
describedBy: error ? `${idPrefix}-${field}-error` : undefined,
|
|
}
|
|
}
|