@@ -32,6 +32,30 @@ import { AvailabilitySection } from "./availability-section";
3232import { MaterialsSection } from "./materials-section" ;
3333import { ProposalSection } from "./proposal-section" ;
3434
35+ export type GetErrorsKey =
36+ | "validationTitle"
37+ | "validationAbstract"
38+ | "validationLanguages"
39+ | "validationType"
40+ | "validationDuration"
41+ | "validationElevatorPitch"
42+ | "validationNotes"
43+ | "validationAudienceLevel"
44+ | "validationTags"
45+ | "validationSpeakerLevel"
46+ | "validationPreviousTalkVideo"
47+ | "validationShortSocialSummary"
48+ | "validationSpeakerBio"
49+ | "validationSpeakerWebsite"
50+ | "validationSpeakerPhoto"
51+ | "validationSpeakerTwitterHandle"
52+ | "validationSpeakerInstagramHandle"
53+ | "validationSpeakerLinkedinUrl"
54+ | "validationSpeakerFacebookUrl"
55+ | "validationSpeakerMastodonHandle"
56+ | "validationMaterials"
57+ | "nonFieldErrors" ;
58+
3559export type CfpFormFields = ParticipantFormFields & {
3660 type : string ;
3761 title : { it ?: string ; en ?: string } ;
@@ -51,7 +75,9 @@ export type CfpFormFields = ParticipantFormFields & {
5175} ;
5276
5377export type SubmissionStructure = {
78+ id : string ;
5479 type : { id : string } ;
80+ status : string ;
5581 title : string ;
5682 elevatorPitch : string ;
5783 abstract : string ;
@@ -66,6 +92,14 @@ export type SubmissionStructure = {
6692 speakerLevel : string ;
6793 tags : { id : string } [ ] ;
6894 shortSocialSummary : string ;
95+ materials : {
96+ id : string ;
97+ name : string ;
98+ url : string ;
99+ fileId : string ;
100+ fileUrl : string ;
101+ fileMimeType : string ;
102+ } [ ] ;
69103} ;
70104
71105type Props = {
@@ -173,6 +207,7 @@ export const CfpForm = ({
173207 participantData . me . participant ?. photoId ,
174208 acceptedPrivacyPolicy : formState . values . acceptedPrivacyPolicy ,
175209 speakerAvailabilities : formState . values . speakerAvailabilities ,
210+ materials : formState . values . materials ,
176211 } ) ;
177212 } ;
178213
@@ -223,6 +258,16 @@ export const CfpForm = ({
223258 ) ;
224259 formState . setField ( "shortSocialSummary" , submission ! . shortSocialSummary ) ;
225260 formState . setField ( "acceptedPrivacyPolicy" , true ) ;
261+ formState . setField (
262+ "materials" ,
263+ submission ! . materials . map ( ( material ) => ( {
264+ type : material . fileId ? "file" : "link" ,
265+ id : material . id ,
266+ fileId : material . fileId ,
267+ url : material . url ,
268+ name : material . name ,
269+ } ) ) ,
270+ ) ;
226271 }
227272
228273 if ( participantData . me . participant ) {
@@ -274,30 +319,7 @@ export const CfpForm = ({
274319 submissionData ?. mutationOp . __typename === "SendSubmissionErrors" ;
275320
276321 /* todo refactor to avoid multiple __typename? */
277- const getErrors = (
278- key :
279- | "validationTitle"
280- | "validationAbstract"
281- | "validationLanguages"
282- | "validationType"
283- | "validationDuration"
284- | "validationElevatorPitch"
285- | "validationNotes"
286- | "validationAudienceLevel"
287- | "validationTags"
288- | "validationSpeakerLevel"
289- | "validationPreviousTalkVideo"
290- | "validationShortSocialSummary"
291- | "validationSpeakerBio"
292- | "validationSpeakerWebsite"
293- | "validationSpeakerPhoto"
294- | "validationSpeakerTwitterHandle"
295- | "validationSpeakerInstagramHandle"
296- | "validationSpeakerLinkedinUrl"
297- | "validationSpeakerFacebookUrl"
298- | "validationSpeakerMastodonHandle"
299- | "nonFieldErrors" ,
300- ) : string [ ] =>
322+ const getErrors = ( key : GetErrorsKey ) : string [ ] =>
301323 ( submissionData ?. mutationOp . __typename === "SendSubmissionErrors" &&
302324 submissionData ! . mutationOp . errors [ key ] ) ||
303325 [ ] ;
@@ -331,14 +353,19 @@ export const CfpForm = ({
331353 conferenceData = { conferenceData }
332354 />
333355
334- < Spacer size = "medium" />
356+ { submission ?. status === "accepted" && (
357+ < >
358+ < Spacer size = "medium" />
335359
336- < MaterialsSection
337- formState = { formState }
338- getErrors = { getErrors }
339- formOptions = { formOptions }
340- conferenceData = { conferenceData }
341- />
360+ < MaterialsSection
361+ formState = { formState }
362+ getErrors = { getErrors }
363+ formOptions = { formOptions }
364+ conferenceData = { conferenceData }
365+ submission = { submission }
366+ />
367+ </ >
368+ ) }
342369
343370 < Spacer size = "medium" />
344371
0 commit comments