This repository was archived by the owner on Jun 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 370
Highlight word in reading mode as well #556
Merged
Merged
Changes from 4 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
5b5764f
highlight current word is readmode as well
naveed-ahmad dac141d
Merge branch 'master' of https://github.com/quran/quran.com-frontend …
naveed-ahmad 71b890b
added word by word play! buggy but working
naveed-ahmad 53a5a39
fixed word position in reading modet
naveed-ahmad 8c59513
DRYed word render and added tooltip in reading mode
naveed-ahmad d3a6216
fixed trans language class
naveed-ahmad 7544d29
refactoring word rendering
naveed-ahmad 1c9be1d
Merge branch 'master' of https://github.com/quran/quran.com-frontend …
naveed-ahmad b97fdd5
refactored word rendering
naveed-ahmad 3dddab0
removed duplicated code
naveed-ahmad e07c5b9
removed debuging
naveed-ahmad 7ad303e
adding auto scrolling in reading mode
naveed-ahmad e3a761e
Merge branch 'master' of https://github.com/quran/quran.com-frontend …
naveed-ahmad 8998296
Merge branch 'master' into word-by-word-audio
naveed-ahmad b464582
Merge branch 'master' into word-by-word-audio
mmahalwy d54518e
Merge branch 'master' into word-by-word-audio
mmahalwy 2950aef
Merge branch 'master' into word-by-word-audio
mmahalwy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,8 +24,8 @@ export default class Ayah extends Component { | |
| isSearched: PropTypes.bool, | ||
| ayah: PropTypes.object.isRequired, | ||
| bookmarked: PropTypes.bool.isRequired, | ||
| bookmarkActions: PropTypes.object, | ||
| mediaActions: PropTypes.object.isRequired, | ||
| bookmarkActions: PropTypes.object, | ||
| match: PropTypes.array, | ||
| isSearch: PropTypes.bool, | ||
| isPlaying: PropTypes.bool, | ||
|
|
@@ -62,16 +62,31 @@ export default class Ayah extends Component { | |
| } | ||
|
|
||
| handlePlay(ayah) { | ||
| const { isPlaying, audioActions, currentAyah } = this.props; | ||
| const { isPlaying, audioActions } = this.props; | ||
| const { pause, setAyah, play } = audioActions; | ||
| const isPreviouslyPlaying = isPlaying; | ||
|
|
||
| if (isPlaying) | ||
| pause(); | ||
| setAyah(ayah); | ||
| play(); | ||
| } | ||
|
|
||
| handleWordClick(word){ | ||
| const { isCurrentAyah, audioActions, isSearched, isPlaying } = this.props; | ||
|
|
||
| if(isSearched || !audioActions.setCurrentWord) | ||
| return; | ||
|
|
||
| if(isCurrentAyah && isPlaying) { | ||
| audioActions.setCurrentWord(word.dataset.key) ; | ||
| } | ||
| else { | ||
| audioActions.setAyah(word.dataset.ayah); | ||
| audioActions.playCurrentWord(word.dataset.key); | ||
| //audioActions.play(); | ||
|
||
| } | ||
| } | ||
|
|
||
| renderTranslations() { | ||
| const { ayah, match } = this.props; | ||
|
|
||
|
|
@@ -155,8 +170,6 @@ export default class Ayah extends Component { | |
| if (word.charTypeId === CHAR_TYPE_WORD) { | ||
| position = position + 1; | ||
| id = `word-${word.ayahKey.replace(/:/, '-')}-${position}`; | ||
| } else { | ||
| id = `${word.className}-${word.codeDec}`; // just don't include id | ||
| } | ||
|
|
||
| if (word.translation || word.transliteration) { | ||
|
|
@@ -167,10 +180,9 @@ export default class Ayah extends Component { | |
| key={word.code} | ||
| id={id} | ||
| rel="tooltip" | ||
| onClick={event => | ||
| !isSearched && audioActions.setCurrentWord && audioActions.setCurrentWord(event.target.dataset.key) | ||
| } | ||
| onClick={(event) => this.handleWordClick(event.target)} | ||
| data-key={`${word.ayahKey}:${position}`} | ||
| data-ayah={word.ayahKey} | ||
| className={`${className}`} | ||
| title={tooltipContent} | ||
| dangerouslySetInnerHTML={{__html: word.code}} | ||
|
|
@@ -181,13 +193,12 @@ export default class Ayah extends Component { | |
| return ( | ||
| <b | ||
| id={id} | ||
| onClick={event => | ||
| !isSearched && audioActions.setCurrentWord && audioActions.setCurrentWord(event.target.dataset.key) | ||
| } | ||
| onClick={(event) => this.handleWordClick(event.target)} | ||
| data-key={`${word.ayahKey}:${position}`} | ||
| rel="tooltip" | ||
| className={`${className} ${isLast} pointer`} | ||
| key={word.code} | ||
| data-ayah={word.ayahKey} | ||
| dangerouslySetInnerHTML={{__html: word.code}} | ||
| {...label} | ||
| /> | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same line