Skip to content

Commit 433e752

Browse files
committed
Fix displaying document type
1 parent 66956d4 commit 433e752

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/pages/NewPoll/components/CriteriaSection.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export default function CriteriaSection() {
5454
'nationalities',
5555
getValues('criteria.sex') === Sex.Any ? null : 'sex',
5656
getValues('criteria.minAge') || getValues('criteria.maxAge') ? 'age' : undefined,
57+
getValues('criteria.documentType') ? 'documentType' : undefined,
5758
].filter(Boolean) as CriteriaKey[],
5859
)
5960
const sexOptions = useMemo(

src/pages/NewPoll/createPollSchema.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export const createPollDefaultValues: CreatePollSchema = {
1616
criteria: {
1717
nationalities: [ALL_COUNTRIES_NATIONALITY],
1818
sex: Sex.Any,
19-
documentType: DocumentType.Passport,
2019
},
2120
isRankingBased: false,
2221
questions: [
@@ -90,7 +89,7 @@ export const createPollSchema = zod
9089
codes: zod.array(zod.string().min(1)),
9190
}),
9291
),
93-
documentType: zod.nativeEnum(DocumentType),
92+
documentType: zod.nativeEnum(DocumentType).optional(),
9493
}),
9594
questions: zod
9695
.array(

src/pages/NewPoll/helpers/pollDraftAdapters.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { isBoolean } from 'lodash'
22

33
import { PollDraftSchema } from '@/db/schemas'
4-
import { DocumentType } from '@/types'
54

65
import { CreatePollSchema } from '../createPollSchema'
76

@@ -55,7 +54,7 @@ export const fromPollDraft = (pollDraft: PollDraftSchema): Partial<CreatePollSch
5554
minAge,
5655
maxAge,
5756
sex,
58-
documentType = DocumentType.Passport,
57+
documentType,
5958
questions,
6059
isRankingBased,
6160
} = pollDraft

0 commit comments

Comments
 (0)