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

Commit 908bbc1

Browse files
authoredApr 20, 2017
Release v3.0.2 (#757)
* Add prettier (#754) * add prettier * ensure prettier works * Quick deploy changes (#755) * Center reading mode * Fixes #742 loading component * Fixes #704 contact us to zendesk * Fix sitemap * Fix overflow and default reciter
1 parent d94783c commit 908bbc1

File tree

10 files changed

+316
-75
lines changed

10 files changed

+316
-75
lines changed
 

‎.eslintrc

+5
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
"comma-dangle": 0,
66
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
77
"import/no-extraneous-dependencies": 0,
8+
"import/prefer-default-export": 1,
89
"import/extensions": 0,
910
"import/no-unresolved": 0,
11+
"property": 0,
12+
"no-mixed-operators": 0,
1013
"strict": 0
1114
},
1215
"ecmaFeatures": {
@@ -38,7 +41,9 @@
3841
mixpanel: true,
3942
"expect": true,
4043
"browser": true,
44+
"import": true,
4145
"FB": true,
46+
"window": true,
4247
sinon: true
4348
},
4449
"env": {

‎package.json

+18-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,21 @@
1919
"build:client": "webpack --config ./webpack/prod.config.js",
2020
"validate": "npm ls",
2121
"analyze:build": "env NODE_ENV=production webpack --json --config ./webpack/prod.config.js > bundle-stats.json",
22-
"analyze:json": "webpack-bundle-size-analyzer bundle-stats.json"
22+
"analyze:json": "webpack-bundle-size-analyzer bundle-stats.json",
23+
"lint:fix": "npm run test:dev:lint -- --fix",
24+
"prettier": "prettier --single-quote --write",
25+
"precommit": "lint-staged"
26+
},
27+
"pre-commit": [
28+
"test:stylelint",
29+
"precommit"
30+
],
31+
"lint-staged": {
32+
"*.js": [
33+
"npm run prettier",
34+
"npm run lint:fix",
35+
"git add"
36+
]
2337
},
2438
"engines": {
2539
"node": ">= 6.3.0"
@@ -158,13 +172,15 @@
158172
"karma-sinon": "1.0.4",
159173
"karma-sourcemap-loader": "0.3.7",
160174
"karma-webpack": "1.8.0",
175+
"lint-staged": "^3.4.0",
161176
"mocha": "2.2.5",
162177
"nodemon": "1.7.1",
163178
"path": "0.11.14",
164179
"phantomjs": "1.9.20",
165180
"phantomjs-polyfill": "0.0.1",
166181
"piping": "0.3.0",
167182
"pre-commit": "1.1.3",
183+
"prettier": "^1.2.2",
168184
"react-addons-test-utils": "15.4.1",
169185
"react-transform-catch-errors": "1.0.0",
170186
"react-transform-hmr": "1.0.1",
@@ -179,9 +195,5 @@
179195
"webpack-bundle-analyzer": "2.2.1",
180196
"webpack-dev-server": "2.1.0-beta.0",
181197
"webpack-hot-middleware": "2.12.2"
182-
},
183-
"pre-commit": [
184-
"test:dev:lint",
185-
"test:stylelint"
186-
]
198+
}
187199
}

‎src/components/ComponentLoader/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { PropTypes } from 'react';
22

