@@ -7,7 +7,7 @@ import './video.css';
77interface VideoData {
88 id : string ;
99 youtubeUrl : string ;
10- type : 'video' | 'shorts' ;
10+ type : 'video' | 'live' | 'other' ; // Changed type to include 'live' and 'other'
1111}
1212
1313const getYoutubeVideoId = ( url : string ) : string => {
@@ -32,30 +32,38 @@ const getYoutubeVideoId = (url: string): string => {
3232 return '' ;
3333} ;
3434
35- const getYoutubeContentType = ( url : string ) : 'video' | 'shorts' =>
36- url . includes ( '/shorts/' ) ? 'shorts' : 'video' ;
35+ // Updated function to determine video type
36+ const getYoutubeContentType = ( url : string ) : 'video' | 'live' | 'other' => {
37+ if ( url . includes ( 'youtu.be/rbi6XhWp2TU' ) || url . includes ( 'youtu.be/aGyfIrxx1H8' ) || url . includes ( 'youtu.be/vFS6ZU1WAPA' ) || url . includes ( 'youtu.be/DWxyEl-t48g' ) ) {
38+ return 'live' ;
39+ } else if ( url . includes ( '/shorts/' ) ) {
40+ return 'other' ; // Changed 'shorts' to 'other'
41+ } else {
42+ return 'video' ;
43+ }
44+ } ;
3745
46+ // Youtube Video URLS
3847// List of both videos and shorts which will be handeled by the component
3948const videoUrls : string [ ] = [
40- "https://youtu.be/Fl2L9bXSRy0?si=Pdvb0oBLCP4TCIwF" ,
41- "https://youtu.be/vuUusiD7EDM?si=4UTby9iK5hUNhNJ4" ,
42- "https://youtu.be/xdjZ0HXADjE?si=JkIuRgwJ8Z3qbjxi" ,
43- "https://youtu.be/DmYe2itxSQA?si=skfOHQcC6EI8kouM" ,
44- "https://youtu.be/V2nvZYe_q7g?si=SkagJNJNUqCGsPXX" ,
45- "https://youtu.be/7BL6eInh7qo?si=iwZmF9iWGzUly91r" ,
46- "https://youtu.be/oyi86CljSk4?si=FKQBbJQ1qmi1movv" ,
47- "https://youtu.be/akz9xHL1RQo?si=thHXvVijm4fo9N58" ,
48- "https://youtu.be/4JX-SIkM3uk?si=r2kvpCztaPEoCKoM" ,
49- "https://youtube.com/shorts/zSu-K54fI8s?si=CPriy5v8uCTV5YlW" ,
50- "https://youtube.com/shorts/Wj3GEuwoNWc?si=PdfmvBSYrC7vRtvc" ,
51- "https://youtube.com/shorts/YOY-6VCZhic?si=FSBCIhPkCLPRWTg5" ,
52- "https://youtube.com/shorts/QUe3MG8mrCA?si=-LPWBr6ugtYicH9d" ,
53- "https://youtube.com/shorts/OGx-8hVSkHI?si=yVdRjmuhI38EV51_" ,
54- "https://youtube.com/shorts/ETVU4yeOxB4?si=mV68Bv7q8ozmPg9v" ,
55- "https://youtube.com/shorts/HGLhwI5ieL0?si=Ay_E2DK43slrtRXn" ,
56- "https://youtube.com/shorts/WpDc9yNGDxA?si=zrrvKuu-c_ZOemYi" ,
57- "https://youtube.com/shorts/N-9NUXvdvcM?si=rD_uqweUQou5VAvD" ,
58- "https://youtube.com/shorts/sN6RtRiT8D8?si=MThSH4PMl5O1OVTN" ,
49+ "https://youtu.be/3dnQ2lDNeGI?list=PLrLTYhoDFx-kiuFiGQqVpYYZ56pIhUW63" ,
50+ "https://youtu.be/XWjx-RjmhRM?list=PLrLTYhoDFx-kiuFiGQqVpYYZ56pIhUW63" ,
51+ "https://youtu.be/R7NReLBCT_8?list=PLrLTYhoDFx-kiuFiGQqVpYYZ56pIhUW63" ,
52+ "https://youtu.be/sbyXpflAXkQ?list=PLrLTYhoDFx-kiuFiGQqVpYYZ56pIhUW63" ,
53+ "https://youtu.be/7uKMWBFN2jQ?list=PLrLTYhoDFx-kiuFiGQqVpYYZ56pIhUW63" ,
54+ "https://youtu.be/v2Pai1TY_Lg?list=PLrLTYhoDFx-kiuFiGQqVpYYZ56pIhUW63" ,
55+ "https://youtu.be/P-P3L7YzlyE?list=PLrLTYhoDFx-kiuFiGQqVpYYZ56pIhUW63" ,
56+ "https://youtu.be/BNKSlT8jLQ0?list=PLrLTYhoDFx-kiuFiGQqVpYYZ56pIhUW63" ,
57+ "https://youtu.be/GnHNScuGKrg?list=PLrLTYhoDFx-kiuFiGQqVpYYZ56pIhUW63" ,
58+ "https://youtu.be/RSR5E1bhu5Y?list=PLrLTYhoDFx-kiuFiGQqVpYYZ56pIhUW63" ,
59+ "https://youtu.be/knr5gBv-c9c?list=PLrLTYhoDFx-kiuFiGQqVpYYZ56pIhUW63" ,
60+ "https://youtu.be/4JX-SIkM3uk?list=PLrLTYhoDFx-kiuFiGQqVpYYZ56pIhUW63" ,
61+ "https://youtu.be/V2nvZYe_q7g?list=PLrLTYhoDFx-kiuFiGQqVpYYZ56pIhUW63" ,
62+ "https://youtu.be/rbi6XhWp2TU" ,
63+ "https://youtu.be/aGyfIrxx1H8" ,
64+ "https://youtu.be/GTe2DJQ-enU" ,
65+ "https://youtu.be/vFS6ZU1WAPA" ,
66+ "https://youtu.be/DWxyEl-t48g" ,
5967] ;
6068
6169const VideoCard : React . FC < {
@@ -226,8 +234,8 @@ const Pagination: React.FC<{
226234function BroadcastsPage ( ) : ReactElement {
227235 const history = useHistory ( ) ;
228236 const [ currentPage , setCurrentPage ] = useState ( 1 ) ;
229- const [ activeTab , setActiveTab ] = useState < 'videos' | 'shorts ' > ( 'videos' ) ;
230- const videosPerPage = 6 ;
237+ const [ activeTab , setActiveTab ] = useState < 'videos' | 'live ' > ( 'videos' ) ; // Changed 'shorts' to 'live'
238+ const videosPerPage = 12 ;
231239
232240 const videoData : VideoData [ ] = videoUrls . map ( ( url , index ) => ( {
233241 id : String ( index + 1 ) ,
@@ -236,14 +244,15 @@ function BroadcastsPage(): ReactElement {
236244 } ) ) ;
237245
238246 const regularVideos = videoData . filter ( video => video . type === 'video' ) ;
239- const shorts = videoData . filter ( video => video . type === 'shorts' ) ;
247+ const liveVideos = videoData . filter ( video => video . type === 'live' ) ; // Changed 'shorts' to 'live'
248+ const otherVideos = videoData . filter ( video => video . type === 'other' ) ;
240249
241250 const indexOfLastVideo = currentPage * videosPerPage ;
242251 const indexOfFirstVideo = indexOfLastVideo - videosPerPage ;
243252
244253 const paginatedVideos = regularVideos . slice ( indexOfFirstVideo , indexOfLastVideo ) ;
245- const paginatedShorts = shorts . slice ( indexOfFirstVideo , indexOfLastVideo ) ;
246- const totalPages = Math . ceil ( ( activeTab === 'videos' ? regularVideos . length : shorts . length ) / videosPerPage ) ;
254+ const paginatedLiveVideos = liveVideos . slice ( indexOfFirstVideo , indexOfLastVideo ) ; // Changed 'shorts' to 'live'
255+ const totalPages = Math . ceil ( ( activeTab === 'videos' ? regularVideos . length : liveVideos . length ) / videosPerPage ) ; // Changed 'shorts' to 'live'
247256
248257 useEffect ( ( ) => {
249258 setCurrentPage ( 1 ) ;
@@ -269,10 +278,10 @@ function BroadcastsPage(): ReactElement {
269278 🎥 Videos
270279 </ button >
271280 < button
272- className = { `tab-button ${ activeTab === 'shorts ' ? 'active' : '' } ` }
273- onClick = { ( ) => setActiveTab ( 'shorts ' ) }
281+ className = { `tab-button ${ activeTab === 'live ' ? 'active' : '' } ` } // Changed 'shorts' to 'live'
282+ onClick = { ( ) => setActiveTab ( 'live ' ) }
274283 >
275- 📱 Shorts
284+ 🔴 Past Live
276285 </ button >
277286 </ div >
278287
@@ -291,11 +300,11 @@ function BroadcastsPage(): ReactElement {
291300 </ >
292301 ) }
293302
294- { activeTab === 'shorts ' && (
303+ { activeTab === 'live ' && ( // Changed 'shorts' to 'live'
295304 < >
296305 < VideoSection
297- title = "YouTube Shorts "
298- videos = { paginatedShorts }
306+ title = "Past Live Videos "
307+ videos = { paginatedLiveVideos } // Changed 'shorts' to 'live'
299308 onClick = { handleVideoClick }
300309 />
301310 < Pagination
@@ -310,4 +319,4 @@ function BroadcastsPage(): ReactElement {
310319 ) ;
311320}
312321
313- export default BroadcastsPage ;
322+ export default BroadcastsPage ;
0 commit comments