@@ -30,7 +30,7 @@ export class Audioplayer extends Component {
30
30
segments : PropTypes . objectOf ( segmentType ) ,
31
31
// NOTE: should be PropTypes.instanceOf(Audio) but not on server.
32
32
files : PropTypes . object , // eslint-disable-line
33
- currentAyah : PropTypes . string ,
33
+ currentVerse : PropTypes . string ,
34
34
buildOnClient : PropTypes . func . isRequired ,
35
35
isLoadedOnClient : PropTypes . bool . isRequired ,
36
36
isLoading : PropTypes . bool . isRequired ,
@@ -75,7 +75,7 @@ export class Audioplayer extends Component {
75
75
76
76
componentWillReceiveProps ( nextProps ) {
77
77
// Make sure we have a current ayah to mount it to Audio
78
- if ( ! this . props . currentAyah && ! nextProps . currentFile ) {
78
+ if ( ! this . props . currentVerse && ! nextProps . currentFile ) {
79
79
return false ;
80
80
}
81
81
@@ -84,7 +84,7 @@ export class Audioplayer extends Component {
84
84
return this . handleAddFileListeners ( nextProps . currentFile ) ;
85
85
}
86
86
87
- if ( this . props . currentAyah !== nextProps . currentAyah ) {
87
+ if ( this . props . currentVerse !== nextProps . currentVerse ) {
88
88
this . handleAddFileListeners ( nextProps . currentFile ) ;
89
89
90
90
if ( this . props . currentFile ) {
@@ -109,18 +109,18 @@ export class Audioplayer extends Component {
109
109
}
110
110
111
111
getPrevious ( ) {
112
- const { currentAyah , files } = this . props ;
112
+ const { currentVerse , files } = this . props ;
113
113
const ayahIds = Object . keys ( files ) ;
114
- const index = ayahIds . findIndex ( id => id === currentAyah ) ;
114
+ const index = ayahIds . findIndex ( id => id === currentVerse ) ;
115
115
116
116
return ayahIds [ index - 1 ] ;
117
117
}
118
118
119
119
getNext ( ) {
120
- const { currentAyah , chapter, files, onLoadAyahs } = this . props ;
120
+ const { currentVerse , chapter, files, onLoadAyahs } = this . props ;
121
121
const ayahIds = Object . keys ( files ) ;
122
- const ayahNum = currentAyah . split ( ':' ) [ 1 ] ;
123
- const index = ayahIds . findIndex ( id => id === currentAyah ) ;
122
+ const ayahNum = currentVerse . split ( ':' ) [ 1 ] ;
123
+ const index = ayahIds . findIndex ( id => id === currentVerse ) ;
124
124
125
125
if ( chapter . versesCount === ayahNum + 1 ) {
126
126
// We are at the end of the chapter!
@@ -136,16 +136,16 @@ export class Audioplayer extends Component {
136
136
}
137
137
138
138
handleAyahChange = ( direction = 'next' ) => {
139
- const { isPlaying, play, pause, currentAyah } = this . props ; // eslint-disable-line no-shadow, max-len
139
+ const { isPlaying, play, pause, currentVerse } = this . props ; // eslint-disable-line no-shadow, max-len
140
140
const previouslyPlaying = isPlaying ;
141
141
142
142
if ( isPlaying ) pause ( ) ;
143
143
144
144
if ( ! this [ camelize ( `get_${ direction } ` ) ] ( ) ) return pause ( ) ;
145
145
146
- this . props [ direction ] ( currentAyah ) ;
146
+ this . props [ direction ] ( currentVerse ) ;
147
147
148
- this . handleScrollTo ( currentAyah ) ;
148
+ this . handleScrollTo ( currentVerse ) ;
149
149
150
150
this . preloadNext ( ) ;
151
151
@@ -154,7 +154,7 @@ export class Audioplayer extends Component {
154
154
return false ;
155
155
}
156
156
157
- handleScrollTo = ( ayahNum = this . props . currentAyah ) => {
157
+ handleScrollTo = ( ayahNum = this . props . currentVerse ) => {
158
158
const { shouldScroll } = this . props ;
159
159
160
160
if ( shouldScroll ) {
@@ -170,16 +170,16 @@ export class Audioplayer extends Component {
170
170
}
171
171
172
172
preloadNext ( ) {
173
- const { currentAyah , files } = this . props ;
173
+ const { currentVerse , files } = this . props ;
174
174
const ayahIds = Object . keys ( files ) ;
175
- const index = ayahIds . findIndex ( id => id === currentAyah ) + 1 ;
175
+ const index = ayahIds . findIndex ( id => id === currentVerse ) + 1 ;
176
176
177
177
for ( let id = index ; id <= index + 2 ; id += 1 ) {
178
178
if ( ayahIds [ id ] ) {
179
- const ayahKey = ayahIds [ id ] ;
179
+ const verseKey = ayahIds [ id ] ;
180
180
181
- if ( files [ ayahKey ] ) {
182
- files [ ayahKey ] . setAttribute ( 'preload' , 'auto' ) ;
181
+ if ( files [ verseKey ] ) {
182
+ files [ verseKey ] . setAttribute ( 'preload' , 'auto' ) ;
183
183
}
184
184
}
185
185
}
@@ -188,11 +188,11 @@ export class Audioplayer extends Component {
188
188
handleRepeat = ( file ) => {
189
189
const {
190
190
repeat,
191
- currentAyah ,
191
+ currentVerse ,
192
192
setRepeat, // eslint-disable-line no-shadow
193
193
setAyah // eslint-disable-line no-shadow
194
194
} = this . props ;
195
- const [ chapter , ayah ] = currentAyah . split ( ':' ) . map ( val => parseInt ( val , 10 ) ) ;
195
+ const [ chapter , ayah ] = currentVerse . split ( ':' ) . map ( val => parseInt ( val , 10 ) ) ;
196
196
197
197
file . pause ( ) ;
198
198
@@ -247,14 +247,14 @@ export class Audioplayer extends Component {
247
247
handleScrollToggle = ( event ) => {
248
248
event . preventDefault ( ) ;
249
249
250
- const { shouldScroll, currentAyah } = this . props ;
250
+ const { shouldScroll, currentVerse } = this . props ;
251
251
252
252
if ( ! shouldScroll ) { // we use the inverse (!) here because we're toggling, so false is true
253
- const elem = document . getElementsByName ( `ayah:${ currentAyah } ` ) [ 0 ] ;
253
+ const elem = document . getElementsByName ( `ayah:${ currentVerse } ` ) [ 0 ] ;
254
254
if ( elem && elem . getBoundingClientRect ( ) . top < 0 ) { // if the ayah is above our scroll offset
255
- scroller . scrollTo ( `ayah:${ currentAyah } ` , - 150 ) ;
255
+ scroller . scrollTo ( `ayah:${ currentVerse } ` , - 150 ) ;
256
256
} else {
257
- scroller . scrollTo ( `ayah:${ currentAyah } ` , - 80 ) ;
257
+ scroller . scrollTo ( `ayah:${ currentVerse } ` , - 80 ) ;
258
258
}
259
259
}
260
260
@@ -353,9 +353,9 @@ export class Audioplayer extends Component {
353
353
}
354
354
355
355
renderPreviousButton ( ) {
356
- const { currentAyah , files } = this . props ;
356
+ const { currentVerse , files } = this . props ;
357
357
if ( ! files ) return false ;
358
- const index = Object . keys ( files ) . findIndex ( id => id === currentAyah ) ;
358
+ const index = Object . keys ( files ) . findIndex ( id => id === currentVerse ) ;
359
359
360
360
return (
361
361
< a
@@ -369,9 +369,9 @@ export class Audioplayer extends Component {
369
369
}
370
370
371
371
renderNextButton ( ) {
372
- const { chapter, currentAyah } = this . props ;
372
+ const { chapter, currentVerse } = this . props ;
373
373
if ( ! chapter ) return false ;
374
- const isEnd = chapter . versesCount === parseInt ( currentAyah . split ( ':' ) [ 1 ] , 10 ) ;
374
+ const isEnd = chapter . versesCount === parseInt ( currentVerse . split ( ':' ) [ 1 ] , 10 ) ;
375
375
376
376
return (
377
377
< a
@@ -391,7 +391,7 @@ export class Audioplayer extends Component {
391
391
className,
392
392
segments,
393
393
isLoading,
394
- currentAyah ,
394
+ currentVerse ,
395
395
currentTime,
396
396
duration,
397
397
chapter,
@@ -402,7 +402,7 @@ export class Audioplayer extends Component {
402
402
setRepeat // eslint-disable-line no-shadow
403
403
} = this . props ;
404
404
405
- if ( isLoading || ! currentAyah ) {
405
+ if ( isLoading || ! currentVerse ) {
406
406
return (
407
407
< li className = { `${ style . container } ${ className } ` } >
408
408
< div >
@@ -426,21 +426,21 @@ export class Audioplayer extends Component {
426
426
{
427
427
isLoadedOnClient &&
428
428
segments &&
429
- segments [ currentAyah ] &&
430
- segments [ currentAyah ] &&
429
+ segments [ currentVerse ] &&
430
+ segments [ currentVerse ] &&
431
431
< Segments
432
- segments = { segments [ currentAyah ] }
433
- currentAyah = { currentAyah }
432
+ segments = { segments [ currentVerse ] }
433
+ currentVerse = { currentVerse }
434
434
currentTime = { currentTime }
435
435
/>
436
436
}
437
437
</ div >
438
438
< ul className = { `list-inline ${ style . controls } ` } >
439
439
< li className = { style . controlItem } >
440
440
< LocaleFormattedMessage
441
- id = "player.currentAyah "
441
+ id = "player.currentVerse "
442
442
defaultMessage = "Ayah"
443
- /> : { currentAyah . split ( ':' ) [ 1 ] }
443
+ /> : { currentVerse . split ( ':' ) [ 1 ] }
444
444
</ li >
445
445
< li className = { style . controlItem } >
446
446
{ this . renderPreviousButton ( ) }
@@ -455,7 +455,7 @@ export class Audioplayer extends Component {
455
455
< RepeatDropdown
456
456
repeat = { repeat }
457
457
setRepeat = { setRepeat }
458
- current = { parseInt ( currentAyah . split ( ':' ) [ 1 ] , 10 ) }
458
+ current = { parseInt ( currentVerse . split ( ':' ) [ 1 ] , 10 ) }
459
459
chapter = { chapter }
460
460
/>
461
461
</ li >
@@ -472,8 +472,8 @@ const mapStateToProps = (state, ownProps) => ({
472
472
files : state . audioplayer . files [ ownProps . chapter . chapterNumber ] ,
473
473
segments : state . audioplayer . segments [ ownProps . chapter . chapterNumber ] ,
474
474
currentFile : state . audioplayer . currentFile ,
475
- currentAyah : state . audioplayer . currentAyah ,
476
- surahId : state . audioplayer . surahId ,
475
+ currentVerse : state . audioplayer . currentVerse ,
476
+ chapterId : state . audioplayer . chapterId ,
477
477
isPlaying : state . audioplayer . isPlaying ,
478
478
isLoadedOnClient : state . audioplayer . isLoadedOnClient ,
479
479
isLoading : state . audioplayer . isLoading ,
0 commit comments