@@ -4,7 +4,9 @@ import { conciseFormDescriptions } from '@/app/(app)/[orgId]/documents/form-desc
44import {
55 evidenceFormDefinitions ,
66 meetingSubTypeValues ,
7+ meetingSubTypes ,
78 type EvidenceFormType ,
9+ type MeetingSubType ,
810} from '@/app/(app)/[orgId]/documents/forms' ;
911import { api } from '@/lib/api-client' ;
1012import { useActiveMember } from '@/utils/auth-client' ;
@@ -27,6 +29,8 @@ import {
2729 EmptyHeader ,
2830 EmptyMedia ,
2931 EmptyTitle ,
32+ Field ,
33+ FieldLabel ,
3034 InputGroup ,
3135 InputGroupAddon ,
3236 InputGroupInput ,
@@ -61,6 +65,13 @@ import {
6165 DialogHeader ,
6266 DialogTitle ,
6367} from '@trycompai/ui/dialog' ;
68+ import {
69+ Select ,
70+ SelectContent ,
71+ SelectItem ,
72+ SelectTrigger ,
73+ SelectValue ,
74+ } from '@trycompai/ui/select' ;
6475import Link from 'next/link' ;
6576import { useRouter , useSearchParams } from 'next/navigation' ;
6677import { useCallback , useMemo , useRef , useState } from 'react' ;
@@ -160,6 +171,8 @@ export function CompanyFormPageClient({
160171 const [ isUploadOpen , setIsUploadOpen ] = useState ( false ) ;
161172 const [ isUploading , setIsUploading ] = useState ( false ) ;
162173 const [ selectedFile , setSelectedFile ] = useState < File | null > ( null ) ;
174+ const [ selectedMeetingType , setSelectedMeetingType ] = useState < MeetingSubType > ( 'board-meeting' ) ;
175+ const [ uploadSelectPortalRoot , setUploadSelectPortalRoot ] = useState < HTMLDivElement | null > ( null ) ;
163176 const fileInputRef = useRef < HTMLInputElement > ( null ) ;
164177 const [ deleteDialogOpen , setDeleteDialogOpen ] = useState ( false ) ;
165178 const [ submissionToDelete , setSubmissionToDelete ] = useState < EvidenceSubmissionRow | null > ( null ) ;
@@ -297,7 +310,7 @@ export function CompanyFormPageClient({
297310 setIsUploading ( true ) ;
298311 try {
299312 const fileData = await fileToBase64 ( selectedFile ) ;
300- const submitFormType = isMeeting ? MEETING_SUB_TYPES [ 0 ] : formType ;
313+ const submitFormType = isMeeting ? selectedMeetingType : formType ;
301314
302315 const response = await api . post (
303316 `/v1/evidence-forms/${ submitFormType } /upload-submission` ,
@@ -329,7 +342,7 @@ export function CompanyFormPageClient({
329342 } finally {
330343 setIsUploading ( false ) ;
331344 }
332- } , [ selectedFile , isMeeting , formType , organizationId , query , globalMutate ] ) ;
345+ } , [ selectedFile , selectedMeetingType , isMeeting , formType , organizationId , query , globalMutate ] ) ;
333346
334347 const handleConfirmDelete = useCallback ( async ( ) => {
335348 if ( ! submissionToDelete ) return ;
@@ -589,7 +602,36 @@ export function CompanyFormPageClient({
589602 Upload a PDF or image as evidence for this document.
590603 </ DialogDescription >
591604 </ DialogHeader >
592- < div className = "space-y-4" >
605+ < div ref = { setUploadSelectPortalRoot } className = "min-w-0 space-y-4 overflow-visible" >
606+ { isMeeting && (
607+ < Field >
608+ < div className = "flex flex-row items-center gap-4" >
609+ < div className = "shrink-0" >
610+ < FieldLabel htmlFor = "upload-meeting-type" > Meeting type</ FieldLabel >
611+ </ div >
612+ < div className = "min-w-0 flex-1" >
613+ < Select
614+ value = { selectedMeetingType }
615+ onValueChange = { ( value ) => setSelectedMeetingType ( value as MeetingSubType ) }
616+ >
617+ < SelectTrigger id = "upload-meeting-type" >
618+ < SelectValue placeholder = "Select meeting type" >
619+ { meetingSubTypes . find ( ( m ) => m . value === selectedMeetingType ) ?. label ??
620+ 'Select meeting type' }
621+ </ SelectValue >
622+ </ SelectTrigger >
623+ < SelectContent container = { uploadSelectPortalRoot } >
624+ { meetingSubTypes . map ( ( option ) => (
625+ < SelectItem key = { option . value } value = { option . value } >
626+ { option . label }
627+ </ SelectItem >
628+ ) ) }
629+ </ SelectContent >
630+ </ Select >
631+ </ div >
632+ </ div >
633+ </ Field >
634+ ) }
593635 < input
594636 ref = { fileInputRef }
595637 type = "file"
0 commit comments