diff --git a/app/src/frontend/building-edit.js b/app/src/frontend/building-edit.js
index 8e1fd3b4..e1af808d 100644
--- a/app/src/frontend/building-edit.js
+++ b/app/src/frontend/building-edit.js
@@ -1,38 +1,44 @@
import React, { Component, Fragment } from 'react';
import { Link, NavLink, Redirect } from 'react-router-dom';
+import queryString from 'query-string';
import ErrorBox from './error-box';
import InfoBox from './info-box';
import Sidebar from './sidebar';
+import { HelpIcon, CloseIcon, SaveIcon } from './icons';
import CONFIG from './fields-config.json';
-class BuildingEdit extends Component {
- render() {
- if (!this.props.user){
- return
- }
- if (!this.props.building_id){
- return (
-
-
-
- Back to maps
-
-
- );
- }
+const BuildingEdit = (props) => {
+ if (!props.user){
+ return
+ }
+ if (!props.building_id){
return (
-
- {
- CONFIG.map((conf_props) => {
- return
- })
- }
+
+
+
+ Back to maps
+
);
}
+
+ const search = (props.location && props.location.search)?
+ queryString.parse(props.location.search):
+ {};
+ return (
+
+ {
+ CONFIG.map((conf_props) => {
+ return
+ })
+ }
+
+ );
}
class EditForm extends Component {
@@ -89,50 +95,80 @@ class EditForm extends Component {
}
render() {
- const match = true;
+ const match = this.props.search.cat === this.props.slug;
return (
- match}>
- {this.props.title}
-
-
+
+ match}>
+ {this.props.title}
+
+ {
+ this.props.help?
+
+
+
+ : null
+ }
+ {
+ match?
+
+
+
+
+
+
+
+
+ : null
+ }
+
+ { (match && this.props.intro)? { this.props.intro }
: null }
+ {
+ match?
+
+ : null
+ }
)
}
diff --git a/app/src/frontend/building-view.js b/app/src/frontend/building-view.js
index 74fe98b4..2bf40951 100644
--- a/app/src/frontend/building-view.js
+++ b/app/src/frontend/building-view.js
@@ -1,5 +1,6 @@
import React, { Fragment } from 'react';
import { Link, NavLink } from 'react-router-dom';
+import queryString from 'query-string';
import Sidebar from './sidebar';
import Tooltip from './tooltip';
@@ -20,19 +21,19 @@ const BuildingView = (props) => {
);
}
- const hash = (props.location && props.location.hash)? props.location.hash.replace('#', ''): undefined;
+ const search = (props.location && props.location.search)? queryString.parse(props.location.search): {};
return (
{
CONFIG.map(section_props => (
+ {...section_props}>
{
section_props.fields.map(field_props => (
@@ -47,23 +48,26 @@ const BuildingView = (props) => {
const DataSection = (props) => {
- const match = props.hash && props.slug.match(props.hash);
+ const match = props.search.cat === props.slug;
return (
-
- match}>
+
+ match}>
{props.title}
{
- props.helpLink?
-
+ props.help?
+
: null
}
{
!props.inactive?
-
+
: null
diff --git a/app/src/frontend/legend.js b/app/src/frontend/legend.js
index 6473d5c5..c48dba5a 100644
--- a/app/src/frontend/legend.js
+++ b/app/src/frontend/legend.js
@@ -1,73 +1,129 @@
-import React, { Component, Fragment } from 'react';
-import { Link, NavLink } from 'react-router-dom';
+import React, { Fragment } from 'react';
+import { NavLink } from 'react-router-dom';
import Sidebar from './sidebar';
+import { HelpIcon } from './icons';
import './legend.css';
-const data_map = [
- {
- slug: 'date_year',
- label: 'Age',
- elements: [
- {
- slug: 'date_year',
- label: 'Year Built',
- elements: [
- { color: '#f0eaba', text: '≥2000' },
- { color: '#fae269', text: '1980–2000' },
- { color: '#fbaf27', text: '1960–1980' },
- { color: '#e6711d', text: '1940–1960' },
- { color: '#d73d3a', text: '1920–1940' },
- { color: '#ba221c', text: '1900–1920' },
- { color: '#bb859b', text: '1880–1900' },
- { color: '#8b3654', text: '1860–1880' },
- { color: '#8f5385', text: '1840–1860' },
- { color: '#56619b', text: '1820–1840' },
- { color: '#6793b2', text: '1800–1820' },
- { color: '#83c3b3', text: '1780–1800' },
- { color: '#adc88f', text: '1760–1780' },
- { color: '#83a663', text: '1740–1760' },
- { color: '#77852d', text: '1720–1740' },
- { color: '#69814e', text: '1700–1720' },
- { color: '#d0c291', text: '1680–1700' },
- { color: '#918158', text: '1660–1680' },
- { color: '#7a5732', text: '<1660' },
- ]
- }
- ]
- },
- {
- slug: 'size_storeys',
- label: 'Size',
- elements: [
- {
- slug: 'size_storeys',
- label: 'Number of storeys',
- elements: [
- { color: '#ffc584', text: '≥20' },
- { color: '#f46259', text: '10–20' },
- { color: '#da456a', text: '5–10' },
- { color: '#a8327d', text: '4' },
- { color: '#7c2383', text: '3' },
- { color: '#5b167f', text: '2' },
- { color: '#360f69', text: '1' },
- ]
- }
- ]
- }
-];
+import CONFIG from './fields-config.json';
-const LegendItem = (props) => (
-
- -
- { props.text }
-
-);
+
+const LEGEND_CONFIG = {
+ age: [
+ {
+ title: 'Year Built',
+ slug: 'date_year',
+ elements: [
+ { color: '#f0eaba', text: '≥2000' },
+ { color: '#fae269', text: '1980–2000' },
+ { color: '#fbaf27', text: '1960–1980' },
+ { color: '#e6711d', text: '1940–1960' },
+ { color: '#d73d3a', text: '1920–1940' },
+ { color: '#ba221c', text: '1900–1920' },
+ { color: '#bb859b', text: '1880–1900' },
+ { color: '#8b3654', text: '1860–1880' },
+ { color: '#8f5385', text: '1840–1860' },
+ { color: '#56619b', text: '1820–1840' },
+ { color: '#6793b2', text: '1800–1820' },
+ { color: '#83c3b3', text: '1780–1800' },
+ { color: '#adc88f', text: '1760–1780' },
+ { color: '#83a663', text: '1740–1760' },
+ { color: '#77852d', text: '1720–1740' },
+ { color: '#69814e', text: '1700–1720' },
+ { color: '#d0c291', text: '1680–1700' },
+ { color: '#918158', text: '1660–1680' },
+ { color: '#7a5732', text: '<1660' },
+ ]
+ }
+ ],
+ size: [
+ {
+ title: 'Number of storeys',
+ slug: 'size_storeys',
+ elements: [
+ { color: '#ffc584', text: '≥20' },
+ { color: '#f46259', text: '10–20' },
+ { color: '#da456a', text: '5–10' },
+ { color: '#a8327d', text: '4' },
+ { color: '#7c2383', text: '3' },
+ { color: '#5b167f', text: '2' },
+ { color: '#360f69', text: '1' },
+ ]
+ }
+ ],
+ like: [
+ {
+ title: 'Like Me!',
+ slug: 'like',
+ elements: [
+ { color: '#f65400', text: 'Liked' },
+ ]
+ }
+ ]
+};
+
+
+const Legend = (props) => {
+ var data_layer = undefined;
+ if (props.match && props.match.params && props.match.params.map) {
+ data_layer = props.match.params.map;
+ }
+
+ return (
+
+ {
+ CONFIG.map((data_group) => (
+
+ ))
+ }
+
+ );
+}
+
+const LegendGroup = (props) => {
+ const match = props.data_layer === props.slug;
+ const inactive = props.inactive || !props.maps;
+ return (
+
+
+ match}>
+ {props.title}
+
+ {
+ props.help?
+
+
+
+ : null
+ }
+
+ { (match && props.intro)? { props.intro }
: null }
+
+ {
+ (match && props.maps)?
+ props.maps.map((data_section) => (
+
+ {
+ data_section.elements.map((data_item) => (
+
+ ))
+ }
+
+ ))
+ : null
+ }
+
+
+ )
+};
const LegendSection = (props) => (
- { props.label }
+ { props.title }
@@ -77,50 +133,11 @@ const LegendSection = (props) => (
);
-const LegendGroup = (props) => (
-
-
- { props.label }
-
-
- { props.children }
-
-
+const LegendItem = (props) => (
+
+ -
+ { props.text }
+
);
-class Legend extends Component {
- render() {
- var data_layer = undefined;
- if (this.props.match && this.props.match.params && this.props.match.params.map) {
- data_layer = this.props.match.params.map;
- }
-
- return (
-
- {
- data_map.map((data_group) => (
-
- {
- ( data_layer.match(data_group.slug) )
- ? data_group.elements.map((data_section) => (
-
- {
- ( data_layer.match(data_section.slug) )
- ? data_section.elements.map((data_item) => (
-
- ))
- : null
- }
-
- ))
- : null
- }
-
- ))
- }
-
- );
- }
-}
-
export default Legend;
diff --git a/app/src/frontend/main.css b/app/src/frontend/main.css
index be978231..8cbc3d02 100755
--- a/app/src/frontend/main.css
+++ b/app/src/frontend/main.css
@@ -15,7 +15,7 @@
display: block;
position: relative;
padding: 0.6rem 0.5rem 0.5rem 2.25rem;
- cursor: pointer;
+ /* cursor: pointer; */
text-decoration: none;
color: #222;
transition: background-color 0.2s;
@@ -23,6 +23,9 @@
.bullet-prefix h3 {
display: inline-block;
}
+.bullet-prefix a:first-child {
+ color: #222;
+}
.bullet-prefix.active,
.bullet-prefix:hover {
color: #222;
@@ -30,7 +33,7 @@
background-color: #eeeeee;
}
.bullet-prefix::before {
- display: inline-block;
+ display: block;
position: absolute;
left: 0.55rem;
top: 0.3rem;
@@ -51,7 +54,7 @@
content: '\25BC';
}
.bullet-prefix.active:hover::before {
- content: '\25A0';
+ content: '\25B2';
}
.icon-button {
@@ -84,13 +87,22 @@
background-color: #fff;
}
.icon-button.edit:hover svg {
- color: rgb(11, 247, 255);
+ color: rgb(11, 225, 225);
}
.icon-button.help:hover svg {
- color: rgb(255, 11, 222);
+ color: rgb(0, 81, 255)
}
.icon-button.tooltip-hint:hover svg {
- color: rgb(11, 255, 72);
+ color: rgb(255, 11, 245);
+}
+.icon-button.close svg {
+ margin-top: -1px;
+}
+.icon-button.close:hover svg {
+ color: rgb(255, 72, 11)
+}
+.icon-button.save:hover svg {
+ color: rgb(11, 225, 72);
}
.section-header .icon-button {
float: right;