33
const ComponentLoader = ({ isLoading, error, pastDelay }) => {
44
if (isLoading) {
5-
return pastDelay ? <div>Loading...</div> : null;
5+
return pastDelay ? <noscript /> : null;
66
} else if (error) {
77
return <div>Error! Component failed to load</div>;
88
}

‎src/components/Footer/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ const Footer = () => (
2828
</Link>
2929
</li>
3030
<li>
31-
<Link to="/contact">
31+
<a href="https://quran.zendesk.com/hc/en-us/requests/new">
3232
<LocaleFormattedMessage
3333
id="nav.contactUs"
3434
defaultMessage="Contact Us"
3535
/>
36-
</Link>
36+
</a>
3737
</li>
3838
<li>
3939
<a

‎src/components/Verse/style.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@
7575
float: left;
7676

7777
b, span{
78-
float: right;
7978
border-color: transparent;
8079
border-width: 0px 0px 1px 0px;
8180
border-style: solid;
81+
float: right;
8282
&.active {
8383
color: $brand-primary-darker-5;
8484
border-color: $brand-primary-darker-15;
@@ -87,7 +87,7 @@
8787

8888
.line{
8989
direction: rtl;
90-
b{
90+
b, span{
9191
float: none;
9292
display: inline-block;
9393
}

‎src/redux/actions/audioplayer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export function load({ chapterId, verseId, verseKey, audio }) { // eslint-disabl
101101
types: [LOAD, LOAD_SUCCESS, LOAD_FAIL],
102102
promise: client => client.get(`/api/v3/chapters/${chapterId}/verses/${verseId}/audio_files`, {
103103
params: {
104-
recitation: audio || 8 // NOTE: default, but should never be used
104+
recitation: audio || 7 // NOTE: default, but should never be used
105105
}
106106
}),
107107
verseKey,

‎src/redux/modules/options.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const initialState = {
1313
isShowingSurahInfo: false,
1414
loadingRecitations: false,
1515
loadingTranslations: false,
16-
audio: 8,
17-
translations: [20],
16+
audio: 7, // Mishari Rashid al-`Afasy
17+
translations: [20], // Sahih International
1818
tooltip: 'translation',
1919
userAgent: null,
2020
footNote: null,

‎src/server.js

+33-34
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ Raven.config(config.sentryServer, {
3131
autoBreadcrumbs: true
3232
}).install();
3333

34-
3534
expressConfig(server);
3635

37-
3836
server.use(Raven.requestHandler());
3937

4038
server.use((req, res, next) => {
@@ -49,14 +47,11 @@ server.use((req, res, next) => {
4947
}
5048

5149
if (req.query.DISABLE_SSR) {
52-
return res.status(200).send(`<!doctype html>\n${ReactDOM.renderToString(
53-
<IntlProvider locale="en" messages={localMessages}>
54-
<Html
55-
store={store}
56-
assets={webpack_isomorphic_tools.assets()}
57-
/>
58-
</IntlProvider>
59-
)}`);
50+
return res.status(200).send(
51+
`<!doctype html>\n${ReactDOM.renderToString(<IntlProvider locale="en" messages={localMessages}>
52+
<Html store={store} assets={webpack_isomorphic_tools.assets()} />
53+
</IntlProvider>)}`
54+
);
6055
}
6156

6257
store.dispatch(setUserAgent(req.useragent));
@@ -74,29 +69,29 @@ server.use((req, res, next) => {
7469
console.error('ROUTER ERROR:', pretty.render(error));
7570
res.status(500).send(error);
7671
} else if (renderProps) {
77-
const status = renderProps.location.pathname.indexOf('/error') > -1 ? 404 : 200;
78-
79-
loadOnServer({ ...renderProps, store, helpers: { client } }).then(() => {
80-
const component = (
81-
<IntlProvider messages={localMessages} locale="en" >
82-
<Provider store={store}>
83-
<ReduxAsyncConnect {...renderProps} />
84-
</Provider>
85-
</IntlProvider>
86-
);
87-
88-
res.type('html');
89-
res.setHeader('Cache-Control', 'public, max-age=31557600');
90-
res.status(status);
91-
debug('Server', 'Sending markup');
92-
res.send(`<!doctype html>\n${ReactDOM.renderToString(
93-
<Html
94-
component={component}
95-
store={store}
96-
assets={webpack_isomorphic_tools.assets()}
97-
/>
98-
)}`);
99-
}).catch(next);
72+
const status = renderProps.location.pathname.indexOf('/error') > -1
73+
? 404
74+
: 200;
75+
76+
loadOnServer({ ...renderProps, store, helpers: { client } })
77+
.then(() => {
78+
const component = (
79+
<IntlProvider messages={localMessages} locale="en">
80+
<Provider store={store}>
81+
<ReduxAsyncConnect {...renderProps} />
82+
</Provider>
83+
</IntlProvider>
84+
);
85+
86+
res.type('html');
87+
res.setHeader('Cache-Control', 'public, max-age=31557600');
88+
res.status(status);
89+
debug('Server', 'Sending markup');
90+
res.send(
91+
`<!doctype html>\n${ReactDOM.renderToString(<Html component={component} store={store} assets={webpack_isomorphic_tools.assets()} />)}`
92+
);
93+
})
94+
.catch(next);
10095
}
10196
}
10297
);
@@ -123,7 +118,11 @@ export default function serve(cb) {
123118
console.info(`==> 🌎 ENV=${process.env.NODE_ENV}`);
124119
console.info(`==> ✅ Server is listening at http://localhost:${port}`);
125120
console.info(`==> 🎯 API at ${process.env.API_URL}`);
126-
Object.keys(config).forEach(key => config[key].constructor.name !== 'Object' && console.info(`==> ${key}`, config[key]));
121+
Object.keys(config).forEach(
122+
key =>
123+
config[key].constructor.name !== 'Object' &&
124+
console.info(`==> ${key}`, config[key])
125+
);
127126

128127
return cb && cb(this);
129128
});

‎src/server/config/sitemap.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ export default (server) => {
99

1010
client.get('/api/v3/chapters').then((response) => {
1111
response.chapters.forEach((chapter) => {
12-
Array(chapter.versesCount).fill().forEach((_, index) => {
13-
const ayahId = index + 1;
12+
Array(chapter.verses_count).fill().forEach((_, index) => {
13+
const verseId = index + 1;
1414

1515
urls.push({
16-
url: `/${chapter.id}/${ayahId}`,
16+
url: `/${chapter.id}/${verseId}`,
1717
changefreq: 'weekly',
1818
priority: 1
1919
});
2020

2121
urls.push({
22-
url: `/${chapter.id}/${ayahId}-${ayahId + 9}`,
22+
url: `/${chapter.id}/${verseId}-${verseId + 9}`,
2323
changefreq: 'weekly',
2424
priority: 1
2525
});
@@ -62,7 +62,6 @@ export default (server) => {
6262
});
6363
});
6464

65-
6665
const xml = sitemap.createSitemap({
6766
hostname: 'https://quran.com',
6867
cacheTime: 600000, // 600 sec cache period

‎yarn.lock

+248-22
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
This repository has been archived.