From 15480105425fdb025fc203db6a100a08e256ecc6 Mon Sep 17 00:00:00 2001 From: "mateusz.bieniek" Date: Mon, 30 Mar 2026 15:20:59 +0200 Subject: [PATCH 1/9] REK-164 Configure webinars with jitsy, add display webinar pages --- .../Profile/ProfileHeader/index.tsx | 4 +- .../Profile/ProfileLayout/index.tsx | 5 + src/components/Routes/index.tsx | 18 +-- .../Webinar/WebinarMeetModal/index.tsx | 126 +++++++++++++----- src/components/_App/Navbar/index.tsx | 20 +-- src/hooks/useAnalyticsWebsockets.ts | 2 +- src/pages/static-page/index.tsx | 3 + 7 files changed, 124 insertions(+), 54 deletions(-) diff --git a/src/components/Profile/ProfileHeader/index.tsx b/src/components/Profile/ProfileHeader/index.tsx index 972f54195..bf1138668 100644 --- a/src/components/Profile/ProfileHeader/index.tsx +++ b/src/components/Profile/ProfileHeader/index.tsx @@ -29,7 +29,9 @@ const StyledHeader = styled.div<{ withTabs?: boolean }>` const ProfileHeader: React.FC = ({ title, withTabs, actions }) => { return ( - {title} + + {title} + {actions &&
{actions}
}
); diff --git a/src/components/Profile/ProfileLayout/index.tsx b/src/components/Profile/ProfileLayout/index.tsx index 7aafa4be5..24f3ff912 100644 --- a/src/components/Profile/ProfileLayout/index.tsx +++ b/src/components/Profile/ProfileLayout/index.tsx @@ -87,6 +87,11 @@ const ProfileLayout: React.FC = ({ title: t("MyProfilePage.MyConsultations"), url: routeRoutes.myConsultations, }, + { + key: "WEBINARS", + title: t("MyProfilePage.MyWebinars"), + url: routeRoutes.myWebinars, + }, ], [t] ); diff --git a/src/components/Routes/index.tsx b/src/components/Routes/index.tsx index 1cdb67be8..7983d358a 100644 --- a/src/components/Routes/index.tsx +++ b/src/components/Routes/index.tsx @@ -35,8 +35,8 @@ const ConsultationsPage = lazy(() => import("../../pages/consultations")); const ResetPage = lazy(() => import("../../pages/reset-password/index")); // const EventsPage = lazy(() => import("../../pages/events")); // const EventPage = lazy(() => import("../../pages/event")); -// const WebinarsPage = lazy(() => import("../../pages/webinars")); -// const WebinarPage = lazy(() => import("../../pages/webinar")); +const WebinarsPage = lazy(() => import("../../pages/webinars")); +const WebinarPage = lazy(() => import("../../pages/webinar")); // const PackagesPage = lazy(() => import("../../pages/packages")); const PackagePage = lazy(() => import("../../pages/package")); const SubscriptionsPage = lazy(() => import("../../pages/subscriptions")); @@ -62,7 +62,7 @@ const MyConsultationsPage = lazy( const MyDataPage = lazy(() => import("../../pages/user/my-data")); const CourseProgramPage = lazy(() => import("../../pages/course/index")); const CartPage = lazy(() => import("../../pages/cart/index")); -// const MyWebinarsPage = lazy(() => import("../../pages/user/MyWebinars")); +const MyWebinarsPage = lazy(() => import("../../pages/user/MyWebinars")); const MyCertificatesPage = lazy( () => import("../../pages/user/my-certificates") ); @@ -116,9 +116,9 @@ const Routes: React.FC = (): ReactElement => { // myStationaryEvents, // myTasks, // myBookmarks, - // webinars, - // webinar, - // myWebinars, + webinars, + webinar, + myWebinars, // packages, packageProduct, myCertificates, @@ -154,9 +154,9 @@ const Routes: React.FC = (): ReactElement => { {/* - + */} - */} + {/* */} {/* privates pages*/} @@ -164,7 +164,7 @@ const Routes: React.FC = (): ReactElement => { {/* */} - {/* */} + void; @@ -13,11 +18,21 @@ interface Props { webinarId: number; } +const JitsiContainer = styled.div` + position: relative; + width: 100%; + height: 100%; + overflow: hidden; +`; + const WebinarMeetModal = ({ onClose, visible, webinarId }: Props) => { const [webinarMeetData, setWebinarMeetData] = useState( null ); const [loading, setLoading] = useState(false); + const [isEnded, setIsEnded] = useState(false); + const [recordingUrl, setRecordingUrl] = useState(null); + const { generateWebinarJitsy } = useContext(EscolaLMSContext); const { t } = useTranslation(); @@ -25,45 +40,90 @@ const WebinarMeetModal = ({ onClose, visible, webinarId }: Props) => { const getMeetUrl = async () => { setLoading(true); if (webinarId) { - const res = await generateWebinarJitsy(webinarId); - if (res.success) { - setWebinarMeetData((res as { data: JitsyData }).data); - } - if (!res.success) { + try { + const res = await generateWebinarJitsy(webinarId); + if (res.success) { + setWebinarMeetData((res as { data: JitsyData }).data); + } else { + toast(`${t("WebinarPage.ErrorWhileGeneratingUrl")}`, "error"); + onClose(); + } + } catch (error) { + console.error(error); toast(`${t("WebinarPage.ErrorWhileGeneratingUrl")}`, "error"); - onClose(); + } finally { + setLoading(false); } } - setLoading(false); }; - getMeetUrl(); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [webinarId]); + if (visible) { + getMeetUrl(); + } + + return () => { + Object.keys(localStorage).forEach((key) => { + if (key.startsWith("questionnaire_")) { + localStorage.removeItem(key); + } + }); + }; + }, [webinarId, visible, generateWebinarJitsy, t, onClose]); + + useEffect(() => { + if (visible) setIsEnded(false); + }, [visible]); + + const handleOnClose = useCallback(() => { + setIsEnded(true); + onClose(); + window.location.reload(); + }, [onClose]); return ( - - - {loading && } - {!loading && webinarMeetData && ( -