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

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedre committed May 27, 2017
2 parents 908bbc1 + b3378ee commit c632b81
Show file tree
Hide file tree
Showing 57 changed files with 3,206 additions and 1,150 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Read the [contributing] section before creating an issue.
- Ensure you have [nodejs] installed
- Get the source by running `git clone https://github.com/quran/quran.com-frontend/` or creating a [fork]
- Run `npm install` to do first time installation of all dependencies
- Run `npm run dev` to start the dev server
- Run `npm run dev` to start the dev server. Make sure you have pm2 installed globally! `npm install -g pm2`
- Open `http://localhost:8000` in your browser to see the app.

## Staging
Expand Down
27 changes: 16 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test:dev:lint": "./node_modules/eslint/bin/eslint.js ./src",
"test:stylelint": "stylelint './src/**/*.scss' --config ./webpack/.stylelintrc",
"dev-old": "env NODE_PATH='./src' PORT=8000 UV_THREADPOOL_SIZE=100 node ./webpack/webpack-dev-server.js & env NODE_PATH='./src' PORT=8000 node ./bin/server.js",
"dev": "env NODE_PATH='./src' PORT=8000 UV_THREADPOOL_SIZE=100 node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --config ./webpack/dev.config.js & env NODE_PATH='./src' PORT=8000 node ./bin/server.js",
"dev": "env NODE_PATH='./src' PORT=8000 UV_THREADPOOL_SIZE=100 node --expose-gc ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --config ./webpack/dev.config.js --progress & env NODE_PATH='./src' PORT=8000 node --expose-gc ./bin/server.js",
"start": "NODE_PATH='src' node ./start",
"build": "npm run build:client & npm run build:server",
"build:server": "babel ./src -d ./dist -D",
Expand Down Expand Up @@ -44,7 +44,7 @@
"autoprefixer-loader": "3.2.0",
"babel-cli": "6.11.4",
"babel-core": "^6.24.0",
"babel-loader": "^6.4.1",
"babel-loader": "^7.0.0",
"babel-plugin-add-module-exports": "0.1.4",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-system-import-transformer": "^3.1.0",
Expand All @@ -58,12 +58,14 @@
"babel-polyfill": "6.13.0",
"babel-preset-es2015": "^6.24.0",
"babel-preset-react": "6.11.1",
"babel-preset-react-optimize": "^1.0.1",
"babel-preset-stage-0": "6.5.0",
"babel-preset-stage-2": "6.13.0",
"babel-register": "6.11.6",
"babel-runtime": "6.11.6",
"babili-webpack-plugin": "^0.0.11",
"body-parser": "1.15.2",
"bootstrap-loader": "2.0.0-beta.19",
"bootstrap-loader": "^2.1.0",
"bootstrap-sass": "3.3.7",
"bundle-loader": "0.5.4",
"cache-manager": "1.5.0",
Expand All @@ -82,10 +84,11 @@
"express": "4.14.0",
"express-state": "1.4.0",
"express-useragent": "1.0.4",
"extract-text-webpack-plugin": "2.0.0-beta.5",
"extract-text-webpack-plugin": "^2.1.0",
"file-loader": "0.8.5",
"fontfaceobserver": "1.7.3",
"history": "^3.0.0",
"html-pdf": "^2.1.0",
"html-webpack-plugin": "1.7.0",
"http-proxy": "1.14.0",
"humps": "2.0.0",
Expand All @@ -101,7 +104,7 @@
"promise": "7.1.1",
"proxy-middleware": "0.14.0",
"qs": "6.2.1",
"quran-components": "^0.0.66",
"quran-components": "^0.0.73",
"raven": "1.1.1",
"raw-loader": "0.5.1",
"react": "15.4.1",
Expand All @@ -111,10 +114,10 @@
"react-cookie": "1.0.4",
"react-dom": "15.4.1",
"react-helmet": "3.1.0",
"react-hot-loader": "3.0.0-beta.6",
"react-hot-loader": "next",
"react-inlinesvg": "0.5.4",
"react-intl": "2.1.5",
"react-loadable": "^3.0.1",
"react-loadable": "^3.3.1",
"react-metrics": "1.2.1",
"react-paginate": "4.1.0",
"react-redux": "5.0.1",
Expand All @@ -130,7 +133,7 @@
"reselect": "2.5.3",
"resolve-url": "0.2.1",
"resolve-url-loader": "1.6.1",
"sass-loader": "4.1.1",
"sass-loader": "^6.0.5",
"serialize-javascript": "1.3.0",
"serve-favicon": "2.3.0",
"sitemap": "1.8.1",
Expand All @@ -139,8 +142,9 @@
"superagent": "3.3.1",
"url": "0.11.0",
"url-loader": "0.5.7",
"webpack": "2.2.0",
"webpack-dev-server": "2.1.0-beta.0",
"webpack": "^2.5.1",
"webpack-dev-middleware": "^1.10.2",
"webpack-dev-server": "^2.4.5",
"webpack-isomorphic-tools": "2.5.7",
"winston": "1.1.2"
},
Expand Down Expand Up @@ -185,14 +189,15 @@
"react-transform-catch-errors": "1.0.0",
"react-transform-hmr": "1.0.1",
"redbox-react": "1.1.1",
"redux-devtools": "3.1.1",
"redux-devtools": "^3.4.0",
"redux-devtools-dock-monitor": "1.1.0",
"redux-devtools-log-monitor": "1.0.5",
"sinon": "1.15.3",
"sinon-chai": "2.8.0",
"stylelint": "7.1.0",
"stylelint-webpack-plugin": "0.2.0",
"webpack-bundle-analyzer": "2.2.1",
"webpack-dashboard": "^0.4.0",
"webpack-dev-server": "2.1.0-beta.0",
"webpack-hot-middleware": "2.12.2"
}
Expand Down
72 changes: 43 additions & 29 deletions src/client.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
/* global document, window, $ */
import 'babel-polyfill';

