From 0fe1ffcf2a91c697a880f2141013483c3321e94a Mon Sep 17 00:00:00 2001 From: Thomas KLEIN Date: Tue, 4 Feb 2025 11:16:37 +0100 Subject: [PATCH] Fix add to calendar button --- public/locales/fr/speakers.json | 12 ++++++--- src/components/Program/ProgramTile.tsx | 28 +++++++++++++-------- src/components/Speakers/Session/Session.tsx | 15 ++++++----- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/public/locales/fr/speakers.json b/public/locales/fr/speakers.json index 750f0bb..01b713d 100644 --- a/public/locales/fr/speakers.json +++ b/public/locales/fr/speakers.json @@ -77,7 +77,8 @@ "start": "9h00", "end": "10h30", "tags": ["Ouverture", "Business", "Expertise"], - "speakers": [1] + "speakers": [1], + "eventUrl": null }, { "id": 2, @@ -89,7 +90,8 @@ "start": "9h00", "end": "10h30", "tags": ["Technical", "Expertise"], - "speakers": [2] + "speakers": [2], + "eventUrl": null }, { "id": 3, @@ -101,7 +103,8 @@ "start": "9h00", "end": "10h30", "tags": ["Technical", "Expertise"], - "speakers": [3] + "speakers": [3], + "eventUrl": null }, { "id": 4, @@ -113,7 +116,8 @@ "start": "9h00", "end": "10h30", "tags": ["Technical", "Expertise"], - "speakers": [4] + "speakers": [4], + "eventUrl": null } ] } diff --git a/src/components/Program/ProgramTile.tsx b/src/components/Program/ProgramTile.tsx index 9190a38..f807115 100644 --- a/src/components/Program/ProgramTile.tsx +++ b/src/components/Program/ProgramTile.tsx @@ -1,9 +1,11 @@ import React from "react"; -import { SessionProps } from "../Speakers/Session/SessionProps"; -import Session from "../Speakers/Session/Session"; import { PiCalendarPlus } from "react-icons/pi"; -import Person from "../Person/Person"; import useDataProvider from "@/hooks/useDataProvider"; +import { SessionProps } from "@/components/Speakers/Session/SessionProps"; +import Session from "@/components/Speakers/Session/Session"; +import Person from "@/components/Person/Person"; +import ButtonLink from "@/components/ButtonLink/ButtonLink"; +import Typography from "@/components/Typography/Typography"; const ProgramTile = ({ session }: { session: SessionProps }) => { const dataProvider = useDataProvider(); @@ -12,23 +14,27 @@ const ProgramTile = ({ session }: { session: SessionProps }) => { .filter((speaker) => session.speakers.includes(speaker.id)); return ( -
+
- +
{speakers.map((speaker) => ( ))}
-
-
- - + {!!session.eventUrl && ( +
+ } + > Ajouter à mon agenda - +
-
+ )}
); }; diff --git a/src/components/Speakers/Session/Session.tsx b/src/components/Speakers/Session/Session.tsx index c78dff5..3b20fb1 100644 --- a/src/components/Speakers/Session/Session.tsx +++ b/src/components/Speakers/Session/Session.tsx @@ -8,7 +8,12 @@ import { PiCalendarPlus } from "react-icons/pi"; import ButtonLink from "@/components/ButtonLink/ButtonLink"; import { useTranslation } from "react-i18next"; -const Session = ({ session }: { session: SessionProps }) => { +interface Session { + session: SessionProps; + showAddToCalendar?: boolean; +} + +const Session = ({ session, showAddToCalendar = true }: Session) => { const { t } = useTranslation(["speakers"]); return ( @@ -47,17 +52,15 @@ const Session = ({ session }: { session: SessionProps }) => { ))}
- {!!session.eventUrl && ( + {showAddToCalendar && !!session.eventUrl && (
} + icon={} > - - Ajouter à mon agenda - + Ajouter à mon agenda
)}