From f1de4a63b7bc0c14a984450b5dae8265f86733e8 Mon Sep 17 00:00:00 2001 From: Ole Wieners Date: Thu, 25 Jul 2024 14:17:55 +0200 Subject: [PATCH 01/11] Add Tobira tab to event details modal This adapts the Tobira details component from series details to be usable in both series and event context. Note that an Opencast patch (todo: link that patch) is necessary for this to work. --- ...ailsTobiraTab.tsx => DetailsTobiraTab.tsx} | 52 +++++++------ .../ModalTabsAndPages/NewTobiraPage.tsx | 3 - .../events/partials/modals/EventDetails.tsx | 72 +++++++----------- .../events/partials/modals/SeriesDetails.tsx | 44 +++-------- .../adminui/languages/lang-en_US.json | 10 ++- src/selectors/eventDetailsSelectors.ts | 5 ++ src/slices/eventDetailsSlice.ts | 74 +++++++++++++++++++ src/slices/seriesDetailsSlice.ts | 2 +- src/styles/views/modals/_event-series.scss | 1 + 9 files changed, 160 insertions(+), 103 deletions(-) rename src/components/events/partials/ModalTabsAndPages/{SeriesDetailsTobiraTab.tsx => DetailsTobiraTab.tsx} (67%) diff --git a/src/components/events/partials/ModalTabsAndPages/SeriesDetailsTobiraTab.tsx b/src/components/events/partials/ModalTabsAndPages/DetailsTobiraTab.tsx similarity index 67% rename from src/components/events/partials/ModalTabsAndPages/SeriesDetailsTobiraTab.tsx rename to src/components/events/partials/ModalTabsAndPages/DetailsTobiraTab.tsx index c7a7416642..dd012fb270 100644 --- a/src/components/events/partials/ModalTabsAndPages/SeriesDetailsTobiraTab.tsx +++ b/src/components/events/partials/ModalTabsAndPages/DetailsTobiraTab.tsx @@ -4,22 +4,32 @@ import { useAppDispatch, useAppSelector } from "../../../../store"; import { getSeriesDetailsTobiraData, getSeriesDetailsTobiraDataError } from "../../../../selectors/seriesDetailsSelectors"; import { addNotification } from "../../../../slices/notificationSlice"; import { NOTIFICATION_CONTEXT } from "../../../../configs/modalConfig"; +import { getEventDetailsTobiraData, getEventDetailsTobiraDataError } from "../../../../selectors/eventDetailsSelectors"; /** - * This component renders the theme page for new series in the new series wizard. + * This component renders the Tobira tab for new series and events + * in their respective details modal. */ -const SeriesDetailsTobiraTab = ({ - seriesId -}: { - seriesId: string, -}) => { +type DetailsTobiraTabProps = { + kind: "series" | "event"; + id: string; +} +const DetailsTobiraTab = ({ kind, id }: DetailsTobiraTabProps) => { const { t } = useTranslation(); const dispatch = useAppDispatch(); - const tobiraData = useAppSelector(state => getSeriesDetailsTobiraData(state)); - const error = useAppSelector(state => getSeriesDetailsTobiraDataError(state)); + const tobiraData = useAppSelector(state => kind === "series" + ? getSeriesDetailsTobiraData(state) + : getEventDetailsTobiraData(state) + ); + const error = useAppSelector(state => kind === "series" + ? getSeriesDetailsTobiraDataError(state) + : getEventDetailsTobiraDataError(state) + ); - const directTobiraLink = tobiraData.baseURL + '/!s/:' + seriesId; + const i18nKey = kind === "series" ? "SERIES" : "EVENTS"; + const prefix = kind === "series" ? "s" : "v"; + const directTobiraLink = tobiraData.baseURL + `/!${prefix}/:` + id; const copyTobiraDirectLink = () => { navigator.clipboard.writeText(directTobiraLink).then(function () { @@ -49,30 +59,30 @@ const SeriesDetailsTobiraTab = ({
- {t("EVENTS.SERIES.DETAILS.TABS.TOBIRA")} + {t(`EVENTS.${i18nKey}.DETAILS.TABS.TOBIRA`)}
{ !error && <>
- {t("EVENTS.SERIES.DETAILS.TOBIRA.DIRECT_LINK")} + {t(`EVENTS.${i18nKey}.DETAILS.TOBIRA.DIRECT_LINK`)}