From 2ca90298d52ba7d62c9099943d25506870f27759 Mon Sep 17 00:00:00 2001 From: Andy Espagnolo Date: Thu, 28 Sep 2023 10:53:25 -0300 Subject: [PATCH] fix: title fields validation and change poll max length title (#1299) --- src/entities/Proposal/types.ts | 2 +- src/pages/submit/governance.tsx | 4 ++-- src/pages/submit/pitch.tsx | 10 ++++++++-- src/pages/submit/tender.tsx | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/entities/Proposal/types.ts b/src/entities/Proposal/types.ts index e134cbda3..4744fe3a7 100644 --- a/src/entities/Proposal/types.ts +++ b/src/entities/Proposal/types.ts @@ -231,7 +231,7 @@ export const newProposalPollScheme = { title: { type: 'string', minLength: 5, - maxLength: 200, + maxLength: 80, }, description: { type: 'string', diff --git a/src/pages/submit/governance.tsx b/src/pages/submit/governance.tsx index bec207b30..9a7e6e568 100644 --- a/src/pages/submit/governance.tsx +++ b/src/pages/submit/governance.tsx @@ -160,8 +160,8 @@ export default function SubmitGovernanceProposal() { name="title" rules={{ required: { value: true, message: t('error.governance.title_empty') }, - min: { value: schema.title.minLength, message: t('error.governance.title_too_short') }, - max: { value: schema.title.maxLength, message: t('error.governance.title_too_long') }, + minLength: { value: schema.title.minLength, message: t('error.governance.title_too_short') }, + maxLength: { value: schema.title.maxLength, message: t('error.governance.title_too_large') }, }} error={!!errors.title} loading={isLoadingVpDistribution} diff --git a/src/pages/submit/pitch.tsx b/src/pages/submit/pitch.tsx index 9221d8cc1..24e662ba4 100644 --- a/src/pages/submit/pitch.tsx +++ b/src/pages/submit/pitch.tsx @@ -116,8 +116,14 @@ export default function SubmitPitchProposal() { name="initiative_name" rules={{ required: { value: true, message: t('error.pitch.initiative_name_empty') }, - min: { value: schema.initiative_name.minLength, message: t('error.pitch.initiative_name_too_short') }, - max: { value: schema.initiative_name.maxLength, message: t('error.pitch.initiative_name_too_long') }, + minLength: { + value: schema.initiative_name.minLength, + message: t('error.pitch.initiative_name_too_short'), + }, + maxLength: { + value: schema.initiative_name.maxLength, + message: t('error.pitch.initiative_name_too_large'), + }, }} error={!!errors.initiative_name} loading={isLoadingVpDistribution} diff --git a/src/pages/submit/tender.tsx b/src/pages/submit/tender.tsx index e39af8dc4..0f858d863 100644 --- a/src/pages/submit/tender.tsx +++ b/src/pages/submit/tender.tsx @@ -157,8 +157,8 @@ export default function SubmitTenderProposal() { name="project_name" rules={{ required: { value: true, message: t('error.tender.project_name_empty') }, - min: { value: schema.project_name.minLength, message: t('error.tender.project_name_too_short') }, - max: { value: schema.project_name.maxLength, message: t('error.tender.project_name_too_long') }, + minLength: { value: schema.project_name.minLength, message: t('error.tender.project_name_too_short') }, + maxLength: { value: schema.project_name.maxLength, message: t('error.tender.project_name_too_large') }, }} error={!!errors.project_name} loading={isLoadingVpDistribution}