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
Next Next commit
fixed UI for Juz tab and minor warning fixes
  • Loading branch information
naveed-ahmad committed Sep 16, 2017
commit c5928572f6efe992f000a833c93b702f528ffae6
14 changes: 8 additions & 6 deletions src/components/Audioplayer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ export class Audioplayer extends Component {
audio
});

load({
chapterId: nextVerse.chapterId,
verseId: nextVerse.id,
verseKey: nextVerse.verseKey,
audio
});
if (nextVerse) {
load({
chapterId: nextVerse.chapterId,
verseId: nextVerse.id,
verseKey: nextVerse.verseKey,
audio
});
}

return false;
}
Expand Down
50 changes: 32 additions & 18 deletions src/components/Home/JuzList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,40 @@ class JuzList extends Component {
const juzzChapters = Object.keys(juz.verseMapping);

const list = juzzChapters.map(chapter => (
<div className={`col-xs-10 col-xs-offset-2 ${styles.translated_name}`}>
<span className={'text-uppercase'}>
{chapters[chapter].nameSimple}
</span>
<span>
<Link
to={`/${chapter}/${juz.verseMapping[chapter]}`}
className={`${styles.link} row`}
<div className={`col-md-12 ${styles.translated_name}`}>
<Link
to={`/${chapter}/${juz.verseMapping[chapter]}`}
className={`${styles.link} row`}
>
<div className="col-xs-9">
<span className={styles.chapterName}>
{chapters[chapter].nameSimple}
</span>

<span className="h5">
<small>{juz.verseMapping[chapter]}</small>
</span>
</div>
<div className={`col-xs-3 text-left ${styles.arabic}`}>
<span className={`icon-surah${chapters[chapter].id}`} />
</div>

<div
className={`col-xs-10 text-uppercase ${styles.translated_name} ${chapters[chapter].languageName}`}
>
{juz.verseMapping[chapter]}
</Link>
</span>
<small>{chapters[chapter].translatedName.name}</small>
</div>
</Link>
</div>
));

return list;
return (
<div className="col-md-10">
<div className="row">
{list}
</div>
</div>
);
}

