Skip to content

Commit d1050c1

Browse files
committed
Use Participant in grant type
1 parent bd31842 commit d1050c1

File tree

7 files changed

+15
-31
lines changed

7 files changed

+15
-31
lines changed

backend/api/grants/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ def from_model(cls, grant: GrantModel) -> Grant:
6464
notes=grant.notes,
6565
travelling_from=grant.travelling_from,
6666
applicant_reply_deadline=grant.applicant_reply_deadline,
67-
participant=participant,
67+
participant=Participant.from_model(participant),
6868
)

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

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,6 @@ export const GrantForm = ({
143143
},
144144
});
145145

146-
const { data: participantData } = useParticipantDataQuery({
147-
variables: {
148-
conference: conference,
149-
},
150-
});
151-
152146
const inputPlaceholderText = useTranslatedMessage("input.placeholder");
153147
const { user, loading: loadingUser } = useCurrentUser({});
154148
const [formState, formOptions] = useFormState<GrantFormFields>(
@@ -208,34 +202,28 @@ export const GrantForm = ({
208202
formState.setField("notes", grant.notes);
209203
formState.setField("travellingFrom", grant.travellingFrom);
210204

211-
if (participantData.me.participant) {
212-
formState.setField(
213-
"participantBio",
214-
participantData.me.participant.bio,
215-
);
216-
formState.setField(
217-
"participantWebsite",
218-
participantData.me.participant.website,
219-
);
205+
if (grant.participant) {
206+
formState.setField("participantBio", grant.participant.bio);
207+
formState.setField("participantWebsite", grant.participant.website);
220208
formState.setField(
221209
"participantTwitterHandle",
222-
participantData.me.participant.twitterHandle,
210+
grant.participant.twitterHandle,
223211
);
224212
formState.setField(
225213
"participantInstagramHandle",
226-
participantData.me.participant.instagramHandle,
214+
grant.participant.instagramHandle,
227215
);
228216
formState.setField(
229217
"participantLinkedinUrl",
230-
participantData.me.participant.linkedinUrl,
218+
grant.participant.linkedinUrl,
231219
);
232220
formState.setField(
233221
"participantFacebookUrl",
234-
participantData.me.participant.facebookUrl,
222+
grant.participant.facebookUrl,
235223
);
236224
formState.setField(
237225
"participantMastodonHandle",
238-
participantData.me.participant.mastodonHandle,
226+
grant.participant.mastodonHandle,
239227
);
240228
}
241229
formState.setField("acceptedPrivacyPolicy", true);
@@ -668,7 +656,6 @@ export const GrantForm = ({
668656
<Spacer size="medium" />
669657

670658
<PublicProfileCard
671-
me={participantData.me}
672659
formOptions={formOptions}
673660
photoRequired={false}
674661
getParticipantValidationError={(field) =>

frontend/src/components/public-profile-card/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export type ParticipantFormFields = {
3030

3131
type Props<T extends ParticipantFormFields> = {
3232
formOptions: Inputs<T>;
33-
me: {
33+
me?: {
3434
participant?: {
3535
photo?: string;
3636
};

frontend/src/components/schedule-view/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export type Keynote = {
2525
};
2626

2727
type Participant = {
28-
photo: string;
28+
photo?: string;
2929
};
3030

3131
export type Item = {

frontend/src/pages/grants/edit/index.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const GrantPage = (): JSX.Element => {
2424
variables: {
2525
conference: code,
2626
},
27-
skip: typeof window === "undefined",
2827
});
2928

3029
const grant = data?.me?.grant;
@@ -97,9 +96,6 @@ export const getServerSideProps: GetServerSideProps = async ({
9796
queryCurrentUser(client, {
9897
conference: process.env.conferenceCode,
9998
}),
100-
queryParticipantData(client, {
101-
conference: process.env.conferenceCode,
102-
}),
10399
]);
104100
} catch (e) {
105101
return {

frontend/src/pages/grants/edit/my-grant.graphql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ query MyGrant($conference: String!) {
3333
linkedinUrl
3434
facebookUrl
3535
mastodonHandle
36+
37+
fullname
38+
publicProfile
39+
userId
3640
}
3741
}
3842
}

frontend/src/pages/grants/index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@ export const getServerSideProps: GetServerSideProps = async ({
120120
queryCurrentUser(client, {
121121
conference: process.env.conferenceCode,
122122
}),
123-
queryParticipantData(client, {
124-
conference: process.env.conferenceCode,
125-
}),
126123
]);
127124

128125
if (grant) {

0 commit comments

Comments
 (0)