File tree Expand file tree Collapse file tree 4 files changed +48
-1
lines changed
Expand file tree Collapse file tree 4 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -297,6 +297,20 @@ export async function getProctoringInfoData(courseId, username) {
297297 }
298298}
299299
300+ export async function getLiveTabIframe ( courseId ) {
301+ const url = `${ getConfig ( ) . LMS_BASE_URL } /api/course_live/iframe/${ courseId } /` ;
302+ try {
303+ const { data } = await getAuthenticatedHttpClient ( ) . get ( url ) ;
304+ return data ;
305+ } catch ( error ) {
306+ const { httpErrorStatus } = error && error . customAttributes ;
307+ if ( httpErrorStatus === 404 ) {
308+ return { } ;
309+ }
310+ throw error ;
311+ }
312+ }
313+
300314export function getTimeOffsetMillis ( headerDate , requestTime , responseTime ) {
301315 // Time offset computation should move down into the HttpClient wrapper to maintain a global time correction reference
302316 // Requires 'Access-Control-Expose-Headers: Date' on the server response per https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#access-control-expose-headers
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import {
1111 postWeeklyLearningGoal ,
1212 postDismissWelcomeMessage ,
1313 postRequestCert ,
14+ getLiveTabIframe ,
1415} from './api' ;
1516
1617import {
@@ -79,6 +80,10 @@ export function fetchOutlineTab(courseId) {
7980 return fetchTab ( courseId , 'outline' , getOutlineTabData ) ;
8081}
8182
83+ export function fetchLiveTab ( courseId ) {
84+ return fetchTab ( courseId , 'live' , getLiveTabIframe ) ;
85+ }
86+
8287export function fetchDiscussionTab ( courseId ) {
8388 return fetchTab ( courseId , 'discussion' ) ;
8489}
Original file line number Diff line number Diff line change 1+ import React , { useEffect } from 'react' ;
2+ import { useSelector } from 'react-redux' ;
3+
4+ function LiveTab ( ) {
5+ const { courseId } = useSelector ( state => state . courseHome ) ;
6+ const liveModel = useSelector ( state => state . models . live ) ;
7+ useEffect ( ( ) => {
8+ const iframe = document . getElementById ( 'lti-tab-embed' ) ;
9+ if ( iframe ) {
10+ iframe . className += ' vh-100 w-100 border-0' ;
11+ }
12+ } , [ ] ) ;
13+ return (
14+ < div
15+ id = "live_tab"
16+ // eslint-disable-next-line react/no-danger
17+ dangerouslySetInnerHTML = { { __html : liveModel [ courseId ] ?. iframe } }
18+ />
19+ ) ;
20+ }
21+
22+ export default LiveTab ;
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import { Switch } from 'react-router-dom';
1212
1313import { messages as footerMessages } from '@edx/frontend-component-footer' ;
1414import { messages as headerMessages } from '@edx/frontend-component-header' ;
15- import { fetchDiscussionTab } from './course-home/data/thunks' ;
15+ import { fetchDiscussionTab , fetchLiveTab } from './course-home/data/thunks' ;
1616import DiscussionTab from './course-home/discussion-tab/DiscussionTab' ;
1717
1818import appMessages from './i18n' ;
@@ -33,6 +33,7 @@ import { fetchCourse } from './courseware/data';
3333import initializeStore from './store' ;
3434import NoticesProvider from './generic/notices' ;
3535import PathFixesProvider from './generic/path-fixes' ;
36+ import LiveTab from './course-home/live-tab/LiveTab' ;
3637
3738subscribe ( APP_READY , ( ) => {
3839 ReactDOM . render (
@@ -48,6 +49,11 @@ subscribe(APP_READY, () => {
4849 < OutlineTab />
4950 </ TabContainer >
5051 </ PageRoute >
52+ < PageRoute path = "/course/:courseId/live" >
53+ < TabContainer tab = "live" fetch = { fetchLiveTab } slice = "courseHome" >
54+ < LiveTab />
55+ </ TabContainer >
56+ </ PageRoute >
5157 < PageRoute path = "/course/:courseId/dates" >
5258 < TabContainer tab = "dates" fetch = { fetchDatesTab } slice = "courseHome" >
5359 < DatesTab />
You can’t perform that action at this time.
0 commit comments