@@ -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 ;
@@ -601,7 +614,36 @@ export function CompanyFormPageClient({
601614 Upload a PDF or image as evidence for this document.
602615 </ DialogDescription >
603616 </ DialogHeader >
604- < div className = "space-y-4" >
617+ < div ref = { setUploadSelectPortalRoot } className = "min-w-0 space-y-4 overflow-visible" >
618+ { isMeeting && (
619+ < Field >
620+ < div className = "flex flex-row items-center gap-4" >
621+ < div className = "shrink-0" >
622+ < FieldLabel htmlFor = "upload-meeting-type" > Meeting type</ FieldLabel >
623+ </ div >
624+ < div className = "min-w-0 flex-1" >
625+ < Select
626+ value = { selectedMeetingType }
627+ onValueChange = { ( value ) => setSelectedMeetingType ( value as MeetingSubType ) }
628+ >
629+ < SelectTrigger id = "upload-meeting-type" >
630+ < SelectValue placeholder = "Select meeting type" >
631+ { meetingSubTypes . find ( ( m ) => m . value === selectedMeetingType ) ?. label ??
632+ 'Select meeting type' }
633+ </ SelectValue >
634+ </ SelectTrigger >
635+ < SelectContent container = { uploadSelectPortalRoot } >
636+ { meetingSubTypes . map ( ( option ) => (
637+ < SelectItem key = { option . value } value = { option . value } >
638+ { option . label }
639+ </ SelectItem >
640+ ) ) }
641+ </ SelectContent >
642+ </ Select >
643+ </ div >
644+ </ div >
645+ </ Field >
646+ ) }
605647 < input
606648 ref = { fileInputRef }
607649 type = "file"
0 commit comments