render() {
Expand All @@ -36,14 +54,10 @@ class JuzList extends Component {
return (
<ul className="col-md-4 list-unstyled">
{juzs.map(juz => (
<li className={`${styles.item}`} key={juz.juzNumber}>
<div className="col-xs-2 text-muted">
<li className={`${styles.item} row`} key={juz.juzNumber}>
<div className="col-xs-2 col-md-1 text-muted">
{juz.juzNumber}
</div>
<div className="col-xs-7">
{juz.nameArabic}
{juz.nameSimple}
</div>
{this.renderJuz(juz)}
</li>
))}
Expand Down
15 changes: 11 additions & 4 deletions src/components/Home/JuzList/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,26 @@
.item {
color: $brand-primary;

&:hover {
background: #f1f1f1;
}

.link {
display: block;
padding: 10px 10px;

&:hover {
background: #f1f1f1;
}
}

.translated_name {
font-size: 10px;
color: #777;
}

.arabic {
font-size: 14px;
}

.chapterName{
margin-right: 5px;
font-size: 14px;
}
}
5 changes: 5 additions & 0 deletions src/components/Home/SurahsList/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@
.link {
display: block;
padding: 10px 10px;

&:hover {
background: #f1f1f1;
}
}

.translated_name {
font-size: 10px;
color: #777;
}
.arabic {
font-size: 14px;
Expand Down
25 changes: 19 additions & 6 deletions src/components/SurahsDropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ class SurahsDropdown extends Component {
const { chapters } = this.props;

return Object.values(chapters).map((chapter, index) => (
<LinkContainer to={`/${chapter.chapterNumber}`} activeClass="active" key={`chapter-${index}`}>
<LinkContainer
to={`/${chapter.chapterNumber}`}
activeClass="active"
key={`chapter-${index}`}
>
<MenuItem>
<div className="row">
<div className="col-xs-2 col-md-2">
Expand All @@ -27,9 +31,13 @@ class SurahsDropdown extends Component {
<div className="col-xs-7 col-md-7">
<span className="suran-name">{chapter.nameSimple}</span>
<br />
<span className="chapter-meaning">{chapter.translatedName.name}</span>
<span className="chapter-meaning">
{chapter.translatedName.name}
</span>
</div>
<div className={`col-xs-3 col-md-3 text-right ${styles.arabicName}`}>
<div
className={`col-xs-3 col-md-3 text-right ${styles.arabicName}`}
>
{chapter.nameArabic}
</div>
</div>
Expand All @@ -43,10 +51,15 @@ class SurahsDropdown extends Component {

return (
<NavDropdown
link
className={styles.dropdown}
id="chapters-dropdown"
title={chapter.nameSimple || <LocaleFormattedMessage id="setting.chapters" defaultMessage="Surahs" />}
title={
chapter.nameSimple ||
<LocaleFormattedMessage
id="setting.chapters"
defaultMessage="Surahs"
/>
}
>
{this.renderList()}
</NavDropdown>
Expand All @@ -56,7 +69,7 @@ class SurahsDropdown extends Component {

SurahsDropdown.propTypes = {
chapters: customPropTypes.chapters.isRequired,
chapter: customPropTypes.chapters.isRequired,
chapter: customPropTypes.surahType.isRequired
};

export default SurahsDropdown;
1 change: 0 additions & 1 deletion src/components/VersesDropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class VersesDropdown extends Component {

return (
<NavDropdown
link
className={`dropdown ${className} ${style.dropdown}`}
id="verses-dropdown"
title={title}
Expand Down
6 changes: 3 additions & 3 deletions src/containers/Home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class Home extends Component {

return (
<div className="row">
<JuzList chapters={chapters} juzs={juzList.slice(0, 10)} />
<JuzList chapters={chapters} juzs={juzList.slice(10, 20)} />
<JuzList chapters={chapters} juzs={juzList.slice(20, 30)} />
<JuzList chapters={chapters} juzs={juzList.slice(0, 20)} />
<JuzList chapters={chapters} juzs={juzList.slice(20, 28)} />
<JuzList chapters={chapters} juzs={juzList.slice(28, 30)} />
</div>
);
}
Expand Down
10 changes: 7 additions & 3 deletions src/containers/Surah/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ class Surah extends Component {
</div>
);

return isLoading ? <Loader isActive relative style={LoaderStyle} /> : noAyah;
return isLoading
? <Loader isActive relative style={LoaderStyle} />
: noAyah;
}

renderPagination() {
Expand Down Expand Up @@ -306,7 +308,9 @@ class Surah extends Component {
</li>}
</ul>
}
loadingComponent={<Loader isActive={isLoading} relative style={LoaderStyle} />}
loadingComponent={
<Loader isActive={isLoading} relative style={LoaderStyle} />
}
/>
);
}
Expand Down Expand Up @@ -434,7 +438,7 @@ class Surah extends Component {
</div>
</div>
</div>
{__CLIENT__ &&
{__CLIENT__ && // eslint-disable-line
<Audioplayer
chapter={chapter}
verses={verses}
Expand Down
4 changes: 2 additions & 2 deletions src/redux/actions/verses.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {

// NOTE: For safe measure
const defaultOptions = {
translations: [101]
translations: [108]
};

// NOTE: From the API!
Expand All @@ -30,7 +30,7 @@ function prepareParams(params, options) {
? params.translations.split(',')
: params.translations;
} else {
translations = options.translations || defaultOptions.translations;
translations = options.translations; // || defaultOptions.translations;
}

return { translations };
Expand Down
2 changes: 1 addition & 1 deletion src/redux/modules/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const initialState = {
isNightMode: options.isNightMode || false,
isShowingSurahInfo: options.isShowingSurahInfo || false,
audio: options.audio || 7, // Mishari Rashid al-`Afasy
translations: options.translations || [101], // Clear Quran
translations: options.translations || [108], // Clear Quran
tooltip: options.tooltip || 'translation',
fontSize: options.fontSize || {
arabic: 3.5,
Expand Down