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

Commit

Permalink
Release v3.0.2 (#757)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mmahalwy authored Apr 20, 2017
1 parent d94783c commit 908bbc1
Show file tree
Hide file tree
Showing 10 changed files with 316 additions and 75 deletions.
5 changes: 5 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
"comma-dangle": 0,
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"import/no-extraneous-dependencies": 0,
"import/prefer-default-export": 1,
"import/extensions": 0,
"import/no-unresolved": 0,
"property": 0,
"no-mixed-operators": 0,
"strict": 0
},
"ecmaFeatures": {
Expand Down Expand Up @@ -38,7 +41,9 @@
mixpanel: true,
"expect": true,
"browser": true,
"import": true,
"FB": true,
"window": true,
sinon: true
},
"env": {
Expand Down
24 changes: 18 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,21 @@
"build:client": "webpack --config ./webpack/prod.config.js",
"validate": "npm ls",
"analyze:build": "env NODE_ENV=production webpack --json --config ./webpack/prod.config.js > bundle-stats.json",
"analyze:json": "webpack-bundle-size-analyzer bundle-stats.json"
"analyze:json": "webpack-bundle-size-analyzer bundle-stats.json",
"lint:fix": "npm run test:dev:lint -- --fix",
"prettier": "prettier --single-quote --write",
"precommit": "lint-staged"
},
"pre-commit": [
"test:stylelint",
"precommit"
],
"lint-staged": {
"*.js": [
"npm run prettier",
"npm run lint:fix",
"git add"
]
},
"engines": {
"node": ">= 6.3.0"
Expand Down Expand Up @@ -158,13 +172,15 @@
"karma-sinon": "1.0.4",
"karma-sourcemap-loader": "0.3.7",
"karma-webpack": "1.8.0",
"lint-staged": "^3.4.0",
"mocha": "2.2.5",
"nodemon": "1.7.1",
"path": "0.11.14",
"phantomjs": "1.9.20",
"phantomjs-polyfill": "0.0.1",
"piping": "0.3.0",
"pre-commit": "1.1.3",
"prettier": "^1.2.2",
"react-addons-test-utils": "15.4.1",
"react-transform-catch-errors": "1.0.0",
"react-transform-hmr": "1.0.1",
Expand All @@ -179,9 +195,5 @@
"webpack-bundle-analyzer": "2.2.1",
"webpack-dev-server": "2.1.0-beta.0",
"webpack-hot-middleware": "2.12.2"
},
"pre-commit": [
"test:dev:lint",
"test:stylelint"
]
}
}
2 changes: 1 addition & 1 deletion src/components/ComponentLoader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { PropTypes } from 'react';

