From 3539e1126c0bc5a5812b33c333a3dcf78321fffc Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Wed, 3 Oct 2018 21:46:51 +0100 Subject: [PATCH] Refactor top-level routing --- app/src/frontend/app.js | 67 ++++++++++++++++++++--------------------- app/src/frontend/map.js | 17 ++++------- 2 files changed, 38 insertions(+), 46 deletions(-) diff --git a/app/src/frontend/app.js b/app/src/frontend/app.js index 8e0adadc..751a3d89 100644 --- a/app/src/frontend/app.js +++ b/app/src/frontend/app.js @@ -54,41 +54,38 @@ class App extends React.Component {
+ + + + + + + + ( + + ) } /> + ( + + ) } /> + + + - ( - - - - - - - - - - - - - - - - - - - + ( + ) } /> @@ -110,7 +107,7 @@ class App extends React.Component { const NotFound = () => (
-

Page not found

+

Page not found

We can't find that one anywhere. diff --git a/app/src/frontend/map.js b/app/src/frontend/map.js index 8e3b6f7e..e00f7fbe 100644 --- a/app/src/frontend/map.js +++ b/app/src/frontend/map.js @@ -63,17 +63,12 @@ class ColouringMap extends Component { const attribution = 'Building attribute data is © Colouring London contributors. Maps contain OS data © Crown copyright: OS Maps baselayers and building outlines.' // colour-data tiles - var data_tileset, is_building; - if (this.props.match && this.props.match.params && this.props.match.params[1]) { - data_tileset = this.props.match.params[1].replace("/", "") - is_building = this.props.match.params[0] === 'building' - } else { - is_building = false; - data_tileset = 'date_year'; - } - const dataLayer = !is_building ? ( - - ) : null; + const is_building = /building/.test(this.props.match.url) + const themer = /theme=([^&]*)/ + const data_tileset = themer.test(this.props.match.url)? themer.exec(this.props.match.url)[1] : 'date_year'; + console.log(is_building, data_tileset) + + const dataLayer = ; // highlight const geometry_id = (this.props.building) ? this.props.building.geometry_id : undefined;