77import {
88 Badge ,
99 Button ,
10+ Form ,
11+ Hyperlink ,
1012 Icon ,
1113 Stack ,
1214} from '@openedx/paragon' ;
@@ -20,7 +22,10 @@ import {
2022
2123import type { ChecklistType , CourseOutlineStatusBar } from '@src/course-outline/data/types' ;
2224import { useEntityLinksSummaryByDownstreamContext } from '@src/course-libraries/data/apiHooks' ;
25+ import { VIDEO_SHARING_OPTIONS } from '@src/course-outline/constants' ;
2326import { useCourseDetails } from '@src/course-outline/data/apiHooks' ;
27+ import { getVideoSharingOptionText } from '@src/course-outline/utils' ;
28+ import { useHelpUrls } from '@src/help-urls/hooks' ;
2429
2530import messages from './messages' ;
2631import { NotificationStatusIcon } from './NotificationStatusIcon' ;
@@ -203,24 +208,73 @@ const Highlights = ({ highlightsEnabledForMessaging, openEnableHighlightsModal }
203208 }
204209} ;
205210
211+ const VideoSharingDropdown = ( { handleVideoSharingOptionChange, videoSharingOptions } : {
212+ handleVideoSharingOptionChange : ( value : string ) => void ;
213+ videoSharingOptions : string ;
214+ } ) => {
215+ const intl = useIntl ( ) ;
216+ const {
217+ socialSharing : socialSharingUrl ,
218+ } = useHelpUrls ( [ 'socialSharing' ] ) ;
219+
220+ return (
221+ < Form . Group
222+ size = "sm"
223+ className = "d-flex m-0 align-items-center"
224+ >
225+ < Form . Label className = "h5 m-0 mr-2 text-gray-700" >
226+ < FormattedMessage { ...messages . videoSharingTitle } /> :
227+ </ Form . Label >
228+ < div className = "d-flex align-items-center" >
229+ < Form . Control
230+ as = "select"
231+ defaultValue = { videoSharingOptions }
232+ onChange = { ( e : React . ChangeEvent < HTMLInputElement > ) => handleVideoSharingOptionChange ( e . target . value ) }
233+ >
234+ { Object . values ( VIDEO_SHARING_OPTIONS ) . map ( ( option ) => (
235+ < option
236+ key = { option }
237+ value = { option }
238+ >
239+ { getVideoSharingOptionText ( option , messages , intl ) }
240+ </ option >
241+ ) ) }
242+ </ Form . Control >
243+ < Hyperlink
244+ className = "small"
245+ destination = { socialSharingUrl }
246+ target = "_blank"
247+ showLaunchIcon = { false }
248+ >
249+ < FormattedMessage { ...messages . videoSharingLink } />
250+ </ Hyperlink >
251+ </ div >
252+ </ Form . Group >
253+ ) ;
254+ } ;
255+
206256export interface StatusBarProps {
207257 courseId : string ;
208258 isLoading : boolean ;
209259 statusBarData : CourseOutlineStatusBar ;
210260 openEnableHighlightsModal : ( ) => void ;
261+ handleVideoSharingOptionChange : ( value : string ) => void ;
211262}
212263
213264export const StatusBar = ( {
214265 statusBarData,
215266 isLoading,
216267 courseId,
217268 openEnableHighlightsModal,
269+ handleVideoSharingOptionChange,
218270} : StatusBarProps ) => {
219271 const {
220272 endDate,
221273 courseReleaseDate,
222274 highlightsEnabledForMessaging,
223275 checklist,
276+ videoSharingEnabled,
277+ videoSharingOptions,
224278 } = statusBarData ;
225279
226280 const courseReleaseDateObj = moment . utc ( courseReleaseDate , 'MMM DD, YYYY [at] HH:mm UTC' , true ) ;
@@ -246,6 +300,12 @@ export const StatusBar = ({
246300 highlightsEnabledForMessaging = { highlightsEnabledForMessaging }
247301 openEnableHighlightsModal = { openEnableHighlightsModal }
248302 />
303+ { videoSharingEnabled || true && (
304+ < VideoSharingDropdown
305+ handleVideoSharingOptionChange = { handleVideoSharingOptionChange }
306+ videoSharingOptions = { videoSharingOptions }
307+ />
308+ ) }
249309 < NotificationStatusIcon />
250310 </ Stack >
251311 ) ;
0 commit comments