@@ -7,7 +7,7 @@ import './video.css';
7
7
interface VideoData {
8
8
id : string ;
9
9
youtubeUrl : string ;
10
- type : 'video' | 'shorts' ;
10
+ type : 'video' | 'live' | 'other' ; // Changed type to include 'live' and 'other'
11
11
}
12
12
13
13
const getYoutubeVideoId = ( url : string ) : string => {
@@ -32,30 +32,38 @@ const getYoutubeVideoId = (url: string): string => {
32
32
return '' ;
33
33
} ;
34
34
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
+ } ;
37
45
46
+ // Youtube Video URLS
38
47
// List of both videos and shorts which will be handeled by the component
39
48
const 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" ,
59
67
] ;
60
68
61
69
const VideoCard : React . FC < {
@@ -226,8 +234,8 @@ const Pagination: React.FC<{
226
234
function BroadcastsPage ( ) : ReactElement {
227
235
const history = useHistory ( ) ;
228
236
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 ;
231
239
232
240
const videoData : VideoData [ ] = videoUrls . map ( ( url , index ) => ( {
233
241
id : String ( index + 1 ) ,
@@ -236,14 +244,15 @@ function BroadcastsPage(): ReactElement {
236
244
} ) ) ;
237
245
238
246
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' ) ;
240
249
241
250
const indexOfLastVideo = currentPage * videosPerPage ;
242
251
const indexOfFirstVideo = indexOfLastVideo - videosPerPage ;
243
252
244
253
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'
247
256
248
257
useEffect ( ( ) => {
249
258
setCurrentPage ( 1 ) ;
@@ -269,10 +278,10 @@ function BroadcastsPage(): ReactElement {
269
278
🎥 Videos
270
279
</ button >
271
280
< 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 ' ) }
274
283
>
275
- 📱 Shorts
284
+ 🔴 Past Live
276
285
</ button >
277
286
</ div >
278
287
@@ -291,11 +300,11 @@ function BroadcastsPage(): ReactElement {
291
300
</ >
292
301
) }
293
302
294
- { activeTab === 'shorts ' && (
303
+ { activeTab === 'live ' && ( // Changed 'shorts' to 'live'
295
304
< >
296
305
< VideoSection
297
- title = "YouTube Shorts "
298
- videos = { paginatedShorts }
306
+ title = "Past Live Videos "
307
+ videos = { paginatedLiveVideos } // Changed 'shorts' to 'live'
299
308
onClick = { handleVideoClick }
300
309
/>
301
310
< Pagination
@@ -310,4 +319,4 @@ function BroadcastsPage(): ReactElement {
310
319
) ;
311
320
}
312
321
313
- export default BroadcastsPage ;
322
+ export default BroadcastsPage ;
0 commit comments