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

Simple refactorizations (v2). #838

Merged
merged 2 commits into from
Jul 2, 2017
Merged

Simple refactorizations (v2). #838

merged 2 commits into from
Jul 2, 2017

Conversation

UmanShahzad
Copy link
Contributor

@UmanShahzad UmanShahzad commented Jul 1, 2017

Assalamu Alaikum,

Here's a relatively tiny PR in a continued effort to try and refactor the codebase to be more consistent / clean / efficient, etc.

See my comments within the diffs for info on certain changes.

Reviewers

src/config.js Outdated
'muslim',
'islam',
'Allah'
];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allows us to more sensibly add keywords in the future.

@@ -28,24 +46,43 @@ const config = {
sentryClient: process.env.SENTRY_KEY_CLIENT,
sentryServer: process.env.SENTRY_KEY_SERVER,
facebookAppId: process.env.FACEBOOK_APP_ID,
// Supported locales
locales,
defaultLocale: 'en',
app: {
head: {
titleTemplate: `%s - ${title}`,
meta: [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the changes below are simply to make the file look more consistent, and future metadata additions would follow that one style.

@@ -191,7 +308,7 @@ const config = {
},
...Object.keys(locales).map(key => ({
rel: 'alternate',
hreflang: key,
hrefLang: key,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently hreflang is a typo..?

@@ -4,33 +4,33 @@ import Helmet from 'react-helmet';

export default () => (
<div>
Copy link
Contributor Author

@UmanShahzad UmanShahzad Jul 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figured we'd try and reference it as Qur'an more and more, but it may have been overkill in some places. In particular I think I'll revert the diff right below this comment after the tests pass -- please remind me before review approval & merge. Reverted that specific change.

@@ -0,0 +1,118 @@
/* eslint-disable no-unused-vars */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We add this file to drop major constants like the one below, which may be reusable.

Copy link
Contributor

@naveed-ahmad naveed-ahmad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jazak Allah for more contribution. Need minor changes for urls.

src/config.js Outdated
{ rel: 'manifest', href: 'manifest.json' },
{
rel: 'manifest',
href: 'manifest.json'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be /manifest.json

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch.

src/config.js Outdated
},
{
rel: 'apple-touch-icon',
href: 'apple-touch-icon.png'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/apple-touch-icon.png

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactoring brings up unforeseen issues 👍

const description =
'Ayatul Kursi is verse 255 of the second chapter, surah Baqarah of the Holy Quran, Surah al-Baqarah (The Chapter of the Cow). It is also known as the Throne Verse.';
const description = 'Ayatul Kursi is verse 255 of the second chapter in the ' +
'Holy Quran, Surah al-Baqarah (The Chapter of the Cow). ' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

second chapter, Surah al_Baqarah( The Chapter of Cow) of Holy Quran feel more readable :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

replaceState('/error/invalid-surah');
}
}

function filterValidVerse(replaceState, chapterId, verseRange) {
const chapterToVersesMap = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 the best code is deleted code :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

@UmanShahzad
Copy link
Contributor Author

@naveed-ahmad Thanks for the review. I've made the changes.

@naveed-ahmad
Copy link
Contributor

rebuild

@naveed-ahmad
Copy link
Contributor

rebuild

1 similar comment
@naveed-ahmad
Copy link
Contributor

rebuild

@ahmedre
Copy link
Contributor

ahmedre commented Jul 2, 2017

Deployed to: http://staging.quran.com:32904

Ensure consistent JSON-style maps.
Add HTML corrections & reorganize a little.
Correct href keys.
@ahmedre
Copy link
Contributor

ahmedre commented Jul 2, 2017

Deployed to: http://staging.quran.com:32906

@UmanShahzad
Copy link
Contributor Author

Sorry about the build errors, @naveed-ahmad. It was a super tiny error that wasn't made clear from the logs :) All is good now and I've squashed the commits.

@ahmedre
Copy link
Contributor

ahmedre commented Jul 2, 2017

Deployed to: http://staging.quran.com:32909

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants