Skip to content

Commit 51e45c4

Browse files
committed
Slides upload WIP
1 parent 146c9bf commit 51e45c4

File tree

3 files changed

+87
-2
lines changed

3 files changed

+87
-2
lines changed

frontend/src/components/cfp-form/index.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
} from "../public-profile-card";
3030
import { AboutYouSection } from "./about-you-section";
3131
import { AvailabilitySection } from "./availability-section";
32+
import { MaterialsSection } from "./materials-section";
3233
import { ProposalSection } from "./proposal-section";
3334

3435
export type CfpFormFields = ParticipantFormFields & {
@@ -46,6 +47,7 @@ export type CfpFormFields = ParticipantFormFields & {
4647
shortSocialSummary: string;
4748
acceptedPrivacyPolicy: boolean;
4849
speakerAvailabilities: { [time: number]: null | string };
50+
materials: any[];
4951
};
5052

5153
export type SubmissionStructure = {
@@ -331,6 +333,15 @@ export const CfpForm = ({
331333

332334
<Spacer size="medium" />
333335

336+
<MaterialsSection
337+
formState={formState}
338+
getErrors={getErrors}
339+
formOptions={formOptions}
340+
conferenceData={conferenceData}
341+
/>
342+
343+
<Spacer size="medium" />
344+
334345
<PublicProfileCard
335346
me={participantData.me}
336347
formOptions={formOptions}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import {
2+
Button,
3+
CardPart,
4+
Grid,
5+
Heading,
6+
MultiplePartsCard,
7+
Spacer,
8+
Text,
9+
} from "@python-italia/pycon-styleguide";
10+
import { useCallback } from "react";
11+
import { FormattedMessage } from "react-intl";
12+
import type { FormState, Inputs, StateErrors } from "react-use-form-state";
13+
import type { CfpFormQuery } from "~/types";
14+
import type { CfpFormFields } from ".";
15+
import { FileInput } from "../file-input";
16+
17+
type Props = {
18+
conferenceData: CfpFormQuery;
19+
formState: FormState<CfpFormFields, StateErrors<CfpFormFields>>;
20+
formOptions: Inputs<CfpFormFields>;
21+
getErrors: (field: keyof CfpFormFields) => string[] | null;
22+
};
23+
24+
export const MaterialsSection = ({
25+
conferenceData,
26+
formState,
27+
getErrors,
28+
formOptions,
29+
}: Props) => {
30+
const { raw } = formOptions;
31+
const materials = formState.values.materials ?? [];
32+
33+
const onAdd = useCallback(() => {
34+
const newMaterials = [...materials, {}];
35+
formState.setField("materials", newMaterials);
36+
}, [formState]);
37+
38+
return (
39+
<MultiplePartsCard>
40+
<CardPart contentAlign="left">
41+
<Heading size={3}>
42+
<FormattedMessage id="cfp.materials.title" />
43+
</Heading>
44+
</CardPart>
45+
46+
<CardPart background="milk" contentAlign="left">
47+
<Text size={3}>
48+
<FormattedMessage id="cfp.materials.description" />
49+
</Text>
50+
<Grid cols={1} gap="medium">
51+
{materials.map((material, index) => (
52+
<FileInput
53+
key={index}
54+
{...raw("materials")}
55+
type="proposal_material"
56+
errors={getErrors("materials")}
57+
/>
58+
))}
59+
<div>
60+
<Button size="small" onClick={onAdd}>
61+
<FormattedMessage id="cfp.materials.add" />
62+
</Button>
63+
</div>
64+
</Grid>
65+
</CardPart>
66+
</MultiplePartsCard>
67+
);
68+
};

frontend/src/locale/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,8 @@ Click the box to change. If left empty, we will assume you are available.`,
663663
"orderInformation.invalidFiscalCode": "Fiscal code not valid",
664664
"orderInformation.pec": "PEC",
665665
"orderInformation.sdi": "SDI",
666-
"orderInformation.invalidSDI": "SDI must be 7 characters long (6 for Italian PA)",
666+
"orderInformation.invalidSDI":
667+
"SDI must be 7 characters long (6 for Italian PA)",
667668

668669
"orderQuestions.heading": "Order questions",
669670
"orderQuestions.attendeeGivenName": "Attendee Given name",
@@ -1002,6 +1003,10 @@ If this new timing doesn't work for you, please don't hesitate to let us know be
10021003

10031004
"streaming.qa": "Ask Questions",
10041005

1006+
"cfp.materials.title": "Materials",
1007+
"cfp.materials.description":
1008+
"Upload here the slides or other materials you want to share.",
1009+
10051010
"talk.bookToAttend":
10061011
"This event has limited capacity, you need to book a seat to attend.",
10071012
"talk.bookCta": "Book now",
@@ -1447,7 +1452,8 @@ The sooner you buy your ticket, the more you save!`,
14471452
"orderInformation.invalidFiscalCode": "Codice fiscale non valido",
14481453
"orderInformation.pec": "PEC",
14491454
"orderInformation.sdi": "SDI",
1450-
"orderInformation.invalidSDI": "Il codice SDI deve essere di 7 caratteri (6 per una PA)",
1455+
"orderInformation.invalidSDI":
1456+
"Il codice SDI deve essere di 7 caratteri (6 per una PA)",
14511457

14521458
"orderQuestions.heading": "Domande aggiuntive",
14531459
"orderQuestions.attendeeName": "Nome partecipante",

0 commit comments

Comments
 (0)