const ComponentLoader = ({ isLoading, error, pastDelay }) => {
if (isLoading) {
return pastDelay ? <div>Loading...</div> : null;
return pastDelay ? <noscript /> : null;
} else if (error) {
return <div>Error! Component failed to load</div>;
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Footer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ const Footer = () => (
</Link>
</li>
<li>
<Link to="/contact">
<a href="https://quran.zendesk.com/hc/en-us/requests/new">
<LocaleFormattedMessage
id="nav.contactUs"
defaultMessage="Contact Us"
/>
</Link>
</a>
</li>
<li>
<a
Expand Down
4 changes: 2 additions & 2 deletions src/components/Verse/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@
float: left;

b, span{
float: right;
border-color: transparent;
border-width: 0px 0px 1px 0px;
border-style: solid;
float: right;
&.active {
color: $brand-primary-darker-5;
border-color: $brand-primary-darker-15;
Expand All @@ -87,7 +87,7 @@

.line{
direction: rtl;
b{
b, span{
float: none;
display: inline-block;
}
Expand Down
2 changes: 1 addition & 1 deletion src/redux/actions/audioplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export function load({ chapterId, verseId, verseKey, audio }) { // eslint-disabl
types: [LOAD, LOAD_SUCCESS, LOAD_FAIL],
promise: client => client.get(`/api/v3/chapters/${chapterId}/verses/${verseId}/audio_files`, {
params: {
recitation: audio || 8 // NOTE: default, but should never be used
recitation: audio || 7 // NOTE: default, but should never be used
}
}),
verseKey,
Expand Down
4 changes: 2 additions & 2 deletions src/redux/modules/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ const initialState = {
isShowingSurahInfo: false,
loadingRecitations: false,
loadingTranslations: false,
audio: 8,
translations: [20],
audio: 7, // Mishari Rashid al-`Afasy
translations: [20], // Sahih International
tooltip: 'translation',
userAgent: null,
footNote: null,
Expand Down
67 changes: 33 additions & 34 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ Raven.config(config.sentryServer, {
autoBreadcrumbs: true
}).install();


expressConfig(server);


server.use(Raven.requestHandler());

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

if (req.query.DISABLE_SSR) {
return res.status(200).send(`<!doctype html>\n${ReactDOM.renderToString(
<IntlProvider locale="en" messages={localMessages}>
<Html
store={store}
assets={webpack_isomorphic_tools.assets()}
/>
</IntlProvider>
)}`);
return res.status(200).send(
`<!doctype html>\n${ReactDOM.renderToString(<IntlProvider locale="en" messages={localMessages}>
<Html store={store} assets={webpack_isomorphic_tools.assets()} />
</IntlProvider>)}`
);
}

store.dispatch(setUserAgent(req.useragent));
Expand All @@ -74,29 +69,29 @@ server.use((req, res, next) => {
console.error('ROUTER ERROR:', pretty.render(error));
res.status(500).send(error);
} else if (renderProps) {
const status = renderProps.location.pathname.indexOf('/error') > -1 ? 404 : 200;

loadOnServer({ ...renderProps, store, helpers: { client } }).then(() => {
const component = (
<IntlProvider messages={localMessages} locale="en" >
<Provider store={store}>
<ReduxAsyncConnect {...renderProps} />
</Provider>
</IntlProvider>
);

res.type('html');
res.setHeader('Cache-Control', 'public, max-age=31557600');
res.status(status);
debug('Server', 'Sending markup');
res.send(`<!doctype html>\n${ReactDOM.renderToString(
<Html
component={component}
store={store}
assets={webpack_isomorphic_tools.assets()}
/>
)}`);
}).catch(next);
const status = renderProps.location.pathname.indexOf('/error') > -1
? 404
: 200;

loadOnServer({ ...renderProps, store, helpers: { client } })
.then(() => {
const component = (
<IntlProvider messages={localMessages} locale="en">
<Provider store={store}>
<ReduxAsyncConnect {...renderProps} />
</Provider>
</IntlProvider>
);

res.type('html');
res.setHeader('Cache-Control', 'public, max-age=31557600');
res.status(status);
debug('Server', 'Sending markup');
res.send(
`<!doctype html>\n${ReactDOM.renderToString(<Html component={component} store={store} assets={webpack_isomorphic_tools.assets()} />)}`
);
})
.catch(next);
}
}
);
Expand All @@ -123,7 +118,11 @@ export default function serve(cb) {
console.info(`==> 🌎 ENV=${process.env.NODE_ENV}`);
console.info(`==> ✅ Server is listening at http://localhost:${port}`);
console.info(`==> 🎯 API at ${process.env.API_URL}`);
Object.keys(config).forEach(key => config[key].constructor.name !== 'Object' && console.info(`==> ${key}`, config[key]));
Object.keys(config).forEach(
key =>
config[key].constructor.name !== 'Object' &&
console.info(`==> ${key}`, config[key])
);

return cb && cb(this);
});
Expand Down
9 changes: 4 additions & 5 deletions src/server/config/sitemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ export default (server) => {

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

urls.push({
url: `/${chapter.id}/${ayahId}`,
url: `/${chapter.id}/${verseId}`,
changefreq: 'weekly',
priority: 1
});

urls.push({
url: `/${chapter.id}/${ayahId}-${ayahId + 9}`,
url: `/${chapter.id}/${verseId}-${verseId + 9}`,
changefreq: 'weekly',
priority: 1
});
Expand Down Expand Up @@ -62,7 +62,6 @@ export default (server) => {
});
});


const xml = sitemap.createSitemap({
hostname: 'https://quran.com',
cacheTime: 600000, // 600 sec cache period
Expand Down
Loading

0 comments on commit 908bbc1

Please sign in to comment.