Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.

Commit d5429aa

Browse files
committed
Fix linting
1 parent 30f7260 commit d5429aa

File tree

60 files changed

+452
-532
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+452
-532
lines changed

src/components/Audioplayer/RepeatDropdown/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const style = require('../style.scss');
1515

1616
class RepeatButton extends Component {
1717
static propTypes = {
18-
surah: surahType,
18+
chapter: surahType,
1919
repeat: PropTypes.shape({
2020
from: PropTypes.number,
2121
to: PropTypes.number,
@@ -57,8 +57,8 @@ class RepeatButton extends Component {
5757
}
5858

5959
renderRangeAyahs() {
60-
const { surah, repeat, setRepeat } = this.props;
61-
const array = Array(surah.versesCount).join().split(',');
60+
const { chapter, repeat, setRepeat } = this.props;
61+
const array = Array(chapter.versesCount).join().split(',');
6262

6363
return (
6464
<div className="col-md-12" style={{ paddingTop: 15 }}>
@@ -128,13 +128,13 @@ class RepeatButton extends Component {
128128
}
129129

130130
renderSingleAyah() {
131-
const { repeat, setRepeat, surah } = this.props;
132-
const array = Array(surah.versesCount).join().split(',');
131+
const { repeat, setRepeat, chapter } = this.props;
132+
const array = Array(chapter.versesCount).join().split(',');
133133

134134
return (
135135
<div className="col-md-12" style={{ paddingTop: 15 }}>
136136
<LocaleFormattedMessage
137-
id="player.currentAyah"
137+
id="player.currentVerse"
138138
defaultMessage="Ayah"
139139
/>{' '}: <br />
140140
<FormControl

src/components/Audioplayer/RepeatDropdown/spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import RepeatDropdown from './index';
66
let component;
77
let overlay;
88
let setRepeat;
9-
const surah = {
9+
const chapter = {
1010
ayat: 10
1111
};
1212

@@ -18,7 +18,7 @@ const makeComponent = (repeat) => {
1818
repeat={repeat}
1919
setRepeat={setRepeat}
2020
current={1}
21-
surah={surah}
21+
chapter={chapter}
2222
/>
2323
);
2424

src/components/Audioplayer/Segments/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ import debug from 'helpers/debug';
77
export default class Segments extends Component {
88
static propTypes = {
99
segments: PropTypes.objectOf(segmentType).isRequired,
10-
currentAyah: PropTypes.string,
10+
currentVerse: PropTypes.string,
1111
currentTime: PropTypes.number
1212
};
1313

1414
shouldComponentUpdate(nextProps) {
1515
return [
16-
this.props.currentAyah !== nextProps.currentAyah,
16+
this.props.currentVerse !== nextProps.currentVerse,
1717
this.props.currentTime !== nextProps.currentTime,
1818
].some(test => test);
1919
}
2020

2121
render() {
22-
const { segments, currentAyah, currentTime } = this.props;
22+
const { segments, currentVerse, currentTime } = this.props;
2323
const style = [];
2424
let currentWord = null;
2525

@@ -29,7 +29,7 @@ export default class Segments extends Component {
2929
const word = segments.words[wordIndex];
3030

3131
if (currentTime >= word.startTime && currentTime < word.endTime) {
32-
currentWord = `${currentAyah}:${wordIndex}`;
32+
currentWord = `${currentVerse}:${wordIndex}`;
3333
}
3434
});
3535

src/components/Audioplayer/Segments/spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('<Segments />', () => {
2929
<Segments
3030
segments={{ words: { 0: { startTime: 0, endTime: 1 }, 1: { startTime: 1, endTime: 2 } } }}
3131
currentTime={1.5}
32-
currentAyah="1:1"
32+
currentVerse="1:1"
3333
/>
3434
);
3535
});
@@ -64,7 +64,7 @@ describe('<Segments />', () => {
6464
}
6565
}}
6666
currentTime={1.5}
67-
currentAyah="1:1"
67+
currentVerse="1:1"
6868
/>
6969
);
7070
});

src/components/Audioplayer/index.js

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -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,

src/components/Audioplayer/spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('<Audioplayer />', () => {
2727
setRepeat={setRepeat}
2828
setAyah={setAyah}
2929
repeat={repeat}
30-
currentAyah="2:3"
30+
currentVerse="2:3"
3131
/>
3232
);
3333

@@ -91,7 +91,7 @@ describe('<Audioplayer />', () => {
9191
setRepeat={setRepeat}
9292
setAyah={setAyah}
9393
repeat={repeat}
94-
currentAyah="2:3"
94+
currentVerse="2:3"
9595
/>
9696
);
9797

src/components/Bismillah/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
22
import { surahType } from 'types';
33

4-
const Bismillah = ({ surah }) => {
5-
if (surah && surah.bismillahPre) {
4+
const Bismillah = ({ chapter }) => {
5+
if (chapter && chapter.bismillahPre) {
66
return (
77
<div
88
className="bismillah text-center word-font"
@@ -17,7 +17,7 @@ const Bismillah = ({ surah }) => {
1717
};
1818

1919
Bismillah.propTypes = {
20-
surah: surahType.isRequired
20+
chapter: surahType.isRequired
2121
};
2222

2323
export default Bismillah;

0 commit comments

Comments
 (0)