Skip to content

Commit 84080e2

Browse files
committed
accepted proposals
1 parent 668583d commit 84080e2

File tree

3 files changed

+91
-37
lines changed

3 files changed

+91
-37
lines changed
Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,50 @@
1+
import {
2+
CardPart,
3+
FilterBar,
4+
Heading,
5+
HorizontalStack,
6+
MultiplePartsCard,
7+
MultiplePartsCardCollection,
8+
Section,
9+
} from "@python-italia/pycon-styleguide";
10+
import { FormattedMessage } from "react-intl";
11+
import { VotingCard } from "~/components/voting-card";
12+
import { useCurrentLanguage } from "~/locale/context";
13+
import { useAcceptedProposalsQuery } from "~/types";
14+
115
export const AcceptedProposalsContent = () => {
2-
return <div>accepted proposals</div>;
16+
const language = useCurrentLanguage();
17+
const {
18+
data: {
19+
conference: { submissions },
20+
},
21+
} = useAcceptedProposalsQuery({
22+
variables: {
23+
code: process.env.conferenceCode,
24+
language,
25+
},
26+
});
27+
28+
return (
29+
<Section>
30+
<MultiplePartsCardCollection>
31+
<MultiplePartsCard>
32+
<CardPart contentAlign="left" overflow={true}>
33+
<HorizontalStack justifyContent="spaceBetween" alignItems="center">
34+
<Heading size={2}>
35+
<FormattedMessage id="voting.proposals" />
36+
</Heading>
37+
</HorizontalStack>
38+
</CardPart>
39+
</MultiplePartsCard>
40+
{submissions.map((submission) => (
41+
<VotingCard
42+
key={submission.id}
43+
submission={submission}
44+
showVotingUI={false}
45+
/>
46+
))}
47+
</MultiplePartsCardCollection>
48+
</Section>
49+
);
350
};

frontend/src/components/blocks/dynamic-content-display-section/accepted-proposals.graphql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
#import "../../fragments/submission-accordion.graphql"
2+
13
query AcceptedProposals($code: String!, $language: String!) {
24
conference(code: $code) {
35
id
46
submissions(onlyAccepted: true) {
7+
...submissionAccordion
58
id
69
title(language: $language)
710
speaker {

frontend/src/components/voting-card/index.tsx

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ import { type SubmissionAccordionFragment, useSendVoteMutation } from "~/types";
1717

1818
type Props = {
1919
submission: SubmissionAccordionFragment;
20+
showVotingUI?: boolean;
2021
};
2122

2223
export const VotingCard = ({
2324
submission,
25+
showVotingUI = true,
2426
submission: {
2527
id,
2628
title,
@@ -99,42 +101,44 @@ export const VotingCard = ({
99101
>
100102
<Heading size={4}>{title}</Heading>
101103
</CardPart>
102-
<CardPart id="content" contentAlign="left" background="blue">
103-
<InputNumber
104-
values={[
105-
{
106-
value: 1,
107-
label: <FormattedMessage id="voteSelector.notInterested" />,
108-
},
109-
{
110-
value: 2,
111-
label: <FormattedMessage id="voteSelector.maybe" />,
112-
},
113-
{
114-
value: 3,
115-
label: <FormattedMessage id="voteSelector.wantToSee" />,
116-
},
117-
{
118-
value: 4,
119-
label: <FormattedMessage id="voteSelector.mustSee" />,
120-
},
121-
]}
122-
value={submission?.myVote?.value}
123-
onClick={onSubmitVote}
124-
/>
125-
126-
<Text size={3} color="error">
127-
{error?.message}
128-
{submissionData &&
129-
submissionData.sendVote.__typename === "SendVoteErrors" && (
130-
<>
131-
{submissionData.sendVote.errors.nonFieldErrors}{" "}
132-
{submissionData.sendVote.errors.validationSubmission}{" "}
133-
{submissionData.sendVote.errors.validationValue}
134-
</>
135-
)}
136-
</Text>
137-
</CardPart>
104+
{showVotingUI && (
105+
<CardPart id="content" contentAlign="left" background="blue">
106+
<InputNumber
107+
values={[
108+
{
109+
value: 1,
110+
label: <FormattedMessage id="voteSelector.notInterested" />,
111+
},
112+
{
113+
value: 2,
114+
label: <FormattedMessage id="voteSelector.maybe" />,
115+
},
116+
{
117+
value: 3,
118+
label: <FormattedMessage id="voteSelector.wantToSee" />,
119+
},
120+
{
121+
value: 4,
122+
label: <FormattedMessage id="voteSelector.mustSee" />,
123+
},
124+
]}
125+
value={submission?.myVote?.value}
126+
onClick={onSubmitVote}
127+
/>
128+
129+
<Text size={3} color="error">
130+
{error?.message}
131+
{submissionData &&
132+
submissionData.sendVote.__typename === "SendVoteErrors" && (
133+
<>
134+
{submissionData.sendVote.errors.nonFieldErrors}{" "}
135+
{submissionData.sendVote.errors.validationSubmission}{" "}
136+
{submissionData.sendVote.errors.validationValue}
137+
</>
138+
)}
139+
</Text>
140+
</CardPart>
141+
)}
138142
<CardPart id="content" contentAlign="left" background="white" size="none">
139143
<Grid cols={12} gap="none" divide={true}>
140144
<GridColumn colSpan={8}>

0 commit comments

Comments
 (0)