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

Use new segments and surah info data #542

Merged
merged 3 commits into from
Dec 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/components/Audioplayer/RepeatDropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export default class RepeatButton extends Component {
<div className="text-center">
<OverlayTrigger
overlay={popover}
placement="bottom"
placement="top"
trigger="click"
rootClose
>
Expand Down
2 changes: 0 additions & 2 deletions src/components/Audioplayer/Segments/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ import debug from 'helpers/debug';

export default class Segments extends Component {
static propTypes = {
audio: PropTypes.object,
segments: PropTypes.object.isRequired,
currentAyah: PropTypes.string,
currentTime: PropTypes.number
};

shouldComponentUpdate(nextProps) {
return [
this.props.audio !== nextProps.audio,
this.props.currentAyah !== nextProps.currentAyah,
this.props.currentTime !== nextProps.currentTime,
].some(test => test);
Expand Down
27 changes: 9 additions & 18 deletions src/components/Audioplayer/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// TODO: This file is too too large.
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { camelize } from 'humps';
Expand Down Expand Up @@ -252,7 +253,7 @@ export class Audioplayer extends Component {

handleAddFileListeners(file) {
const { update, currentTime } = this.props; // eslint-disable-line no-shadow
console.log('component:Audioplayer', `Attaching listeners to ${file.src}`);
debug('component:Audioplayer', `Attaching listeners to ${file.src}`);

// Preload file
file.setAttribute('preload', 'auto');
Expand Down Expand Up @@ -298,14 +299,10 @@ export class Audioplayer extends Component {
file.ontimeupdate = null; // eslint-disable-line no-param-reassign
};

const onProgress = () => {
};

file.onloadeddata = onLoadeddata; // eslint-disable-line no-param-reassign
file.onpause = onPause; // eslint-disable-line no-param-reassign
file.onplay = onPlay; // eslint-disable-line no-param-reassign
file.onended = onEnded; // eslint-disable-line no-param-reassign
file.onprogress = onProgress; // eslint-disable-line no-param-reassign

return file;
}
Expand Down Expand Up @@ -334,15 +331,12 @@ export class Audioplayer extends Component {
renderPlayStopButtons() {
const { isPlaying, pause } = this.props; // eslint-disable-line no-shadow

let icon = <i className="ss-icon ss-play" />;

if (isPlaying) {
icon = <i className="ss-icon ss-pause" />;
}

return (
<a className={`pointer text-center ${style.playingButton} ${style.buttons}`} onClick={isPlaying ? pause : this.play}>
{icon}
<a
className={`pointer text-center ${style.playingButton} ${style.buttons}`}
onClick={isPlaying ? pause : this.play}
>
<i className={`ss-icon ${isPlaying ? 'ss-pause' : 'ss-play'}`} />
</a>
);
}
Expand Down Expand Up @@ -382,7 +376,6 @@ export class Audioplayer extends Component {

const {
className,
currentFile,
segments,
isLoading,
currentAyah,
Expand Down Expand Up @@ -416,14 +409,12 @@ export class Audioplayer extends Component {
isLoadedOnClient &&
segments &&
segments[currentAyah] &&
typeof segments[currentAyah] !== 'string' ?
segments[currentAyah] &&
<Segments
audio={currentFile}
segments={segments[currentAyah]}
currentAyah={currentAyah}
currentTime={currentTime}
/> :
null
/>
}
</div>
<ul className={`list-inline ${style.controls}`}>
Expand Down
15 changes: 9 additions & 6 deletions src/components/Ayah/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class Ayah extends Component {
isAuthenticated: PropTypes.bool,
tooltip: PropTypes.string,
currentWord: PropTypes.any, // gets passed in an integer, null by default
currentAyah: PropTypes.string,
isCurrentAyah: PropTypes.bool,
audioActions: PropTypes.object.isRequired
};

Expand All @@ -50,7 +50,7 @@ export default class Ayah extends Component {
this.props.bookmarked !== nextProps.bookmarked,
this.props.tooltip !== nextProps.tooltip,
this.props.currentWord !== nextProps.currentWord,
this.props.currentAyah !== nextProps.currentAyah
this.props.isCurrentAyah !== nextProps.isCurrentAyah
];

if (this.props.match) {
Expand Down Expand Up @@ -285,7 +285,8 @@ export default class Ayah extends Component {
data-metrics-event-name="Ayah:Link"
>
{content}
</Link>);
</Link>
);
}

renderControls() {
Expand All @@ -300,12 +301,14 @@ export default class Ayah extends Component {
}

render() {
const { ayah, currentAyah } = this.props;
const className = ayah.ayahKey === currentAyah ? 'highlight' : '';
const { ayah, isCurrentAyah } = this.props;
debug('component:Ayah', `Render ${this.props.ayah.ayahNum}`);

return (
<Element name={`ayah:${ayah.ayahKey}`} className={`row ${className} ${styles.container}`}>
<Element
name={`ayah:${ayah.ayahKey}`}
className={`row ${isCurrentAyah && 'highlight'} ${styles.container}`}
>
{this.renderControls()}
<div className="col-md-11 col-sm-11">
{this.renderText()}
Expand Down
10 changes: 0 additions & 10 deletions src/components/SurahInfo/htmls/1.html.js

This file was deleted.

42 changes: 0 additions & 42 deletions src/components/SurahInfo/htmls/10.html.js

This file was deleted.

10 changes: 0 additions & 10 deletions src/components/SurahInfo/htmls/100.html.js

This file was deleted.

8 changes: 0 additions & 8 deletions src/components/SurahInfo/htmls/101.html.js

This file was deleted.

Loading