import React from 'react';
import ReactDOM from 'react-dom';
import reactCookie from 'react-cookie';
import Provider from 'react-redux/lib/components/Provider';
import Router from 'react-router/lib/Router';
import match from 'react-router/lib/match';
import browserHistory from 'react-router/lib/browserHistory';
import applyRouterMiddleware from 'react-router/lib/applyRouterMiddleware';
import useScroll from 'react-router-scroll';
import { ReduxAsyncConnect } from 'redux-connect';
import { syncHistoryWithStore } from 'react-router-redux';
import { IntlProvider } from 'react-intl';
import { AppContainer } from 'react-hot-loader';

import debug from 'debug';

import config from './config';
import ApiClient from './helpers/ApiClient';
import createStore from './redux/create';
import routes from './routes';
import getLocalMessages from './helpers/setLocal';
import Root from './containers/Root';

const client = new ApiClient();
const store = createStore(browserHistory, client, window.reduxData);
Expand All @@ -34,6 +31,7 @@ try {

window.quranDebug = debug;
window.ReactDOM = ReactDOM; // For chrome dev tool support
window.store = store;

window.clearCookies = () => {
reactCookie.remove('quran');
Expand All @@ -45,31 +43,47 @@ window.clearCookies = () => {
reactCookie.remove('smartbanner-installed');
};

match({ history, routes: routes(store) }, (error, redirectLocation, renderProps) => {
const component = (
<Router
{...renderProps}
render={props => (
<ReduxAsyncConnect
{...props}
helpers={{ client }}
render={applyRouterMiddleware(useScroll())}
/>
)}
/>
);
match(
{ history, routes: routes(store) },
(error, redirectLocation, renderProps) => {
const component = (
<Router
{...renderProps}
render={props => (
<ReduxAsyncConnect
{...props}
helpers={{ client }}
render={applyRouterMiddleware(useScroll())}
/>
)}
/>
);

const mountNode = document.getElementById('app');

debug('client', 'React Rendering');

const mountNode = document.getElementById('app');
ReactDOM.render(
<AppContainer>
<Root component={component} store={store} />
</AppContainer>,
mountNode,
() => {
debug('client', 'React Rendered');
}
);

debug('client', 'React Rendering');
if (module.hot) {
module.hot.accept('./containers/Root', () => {
const NextRoot = require('./containers/Root'); // eslint-disable-line global-require

ReactDOM.render(
<IntlProvider locale="en" messages={getLocalMessages()}>
<Provider store={store} key="provider">
{component}
</Provider>
</IntlProvider>, mountNode, () => {
debug('client', 'React Rendered');
ReactDOM.render(
<AppContainer>
<NextRoot store={store} component={component} />
</AppContainer>,
document.getElementById('root')
);
});
}
);
});
}
);
83 changes: 48 additions & 35 deletions src/components/Audioplayer/RepeatDropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import LocaleFormattedMessage from 'components/LocaleFormattedMessage';
const style = require('../style.scss');

class RepeatButton extends Component {

handleToggle = () => {
const { repeat, setRepeat, current } = this.props;

Expand Down Expand Up @@ -41,7 +40,7 @@ class RepeatButton extends Component {
from: current,
to: current + 3
});
}
};

renderRangeAyahs() {
const { chapter, repeat, setRepeat } = this.props;
Expand All @@ -54,7 +53,9 @@ class RepeatButton extends Component {
<LocaleFormattedMessage
id="player.repeat.rangeStart"
defaultMessage="From"
/>{' '}:
/>
{' '}
:
<br />
<FormControl
componentClass="select"
Expand Down Expand Up @@ -89,12 +90,15 @@ class RepeatButton extends Component {
<LocaleFormattedMessage
id="player.repeat.rangeEnd"
defaultMessage="To"
/>{' '}:
/>
{' '}
:
<br />
<FormControl
componentClass="select"
value={repeat.to}
onChange={event => setRepeat({ ...repeat, to: parseInt(event.target.value, 10) })}
onChange={event =>
setRepeat({ ...repeat, to: parseInt(event.target.value, 10) })}
>
{
array.reduce((options, ayah, index) => {
Expand Down Expand Up @@ -124,23 +128,26 @@ class RepeatButton extends Component {
<LocaleFormattedMessage
id="player.currentVerse"
defaultMessage="Ayah"
/>{' '}: <br />
/>
{' '}
:
{' '}
<br />
<FormControl
componentClass="select"
value={repeat.from}
onChange={event => setRepeat({
...repeat,
from: parseInt(event.target.value, 10),
to: parseInt(event.target.value, 10)
})}
onChange={event =>
setRepeat({
...repeat,
from: parseInt(event.target.value, 10),
to: parseInt(event.target.value, 10)
})}
>
{
array.map((ayah, index) => (
<option key={index} value={index + 1}>
{index + 1}
</option>
))
}
{array.map((ayah, index) => (
<option key={index} value={index + 1}>
{index + 1}
</option>
))}
</FormControl>
</div>
);
Expand Down Expand Up @@ -180,7 +187,9 @@ class RepeatButton extends Component {

return (
<div className={`${!repeat.from && style.disabled} row`}>
{repeat.from === repeat.to ? this.renderSingleAyah() : this.renderRangeAyahs()}
{repeat.from === repeat.to
? this.renderSingleAyah()
: this.renderRangeAyahs()}
</div>
);
}
Expand All @@ -195,27 +204,30 @@ class RepeatButton extends Component {
<LocaleFormattedMessage
id="player.repeat.title"
defaultMessage="Repeat"
/>: <br />
/>
:
{' '}
<br />
<FormControl
componentClass="select"
value={repeat.times}
onChange={event => setRepeat({
...repeat,
times: parseInt(event.target.value, 10)
})}
onChange={event =>
setRepeat({
...repeat,
times: parseInt(event.target.value, 10)
})}
>
<option value={'Infinity'}>
{
intl.formatMessage({ id: 'player.repeat.loop', defaultMessage: 'Loop' })
}
{intl.formatMessage({
id: 'player.repeat.loop',
defaultMessage: 'Loop'
})}
</option>
{
times.map((ayah, index) => (
<option key={index} value={index + 1}>
{index + 1}
</option>
))
}
{times.map((ayah, index) => (
<option key={index} value={index + 1}>
{index + 1}
</option>
))}
</FormControl>
</div>
</div>
Expand All @@ -235,7 +247,8 @@ class RepeatButton extends Component {
<LocaleFormattedMessage
id="player.repeat.title"
defaultMessage="TOGGLE REPEAT"
/>{' '}
/>
{' '}
<SwitchToggle
checked={!!repeat.from}
onToggle={this.handleToggle}
Expand Down
Loading

0 comments on commit c632b81

Please sign in to comment.