Relabel view/edit pages to 'Building data' and add 'Edit maps' to header

[Closes #88, #93]
This commit is contained in:
Tom Russell 2018-10-25 11:18:42 +01:00
parent 3512ecfaed
commit 665b4f32ff
7 changed files with 23 additions and 5 deletions

View File

@ -16,6 +16,7 @@ import Login from './login';
import MyAccountPage from './my-account'; import MyAccountPage from './my-account';
import SignUp from './signup'; import SignUp from './signup';
import Welcome from './welcome'; import Welcome from './welcome';
import BuildingEditAny from './building-edit-any';
@ -65,6 +66,9 @@ class App extends React.Component {
<Route exact path="/"> <Route exact path="/">
<Welcome /> <Welcome />
</Route> </Route>
<Route exact path="/select.html">
<BuildingEditAny />
</Route>
<Route exact path="/map/:map.html" component={Legend} /> <Route exact path="/map/:map.html" component={Legend} />
<Route exact path="/building/:building.html" render={(props) => ( <Route exact path="/building/:building.html" render={(props) => (
<BuildingView <BuildingView
@ -85,7 +89,7 @@ class App extends React.Component {
</CSSTransition> </CSSTransition>
</TransitionGroup> </TransitionGroup>
<Switch> <Switch>
<Route exact path="/(map.*|building.*)?" render={(props) => ( <Route exact path="/(select.html|map.*|building.*)?" render={(props) => (
<ColouringMap <ColouringMap
{...props} {...props}
building={this.state.building} building={this.state.building}

View File

@ -0,0 +1,11 @@
import React from 'react';
import Sidebar from './sidebar';
const BuildingEditAny = () => (
<Sidebar title="Edit data">
<p className="data-intro">Select a building to edit by clicking on the map&hellip;</p>
</Sidebar>
);
export default BuildingEditAny;

View File

@ -30,7 +30,7 @@ const BuildingEdit = (props) => {
queryString.parse(props.location.search): queryString.parse(props.location.search):
{}; {};
return ( return (
<Sidebar title={`Edit Building`} <Sidebar title={`Building Data`}
back={search.cat? `/building/${props.building_id}.html?cat=${search.cat}`: `/building//${props.building_id}.html`}> back={search.cat? `/building/${props.building_id}.html?cat=${search.cat}`: `/building//${props.building_id}.html`}>
{ {
CONFIG.map((conf_props) => { CONFIG.map((conf_props) => {

View File

@ -23,7 +23,7 @@ const BuildingView = (props) => {
} }
const search = (props.location && props.location.search)? queryString.parse(props.location.search): {}; const search = (props.location && props.location.search)? queryString.parse(props.location.search): {};
return ( return (
<Sidebar title={`View Building`} back={search.cat? `/map/${search.cat}.html` : "/map/age.html"}> <Sidebar title={`Building Data`} back={search.cat? `/map/${search.cat}.html` : "/map/age.html"}>
{ {
CONFIG.map(section_props => ( CONFIG.map(section_props => (
<DataSection <DataSection

View File

@ -21,6 +21,9 @@ const Header = (props) => (
<li className="nav-item"> <li className="nav-item">
<NavLink to="/map/age.html" className="nav-link">View Maps</NavLink> <NavLink to="/map/age.html" className="nav-link">View Maps</NavLink>
</li> </li>
<li className="nav-item">
<NavLink to="/select.html" className="nav-link">Edit Maps</NavLink>
</li>
<li className="nav-item"> <li className="nav-item">
<a className="nav-link" href="https://pages.colouring.london/buildingcategories">Building Categories</a> <a className="nav-link" href="https://pages.colouring.london/buildingcategories">Building Categories</a>
</li> </li>

View File

@ -70,7 +70,7 @@ const Legend = (props) => {
} }
return ( return (
<Sidebar title="Maps"> <Sidebar title="Colouring Maps">
<p className="data-intro">Click on the map to see more information about a building&hellip;</p> <p className="data-intro">Click on the map to see more information about a building&hellip;</p>
{ {
CONFIG.map((data_group) => ( CONFIG.map((data_group) => (

View File

@ -125,7 +125,7 @@ function get_cat(is_building, location, url) {
cat = search.cat; cat = search.cat;
} else { } else {
matches = /\/map\/([^.]+).html/.exec(url); matches = /\/map\/([^.]+).html/.exec(url);
cat = matches && matches[1]; cat = (matches && matches.length < 1)? matches[1] : "";
} }
return cat; return cat;
} }