@@ -30,7 +30,7 @@ export class Audioplayer extends Component {
3030 segments : PropTypes . objectOf ( segmentType ) ,
3131 // NOTE: should be PropTypes.instanceOf(Audio) but not on server.
3232 files : PropTypes . object , // eslint-disable-line
33- currentAyah : PropTypes . string ,
33+ currentVerse : PropTypes . string ,
3434 buildOnClient : PropTypes . func . isRequired ,
3535 isLoadedOnClient : PropTypes . bool . isRequired ,
3636 isLoading : PropTypes . bool . isRequired ,
@@ -75,7 +75,7 @@ export class Audioplayer extends Component {
7575
7676 componentWillReceiveProps ( nextProps ) {
7777 // 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 ) {
7979 return false ;
8080 }
8181
@@ -84,7 +84,7 @@ export class Audioplayer extends Component {
8484 return this . handleAddFileListeners ( nextProps . currentFile ) ;
8585 }
8686
87- if ( this . props . currentAyah !== nextProps . currentAyah ) {
87+ if ( this . props . currentVerse !== nextProps . currentVerse ) {
8888 this . handleAddFileListeners ( nextProps . currentFile ) ;
8989
9090 if ( this . props . currentFile ) {
@@ -109,18 +109,18 @@ export class Audioplayer extends Component {
109109 }
110110
111111 getPrevious ( ) {
112- const { currentAyah , files } = this . props ;
112+ const { currentVerse , files } = this . props ;
113113 const ayahIds = Object . keys ( files ) ;
114- const index = ayahIds . findIndex ( id => id === currentAyah ) ;
114+ const index = ayahIds . findIndex ( id => id === currentVerse ) ;
115115
116116 return ayahIds [ index - 1 ] ;
117117 }
118118
119119 getNext ( ) {
120- const { currentAyah , chapter, files, onLoadAyahs } = this . props ;
120+ const { currentVerse , chapter, files, onLoadAyahs } = this . props ;
121121 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 ) ;
124124
125125 if ( chapter . versesCount === ayahNum + 1 ) {
126126 // We are at the end of the chapter!
@@ -136,16 +136,16 @@ export class Audioplayer extends Component {
136136 }
137137
138138 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
140140 const previouslyPlaying = isPlaying ;
141141
142142 if ( isPlaying ) pause ( ) ;
143143
144144 if ( ! this [ camelize ( `get_${ direction } ` ) ] ( ) ) return pause ( ) ;
145145
146- this . props [ direction ] ( currentAyah ) ;
146+ this . props [ direction ] ( currentVerse ) ;
147147
148- this . handleScrollTo ( currentAyah ) ;
148+ this . handleScrollTo ( currentVerse ) ;
149149
150150 this . preloadNext ( ) ;
151151
@@ -154,7 +154,7 @@ export class Audioplayer extends Component {
154154 return false ;
155155 }
156156
157- handleScrollTo = ( ayahNum = this . props . currentAyah ) => {
157+ handleScrollTo = ( ayahNum = this . props . currentVerse ) => {
158158 const { shouldScroll } = this . props ;
159159
160160 if ( shouldScroll ) {
@@ -170,16 +170,16 @@ export class Audioplayer extends Component {
170170 }
171171
172172 preloadNext ( ) {
173- const { currentAyah , files } = this . props ;
173+ const { currentVerse , files } = this . props ;
174174 const ayahIds = Object . keys ( files ) ;
175- const index = ayahIds . findIndex ( id => id === currentAyah ) + 1 ;
175+ const index = ayahIds . findIndex ( id => id === currentVerse ) + 1 ;
176176
177177 for ( let id = index ; id <= index + 2 ; id += 1 ) {
178178 if ( ayahIds [ id ] ) {
179- const ayahKey = ayahIds [ id ] ;
179+ const verseKey = ayahIds [ id ] ;
180180
181- if ( files [ ayahKey ] ) {
182- files [ ayahKey ] . setAttribute ( 'preload' , 'auto' ) ;
181+ if ( files [ verseKey ] ) {
182+ files [ verseKey ] . setAttribute ( 'preload' , 'auto' ) ;
183183 }
184184 }
185185 }
@@ -188,11 +188,11 @@ export class Audioplayer extends Component {
188188 handleRepeat = ( file ) => {
189189 const {
190190 repeat,
191- currentAyah ,
191+ currentVerse ,
192192 setRepeat, // eslint-disable-line no-shadow
193193 setAyah // eslint-disable-line no-shadow
194194 } = this . props ;
195- const [ chapter , ayah ] = currentAyah . split ( ':' ) . map ( val => parseInt ( val , 10 ) ) ;
195+ const [ chapter , ayah ] = currentVerse . split ( ':' ) . map ( val => parseInt ( val , 10 ) ) ;
196196
197197 file . pause ( ) ;
198198
@@ -247,14 +247,14 @@ export class Audioplayer extends Component {
247247 handleScrollToggle = ( event ) => {
248248 event . preventDefault ( ) ;
249249
250- const { shouldScroll, currentAyah } = this . props ;
250+ const { shouldScroll, currentVerse } = this . props ;
251251
252252 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 ] ;
254254 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 ) ;
256256 } else {
257- scroller . scrollTo ( `ayah:${ currentAyah } ` , - 80 ) ;
257+ scroller . scrollTo ( `ayah:${ currentVerse } ` , - 80 ) ;
258258 }
259259 }
260260
@@ -353,9 +353,9 @@ export class Audioplayer extends Component {
353353 }
354354
355355 renderPreviousButton ( ) {
356- const { currentAyah , files } = this . props ;
356+ const { currentVerse , files } = this . props ;
357357 if ( ! files ) return false ;
358- const index = Object . keys ( files ) . findIndex ( id => id === currentAyah ) ;
358+ const index = Object . keys ( files ) . findIndex ( id => id === currentVerse ) ;
359359
360360 return (
361361 < a
@@ -369,9 +369,9 @@ export class Audioplayer extends Component {
369369 }
370370
371371 renderNextButton ( ) {
372- const { chapter, currentAyah } = this . props ;
372+ const { chapter, currentVerse } = this . props ;
373373 if ( ! chapter ) return false ;
374- const isEnd = chapter . versesCount === parseInt ( currentAyah . split ( ':' ) [ 1 ] , 10 ) ;
374+ const isEnd = chapter . versesCount === parseInt ( currentVerse . split ( ':' ) [ 1 ] , 10 ) ;
375375
376376 return (
377377 < a
@@ -391,7 +391,7 @@ export class Audioplayer extends Component {
391391 className,
392392 segments,
393393 isLoading,
394- currentAyah ,
394+ currentVerse ,
395395 currentTime,
396396 duration,
397397 chapter,
@@ -402,7 +402,7 @@ export class Audioplayer extends Component {
402402 setRepeat // eslint-disable-line no-shadow
403403 } = this . props ;
404404
405- if ( isLoading || ! currentAyah ) {
405+ if ( isLoading || ! currentVerse ) {
406406 return (
407407 < li className = { `${ style . container } ${ className } ` } >
408408 < div >
@@ -426,21 +426,21 @@ export class Audioplayer extends Component {
426426 {
427427 isLoadedOnClient &&
428428 segments &&
429- segments [ currentAyah ] &&
430- segments [ currentAyah ] &&
429+ segments [ currentVerse ] &&
430+ segments [ currentVerse ] &&
431431 < Segments
432- segments = { segments [ currentAyah ] }
433- currentAyah = { currentAyah }
432+ segments = { segments [ currentVerse ] }
433+ currentVerse = { currentVerse }
434434 currentTime = { currentTime }
435435 />
436436 }
437437 </ div >
438438 < ul className = { `list-inline ${ style . controls } ` } >
439439 < li className = { style . controlItem } >
440440 < LocaleFormattedMessage
441- id = "player.currentAyah "
441+ id = "player.currentVerse "
442442 defaultMessage = "Ayah"
443- /> : { currentAyah . split ( ':' ) [ 1 ] }
443+ /> : { currentVerse . split ( ':' ) [ 1 ] }
444444 </ li >
445445 < li className = { style . controlItem } >
446446 { this . renderPreviousButton ( ) }
@@ -455,7 +455,7 @@ export class Audioplayer extends Component {
455455 < RepeatDropdown
456456 repeat = { repeat }
457457 setRepeat = { setRepeat }
458- current = { parseInt ( currentAyah . split ( ':' ) [ 1 ] , 10 ) }
458+ current = { parseInt ( currentVerse . split ( ':' ) [ 1 ] , 10 ) }
459459 chapter = { chapter }
460460 />
461461 </ li >
@@ -472,8 +472,8 @@ const mapStateToProps = (state, ownProps) => ({
472472 files : state . audioplayer . files [ ownProps . chapter . chapterNumber ] ,
473473 segments : state . audioplayer . segments [ ownProps . chapter . chapterNumber ] ,
474474 currentFile : state . audioplayer . currentFile ,
475- currentAyah : state . audioplayer . currentAyah ,
476- surahId : state . audioplayer . surahId ,
475+ currentVerse : state . audioplayer . currentVerse ,
476+ chapterId : state . audioplayer . chapterId ,
477477 isPlaying : state . audioplayer . isPlaying ,
478478 isLoadedOnClient : state . audioplayer . isLoadedOnClient ,
479479 isLoading : state . audioplayer . isLoading ,
0 commit comments