From 80f858644394e9bdafb17435ecafc2a0fb82424b Mon Sep 17 00:00:00 2001 From: Marco Acierno Date: Thu, 13 Feb 2025 15:38:55 +0100 Subject: [PATCH] basic filter --- .../accepted-proposals-content.tsx | 49 ++++++++++++++++++- .../speakers-content.tsx | 26 +++++----- frontend/src/locale/index.ts | 10 ++++ 3 files changed, 69 insertions(+), 16 deletions(-) diff --git a/frontend/src/components/blocks/dynamic-content-display-section/accepted-proposals-content.tsx b/frontend/src/components/blocks/dynamic-content-display-section/accepted-proposals-content.tsx index f2698f3edf..58e1cadd0b 100644 --- a/frontend/src/components/blocks/dynamic-content-display-section/accepted-proposals-content.tsx +++ b/frontend/src/components/blocks/dynamic-content-display-section/accepted-proposals-content.tsx @@ -1,19 +1,24 @@ import { CardPart, + Grid, Heading, HorizontalStack, MultiplePartsCard, MultiplePartsCardCollection, Section, + Text, + VerticalStack, } from "@python-italia/pycon-styleguide"; +import React from "react"; import { FormattedMessage } from "react-intl"; import { VotingCard } from "~/components/voting-card"; import { useCurrentLanguage } from "~/locale/context"; import { useAcceptedProposalsQuery } from "~/types"; export const AcceptedProposalsContent = () => { + const [filterBy, setFilterBy] = React.useState(null); const language = useCurrentLanguage(); - const { + let { data: { submissions: { items: submissions }, }, @@ -24,6 +29,16 @@ export const AcceptedProposalsContent = () => { }, }); + if (filterBy === "talks") { + submissions = submissions.filter( + (submission) => submission.type.name.toLowerCase() === "talk", + ); + } else if (filterBy === "workshops") { + submissions = submissions.filter( + (submission) => submission.type.name.toLowerCase() === "workshop", + ); + } + return (
@@ -33,6 +48,38 @@ export const AcceptedProposalsContent = () => { + + + + + +
+ setFilterBy(null)} + > + + + setFilterBy("talks")} + > + + + setFilterBy("workshops")} + > + + +
+
diff --git a/frontend/src/components/blocks/dynamic-content-display-section/speakers-content.tsx b/frontend/src/components/blocks/dynamic-content-display-section/speakers-content.tsx index d244270067..cab2b99758 100644 --- a/frontend/src/components/blocks/dynamic-content-display-section/speakers-content.tsx +++ b/frontend/src/components/blocks/dynamic-content-display-section/speakers-content.tsx @@ -35,21 +35,17 @@ export const SpeakersContent = () => {
{Object.entries(submissionsBySpeaker).map( - ([speakerId, submissions]) => { - let title = submissions[0].title; - if (submissions.length > 1) { - title = `${title} (+${submissions.length - 1})`; - } - return ( - - - - ); - }, + ([speakerId, submissions]) => ( + + submission.title) + .join(",")} + /> + + ), )}
diff --git a/frontend/src/locale/index.ts b/frontend/src/locale/index.ts index 86d7664434..66c22a2c9a 100644 --- a/frontend/src/locale/index.ts +++ b/frontend/src/locale/index.ts @@ -26,6 +26,11 @@ export const messages = { "checkout.billing.businessInvoice.description": "Turn this option on if your company, university or similar is paying for you or if you need an invoice.", + "voting.talks": "Talks", + "voting.workshops": "Workshops", + "voting.filterBy": "Filter by", + "voting.all": "All", + "sponsorLeadModal.title": "Download our brochure", "sponsorLeadModal.submit": "Submit", "sponsorLeadModal.body": `Our packages gives you an idea of what we offer and how you can optimize your presence at PyCon Italia, but are not set in stone! @@ -1939,6 +1944,8 @@ Affrettati a comprare il biglietto!`, "scheduleEventDetail.materials.download": "Scarica ({mimeType})", "voting.speaker": "Speaker", + "voting.talks": "Talks", + "voting.workshops": "Workshops", "global.sessions": "Sessioni", @@ -2279,6 +2286,9 @@ Clicca sulla casella per cambiare. Se lasciato vuoto, presumeremo che tu sia dis "Il form aprirà il {date}. Segui i nostri socials per aggiornamenti e cambiamenti.", "requestInvitationLetter.formClosed": "Il form è chiuso. Se hai domande, contattaci.", + + "voting.filterBy": "Filtra per", + "voting.all": "Tutti", }, };