Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed lint breaks
  • Loading branch information
naveed-ahmad committed Mar 11, 2017
commit b34e3654e2a92b354fa02f86bbf7d4c51c0dc82b
8 changes: 4 additions & 4 deletions src/components/Verse/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Verse extends Component {
currentWord: PropTypes.number, // gets passed in an integer, null by default
iscurrentVerse: PropTypes.bool,
currentVerse: PropTypes.string,
userAgent: PropTypes.object
userAgent: PropTypes.func
};

static defaultProps = {
Expand Down Expand Up @@ -128,11 +128,11 @@ class Verse extends Component {
}

renderText() {
const { verse, tooltip, currentVerse, isPlaying, audioActions, isSearched, userAgent } = this.props;
const { verse, tooltip, currentVerse, isPlaying, audioActions, isSearched, userAgent } = this.props; // eslint-disable-line max-len
// NOTE: Some 'word's are glyphs (jeem). Not words and should not be clicked for audio
let wordAudioPosition = -1;
const renderText = userAgent.isChrome || useragent.isOpera || useragent.isBot;
const renderText = userAgent.isChrome || userAgent.isOpera || userAgent.isBot;

const text = verse.words.map(word => ( // eslint-disable-line
<Word
word={word}
Expand Down
12 changes: 5 additions & 7 deletions src/components/Word/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,17 @@ export default class Word extends Component {
render() {
const { tooltip, word, currentVerse, isPlaying, audioPosition, useTextFont } = this.props;

let id = null;
let text;
const highlight = currentVerse === word.verseKey && isPlaying ? 'highlight' : '';
const className = `${useTextFont ? 'text-' : ''}${word.charType === CHAR_TYPE_WORD ? word.className : 'p0'} ${word.charType} ${highlight} ${word.highlight ? word.highlight : ''}`;
const id = `word-${word.verseKey.replace(/:/, '-')}-${audioPosition || word.position}`;

if (word.charType === CHAR_TYPE_WORD) {
id = `word-${word.verseKey.replace(/:/, '-')}-${audioPosition || word.position}`;
}

if (!useTextFont || word.charType === CHAR_TYPE_PAUSE) {
if (word.charType === CHAR_TYPE_END) {
text = zeroPad(word.verseKey.split(':')[1], 3, 0);
} else if (!useTextFont || word.charType === CHAR_TYPE_PAUSE) {
text = word.codeV3;
} else {
text = word.charType === CHAR_TYPE_END ? zeroPad(word.verseKey.split(':')[1], 3, 0) : word.textMadani;
text = word.textMadani;
}

return (
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/StringHelpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function zeroPad(num, places, padChar = '0') {
export function zeroPad(num, places, padChar = '0') { // eslint-disable-line
const zero = (places - num.toString().length) + 1;

return Array(+(zero > 0 && zero)).join(padChar) + num;
Expand Down