-
Notifications
You must be signed in to change notification settings - Fork 371
Fixes #248 Out of range bug #336
Changes from 3 commits
5ae212a
37fb458
7e4c334
00d94df
be24d92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| NODE_ENV=development | ||
| PORT=8000 | ||
| API_URL=http://quran.com:3000 | ||
| API_URL=http://api.quran.com:3000 | ||
| SEGMENTS_KEY= | ||
| SENTRY_KEY_CLIENT= | ||
| SENTRY_KEY_SERVER= |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,3 +13,4 @@ tests/functional/output/* | |
| test/functional/screenshots/* | ||
| .ssh | ||
| webpack-stats.debug.json | ||
| .env | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import React, { Component } from 'react'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This component is awesome! What I'd recommend, because I assume we'd want to reuse it for other errors, is having
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is exactly what this component does. Maybe errorTitle isn't exactly the name to use should I use |
||
| import IndexHeader from '../../components/IndexHeader'; | ||
| import Link from 'react-router/lib/Link'; | ||
| import Helmet from 'react-helmet'; | ||
|
|
||
| export default ({params}) => { | ||
| console.log(params, 'params?'); | ||
|
||
| return ( | ||
| <div> | ||
| <Helmet title={`Error ${params.errorTitle}`} /> | ||
| <IndexHeader noSearch={true} /> | ||
| <div className="container-fluid about-text"> | ||
| <div className="row"> | ||
| <div className="col-md-8 col-md-offset-2"> | ||
| <h4 className="source-sans"> | ||
| {params.errorTitle} is an invalid Surah/Ayah. Please go to the <a href="/">home page </a>and select a surah | ||
| </h4> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,6 +141,14 @@ class Home extends React.Component { | |
| Ayat Al-Kursi | ||
| </Link> | ||
| </li> | ||
| <li> | ||
|
||
| <Link | ||
|
||
| to="/884843948389" | ||
| data-metrics-event-name="QuickLinks:Click" | ||
| data-metrics-surah-id="2/255"> | ||
| Ayat Al-Kursi | ||
| </Link> | ||
| </li> | ||
| </ul> | ||
| </span> | ||
| ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| import React from 'react'; | ||
| import IndexRoute from 'react-router/lib/IndexRoute'; | ||
| import Route from 'react-router/lib/Route'; | ||
|
|
||
| import checkValidSurah from './utils/checkValidSurah'; | ||
| import App from './containers/App'; | ||
|
|
||
|
|
||
|
|
||
| export default () => { | ||
| return ( | ||
| <Route path="/" component={App}> | ||
|
|
@@ -16,10 +18,12 @@ export default () => { | |
|
|
||
| <Route path="/contact" getComponent={(nextState, cb) => System.import('./containers/Contact').then(module => cb(null, module))} /> | ||
| <Route path="/contactus" getComponent={(nextState, cb) => System.import('./containers/Contact').then(module => cb(null, module))} /> | ||
| <Route path="/error/:errorTitle" getComponent={(nextState, cb) => System.import('./containers/Error').then(module => cb(null, module))} /> | ||
|
|
||
| <Route path="/search" getComponent={(nextState, cb) => System.import('./containers/Search').then(module => cb(null, module))} /> | ||
|
|
||
| <Route path="/:surahId(/:range)" getComponent={(nextState, cb) => System.import('./containers/Surah').then(module => cb(null, module)).catch(err => console.trace(err))} /> | ||
| <Route path="/:surahId(/:range)" getComponent={(nextState, cb) => System.import('./containers/Surah').then(module => cb(null, module)).catch(err => console.trace(err))} | ||
| onEnter={checkValidSurah} /> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice! |
||
| </Route> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| export default function isValidSurah(nextState, replaceState) { | ||
| let surahId = parseInt(nextState.params.surahId, 10) | ||
| if(isNaN(surahId) || surahId > 114 || surahId < 1){ | ||
|
|
||
| replaceState(`/error/${nextState.params.surahId}`); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, don't need this. We do need
.envto be committed