Skip to content

Commit

Permalink
Merge pull request #44 from WorldBank-Transport/fix/errors
Browse files Browse the repository at this point in the history
Misc bug fixes
  • Loading branch information
olafveerman authored Sep 26, 2018
2 parents 96375fa + f9347c4 commit af81897
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
if [ "${CIRCLE_BRANCH}" == "${PRODUCTION_BRANCH}" ]; then
cp ./dist/index.html ./dist/200.html
echo '*' > ./dist/CORS
./node_modules/surge/lib/cli.js --project ./dist --domain rah.surge.sh
./node_modules/surge/lib/cli.js --project ./dist --domain hub.ruralaccess.info
else
echo "Not the branch you're looking for, skipping deploy"
fi
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
title: QXN Test
country: CN
date: 2018-09-24T00:00:00.000Z
include_results: false
authors:
- QL
topics:
- test for the QXN RAH
contact:
name: QL
email: [email protected]
contact_name: QL
contact_email: [email protected]

---

Expand Down
2 changes: 0 additions & 2 deletions app/assets/scripts/components/results-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { toTimeStr } from '../utils/utils'

import LayerControl from './map-layer-control'

const clone = data => JSON.parse(JSON.stringify(data))

class ResultsMap extends React.Component {
setupMap () {
this.popover = null
Expand Down
2 changes: 1 addition & 1 deletion app/assets/scripts/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (process.env.DS_ENV !== 'staging' && process.env.DS_ENV !== 'production') {
config = defaultsDeep(configurations.local || {}, config)
}

config.default.mbtoken = process.env.MB_TOKEN || config.mbtoken
config.default.mbtoken = process.env.MB_TOKEN || config.default.mbtoken

// The require doesn't play super well with es6 imports. It creates an internal
// 'default' property. Export that.
Expand Down
26 changes: 25 additions & 1 deletion app/assets/scripts/views/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,35 @@ class Home extends React.Component {
}

render () {
const {fetching, fetched, data} = this.props.projects
const {fetching, fetched, data, error} = this.props.projects
const projectsToShow = this.pageSize * this.state.page

if (!fetched || fetching) return null

if (error) {
return (
<App>
<section className='inpage inpage--uhoh'>
<header className='inpage__header'>
<div className='inner'>
<div className='inpage__headline'>
<h1 className='inpage__title'>An error occurred</h1>
</div>
</div>
</header>
<div className='inpage__body'>
<div className='inner'>
<div className='prose'>
<p>An error occurred trying to reach the server. Please try again later.</p>
<p>In the mean time visit the <Link to='/about' title='Visit about page'>about page</Link> for more information or if the error persists <a href='mailto:[email protected]' title='Get in touch'>contact us</a> about the problem.</p>
</div>
</div>
</div>
</section>
</App>
)
}

const { year, country, topic } = this.state.activeFilters
const projectsFiltered = data.index
.filter(proj => {
Expand Down
18 changes: 11 additions & 7 deletions app/assets/scripts/views/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,19 @@ class Project extends React.Component {
super(props)

this.onFilterChange = this.onFilterChange.bind(this)

this.fetchData()
}

componentDidMount () {
// We can't show the loading on the fetchData method, because the
// DOM is not mounted and there is no loading component yet.
// Show it as soon as possible. The fetchData method will then take care of
// hiding it.
showGlobalLoading()
}

async componentWillMount () {
async fetchData () {
const projId = this.props.match.params.id
const {fetchPage, fetchProjectMeta, fetchProjectPoi, fetchProjectResults} = this.props
// Fetch the page data.
Expand All @@ -82,12 +92,6 @@ class Project extends React.Component {
}
}

componentDidMount () {
// We can't show the loading on the componentWillMount method, because the
// DOM is not mounted and there is no loading component yet.
showGlobalLoading()
}

async onFilterChange (field, value, event) {
event.preventDefault()

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rah",
"version": "0.1.0",
"version": "0.3.0",
"description": "Rural Accessibility Hub",
"repository": {
"type": "git",
Expand Down

0 comments on commit af81897

Please sign in to comment.