This repository has been archived by the owner on Jun 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 361
Local support #523
Merged
Merged
Local support #523
Changes from 5 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
ef3acc2
Work in progress for #245
naveed-ahmad 465ef5a
Merge branch 'master' of https://github.com/quran/quran.com-frontend …
naveed-ahmad c7e1f1f
refactored local, local specific fonts, almost done with i18n :)
naveed-ahmad ff4c393
fixed search break and added other missing translation keys
naveed-ahmad e722edc
added local switch
naveed-ahmad d5102a5
fixed the bug
naveed-ahmad 564a3e4
Merge branch 'master' of https://github.com/quran/quran.com-frontend …
naveed-ahmad 8d77638
fixed noscript break
naveed-ahmad 9058a4f
added intl pollyfil
naveed-ahmad 70d0276
replaced double quote with single quote
naveed-ahmad 161ff10
fixing specs
naveed-ahmad b87506b
formatting
naveed-ahmad 2bf0186
more formatting
naveed-ahmad 11afb12
fixed noscript break
naveed-ahmad dbfeeb8
fixed the link
naveed-ahmad 1002dde
Merge branch 'noscript_fix' into i18n
naveed-ahmad 85f7eeb
fixed specs using mound instead of shallow
naveed-ahmad 2979a75
Merge branch 'master' of https://github.com/quran/quran.com-frontend …
naveed-ahmad 18f3a01
added arabic local
naveed-ahmad 18c392a
PhantomJS don't support! fixed intl helper with vanilla js
naveed-ahmad aae5118
added local for bookmark
naveed-ahmad 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -3,6 +3,7 @@ import Link from 'react-router/lib/Link'; | |
import { Element } from 'react-scroll'; | ||
|
||
import Copy from 'components/Copy'; | ||
import LocaleFormattedMessage from 'components/LocaleFormattedMessage'; | ||
|
||
import debug from 'helpers/debug'; | ||
|
||
|
@@ -50,7 +51,8 @@ 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.currentAyah !== nextProps.currentAyah, | ||
this.props.isPlaying !== nextProps.isPlaying | ||
]; | ||
|
||
if (this.props.match) { | ||
|
@@ -61,12 +63,12 @@ export default class Ayah extends Component { | |
} | ||
|
||
handlePlay(ayah) { | ||
const { isPlaying, audioActions } = this.props; | ||
const { isPlaying, audioActions, currentAyah } = this.props; | ||
const { pause, setAyah, play } = audioActions; | ||
const isPreviouslyPlaying = isPlaying; | ||
|
||
if (isPlaying) { | ||
if (isPlaying) | ||
pause(); | ||
} | ||
setAyah(ayah); | ||
play(); | ||
} | ||
|
@@ -89,17 +91,17 @@ export default class Ayah extends Component { | |
> | ||
<h4 className="montserrat">{content.name || content.resource.name}</h4> | ||
<h2 className={`${isArabic ? 'text-right' : 'text-left'} text-translation times-new`}> | ||
<small dangerouslySetInnerHTML={{__html: content.text}} className={`${styles[lang] || 'times-new'}`} /> | ||
<small dangerouslySetInnerHTML={{__html: content.text}} className={lang} /> | ||
</h2> | ||
</div> | ||
); | ||
}); | ||
} | ||
|
||
renderMedia() { | ||
const { ayah, mediaActions } = this.props; | ||
const { ayah, mediaActions, isSearched } = this.props; | ||
|
||
if (!!ayah.mediaContent) return false; | ||
if (isSearched || !!ayah.mediaContent) return false; | ||
|
||
return ( | ||
<div> | ||
|
@@ -119,7 +121,11 @@ export default class Ayah extends Component { | |
data-metrics-media-content-id={content.id} | ||
data-metrics-media-content-ayah-key={ayah.ayahKey} | ||
> | ||
Watch lecture by {content.resource.name} | ||
<LocaleFormattedMessage | ||
id={'ayah.media.lectureFrom'} | ||
defaultMessage={"Watch lecture by {from}"} | ||
values={{from: content.resource.name}} | ||
/> | ||
</a> | ||
</small> | ||
</h2> | ||
|
@@ -131,7 +137,7 @@ export default class Ayah extends Component { | |
} | ||
|
||
renderText() { | ||
const { ayah, audioActions: { setCurrentWord }, tooltip } = this.props; | ||
const { ayah, audioActions, tooltip, isSearched } = this.props; | ||
|
||
if (!ayah.words[0].code) { | ||
return false; | ||
|
@@ -159,20 +165,19 @@ export default class Ayah extends Component { | |
key={word.code} | ||
id={id} | ||
rel="tooltip" | ||
onClick={(event) => setCurrentWord(event.target.dataset.key)} | ||
onClick={(event) => isSearched ? '' : audioActions.setCurrentWord(event.target.dataset.key)} | ||
data-key={`${word.ayahKey}:${position}`} | ||
className={`${className}`} | ||
title={tooltipContent} | ||
dangerouslySetInnerHTML={{__html: word.code}} | ||
/> | ||
); | ||
} | ||
|
||
const label = isLast ? {'title': `Verse ${ayah.ayahNum}`} : {} | ||
return ( | ||
<b | ||
id={id} | ||
onClick={(event) => setCurrentWord(event.target.dataset.key)} | ||
onClick={(event) => isSearched? '' : audioActions.setCurrentWord(event.target.dataset.key)} | ||
data-key={`${word.ayahKey}:${position}`} | ||
rel="tooltip" | ||
className={`${className} ${isLast} pointer`} | ||
|
@@ -197,15 +202,25 @@ export default class Ayah extends Component { | |
} | ||
|
||
renderPlayLink() { | ||
const { isSearched, ayah } = this.props; | ||
const { isSearched, ayah, currentAyah, isPlaying } = this.props; | ||
const playing = ayah.ayahKey == currentAyah && isPlaying; | ||
let icon = <i className="ss-icon ss-play" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✂️ |
||
|
||
if (playing) { | ||
icon = <i className="ss-icon ss-pause" />; | ||
} | ||
|
||
if (!isSearched) { | ||
return ( | ||
<a | ||
onClick={() => this.handlePlay(ayah.ayahKey)} | ||
className="text-muted" | ||
> | ||
<i className="ss-icon ss-play" /> Play | ||
{icon} | ||
<LocaleFormattedMessage | ||
id={ playing ? 'actions.pause' : 'actions.play' } | ||
defaultMessage={ playing ? 'Pause' : 'Play'} | ||
/> | ||
</a> | ||
); | ||
} | ||
|
@@ -226,17 +241,17 @@ export default class Ayah extends Component { | |
} | ||
|
||
renderBookmark() { | ||
const { ayah, bookmarked, isAuthenticated, bookmarkActions } = this.props; | ||
const { ayah, bookmarked, isAuthenticated, bookmarkActions, isSearched } = this.props; | ||
|
||
if (!isAuthenticated) return false; | ||
if (isSearched || !isAuthenticated) return false; | ||
|
||
if (bookmarked) { | ||
return ( | ||
<a | ||
onClick={() => bookmarkActions.removeBookmark(ayah.ayahKey)} | ||
className="text-muted" | ||
> | ||
<strong><i className="ss-icon ss-bookmark" /> Bookmarked</strong> | ||
<strong><i className="ss-icon ss-bookmark" /> Bookmarked </strong> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. localized this as well |
||
</a> | ||
); | ||
} | ||
|
Oops, something went wrong.
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.
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.
youll hate me for this, but technically you don't need the surrounding
{}
.id="player.currentAyah"
will suffice. Inshallah once I put more eslint it will catch theseThere 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.
No, Ill love to learn and follow best practices. So we don't need {} for string literals