Lint single quotes
This commit is contained in:
parent
e540003e2f
commit
907afa29f0
@ -20,7 +20,8 @@
|
|||||||
"rules": {
|
"rules": {
|
||||||
"no-console": "off",
|
"no-console": "off",
|
||||||
"strict": ["error", "global"],
|
"strict": ["error", "global"],
|
||||||
"curly": "warn"
|
"curly": "warn",
|
||||||
|
"quotes": ["warn", "single"]
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"react"
|
"react"
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
"start": "razzle start",
|
"start": "razzle start",
|
||||||
"build": "razzle build",
|
"build": "razzle build",
|
||||||
"test": "razzle test --env=jsdom",
|
"test": "razzle test --env=jsdom",
|
||||||
|
"lint": "eslint .",
|
||||||
"start:prod": "NODE_ENV=production node build/server.js"
|
"start:prod": "NODE_ENV=production node build/server.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -77,7 +77,7 @@ function queryBuildingsByReference(key, id) {
|
|||||||
|
|
||||||
function getBuildingById(id) {
|
function getBuildingById(id) {
|
||||||
return db.one(
|
return db.one(
|
||||||
"SELECT * FROM buildings WHERE building_id = $1",
|
'SELECT * FROM buildings WHERE building_id = $1',
|
||||||
[id]
|
[id]
|
||||||
).catch(function (error) {
|
).catch(function (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -87,7 +87,7 @@ function getBuildingById(id) {
|
|||||||
|
|
||||||
function getBuildingLikeById(building_id, user_id) {
|
function getBuildingLikeById(building_id, user_id) {
|
||||||
return db.oneOrNone(
|
return db.oneOrNone(
|
||||||
"SELECT true as like FROM building_user_likes WHERE building_id = $1 and user_id = $2 LIMIT 1",
|
'SELECT true as like FROM building_user_likes WHERE building_id = $1 and user_id = $2 LIMIT 1',
|
||||||
[building_id, user_id]
|
[building_id, user_id]
|
||||||
).then(res => {
|
).then(res => {
|
||||||
return res && res.like
|
return res && res.like
|
||||||
@ -99,7 +99,7 @@ function getBuildingLikeById(building_id, user_id) {
|
|||||||
|
|
||||||
function getBuildingUPRNsById(id) {
|
function getBuildingUPRNsById(id) {
|
||||||
return db.any(
|
return db.any(
|
||||||
"SELECT uprn, parent_uprn FROM building_properties WHERE building_id = $1",
|
'SELECT uprn, parent_uprn FROM building_properties WHERE building_id = $1',
|
||||||
[id]
|
[id]
|
||||||
).catch(function (error) {
|
).catch(function (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -126,15 +126,15 @@ function saveBuilding(building_id, building, user_id) {
|
|||||||
// commit or rollback (repeated-read sufficient? or serializable?)
|
// commit or rollback (repeated-read sufficient? or serializable?)
|
||||||
return db.tx(t => {
|
return db.tx(t => {
|
||||||
return t.one(
|
return t.one(
|
||||||
`SELECT * FROM buildings WHERE building_id = $1 FOR UPDATE;`,
|
'SELECT * FROM buildings WHERE building_id = $1 FOR UPDATE;',
|
||||||
[building_id]
|
[building_id]
|
||||||
).then(old_building => {
|
).then(old_building => {
|
||||||
const patches = compare(old_building, building, BUILDING_FIELD_WHITELIST);
|
const patches = compare(old_building, building, BUILDING_FIELD_WHITELIST);
|
||||||
console.log("Patching", building_id, patches)
|
console.log('Patching', building_id, patches)
|
||||||
const forward = patches[0];
|
const forward = patches[0];
|
||||||
const reverse = patches[1];
|
const reverse = patches[1];
|
||||||
if (Object.keys(forward).length === 0) {
|
if (Object.keys(forward).length === 0) {
|
||||||
return Promise.reject("No change provided")
|
return Promise.reject('No change provided')
|
||||||
}
|
}
|
||||||
return t.one(
|
return t.one(
|
||||||
`INSERT INTO logs (
|
`INSERT INTO logs (
|
||||||
@ -146,7 +146,7 @@ function saveBuilding(building_id, building, user_id) {
|
|||||||
[forward, reverse, building_id, user_id]
|
[forward, reverse, building_id, user_id]
|
||||||
).then(revision => {
|
).then(revision => {
|
||||||
const sets = db.$config.pgp.helpers.sets(forward);
|
const sets = db.$config.pgp.helpers.sets(forward);
|
||||||
console.log("Setting", building_id, sets)
|
console.log('Setting', building_id, sets)
|
||||||
return t.one(
|
return t.one(
|
||||||
`UPDATE
|
`UPDATE
|
||||||
buildings
|
buildings
|
||||||
@ -181,11 +181,11 @@ function likeBuilding(building_id, user_id) {
|
|||||||
// commit or rollback (serializable - could be more compact?)
|
// commit or rollback (serializable - could be more compact?)
|
||||||
return db.tx({ serializable }, t => {
|
return db.tx({ serializable }, t => {
|
||||||
return t.none(
|
return t.none(
|
||||||
"INSERT INTO building_user_likes ( building_id, user_id ) VALUES ($1, $2);",
|
'INSERT INTO building_user_likes ( building_id, user_id ) VALUES ($1, $2);',
|
||||||
[building_id, user_id]
|
[building_id, user_id]
|
||||||
).then(() => {
|
).then(() => {
|
||||||
return t.one(
|
return t.one(
|
||||||
"SELECT count(*) as likes FROM building_user_likes WHERE building_id = $1;",
|
'SELECT count(*) as likes FROM building_user_likes WHERE building_id = $1;',
|
||||||
[building_id]
|
[building_id]
|
||||||
).then(building => {
|
).then(building => {
|
||||||
return t.one(
|
return t.one(
|
||||||
@ -217,7 +217,7 @@ function likeBuilding(building_id, user_id) {
|
|||||||
});
|
});
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
if (error.detail && error.detail.includes("already exists")) {
|
if (error.detail && error.detail.includes('already exists')) {
|
||||||
// 'already exists' is thrown if user already liked it
|
// 'already exists' is thrown if user already liked it
|
||||||
return { error: 'It looks like you already like that building!' };
|
return { error: 'It looks like you already like that building!' };
|
||||||
} else {
|
} else {
|
||||||
@ -236,11 +236,11 @@ function unlikeBuilding(building_id, user_id) {
|
|||||||
// commit or rollback (serializable - could be more compact?)
|
// commit or rollback (serializable - could be more compact?)
|
||||||
return db.tx({ serializable }, t => {
|
return db.tx({ serializable }, t => {
|
||||||
return t.none(
|
return t.none(
|
||||||
"DELETE FROM building_user_likes WHERE building_id = $1 AND user_id = $2;",
|
'DELETE FROM building_user_likes WHERE building_id = $1 AND user_id = $2;',
|
||||||
[building_id, user_id]
|
[building_id, user_id]
|
||||||
).then(() => {
|
).then(() => {
|
||||||
return t.one(
|
return t.one(
|
||||||
"SELECT count(*) as likes FROM building_user_likes WHERE building_id = $1;",
|
'SELECT count(*) as likes FROM building_user_likes WHERE building_id = $1;',
|
||||||
[building_id]
|
[building_id]
|
||||||
).then(building => {
|
).then(building => {
|
||||||
return t.one(
|
return t.one(
|
||||||
@ -272,7 +272,7 @@ function unlikeBuilding(building_id, user_id) {
|
|||||||
});
|
});
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
if (error.detail && error.detail.includes("already exists")) {
|
if (error.detail && error.detail.includes('already exists')) {
|
||||||
// 'already exists' is thrown if user already liked it
|
// 'already exists' is thrown if user already liked it
|
||||||
return { error: 'It looks like you already like that building!' };
|
return { error: 'It looks like you already like that building!' };
|
||||||
} else {
|
} else {
|
||||||
|
@ -29,7 +29,7 @@ const BuildingEdit = (props) => {
|
|||||||
return (
|
return (
|
||||||
<Sidebar
|
<Sidebar
|
||||||
key={props.building_id}
|
key={props.building_id}
|
||||||
title={`You are editing`}
|
title={'You are editing'}
|
||||||
back={`/edit/${cat}.html`}>
|
back={`/edit/${cat}.html`}>
|
||||||
{
|
{
|
||||||
CONFIG.map((conf_props) => {
|
CONFIG.map((conf_props) => {
|
||||||
@ -169,8 +169,8 @@ class EditForm extends Component {
|
|||||||
const match = this.props.cat === this.props.slug;
|
const match = this.props.cat === this.props.slug;
|
||||||
const building_like = this.props.building_like;
|
const building_like = this.props.building_like;
|
||||||
return (
|
return (
|
||||||
<section className={(this.props.inactive)? "data-section inactive": "data-section"}>
|
<section className={(this.props.inactive)? 'data-section inactive': 'data-section'}>
|
||||||
<header className={`section-header edit ${this.props.slug} ${(match? "active" : "")}`}>
|
<header className={`section-header edit ${this.props.slug} ${(match? 'active' : '')}`}>
|
||||||
<NavLink
|
<NavLink
|
||||||
to={`/edit/${this.props.slug}/building/${this.props.building_id}.html`}
|
to={`/edit/${this.props.slug}/building/${this.props.building_id}.html`}
|
||||||
title={(this.props.inactive)? 'Coming soon… Click the ? for more info.' :
|
title={(this.props.inactive)? 'Coming soon… Click the ? for more info.' :
|
||||||
@ -212,28 +212,28 @@ class EditForm extends Component {
|
|||||||
{
|
{
|
||||||
this.props.fields.map((props) => {
|
this.props.fields.map((props) => {
|
||||||
switch (props.type) {
|
switch (props.type) {
|
||||||
case "text":
|
case 'text':
|
||||||
return <TextInput {...props} handleChange={this.handleChange}
|
return <TextInput {...props} handleChange={this.handleChange}
|
||||||
value={this.state[props.slug]} key={props.slug} />
|
value={this.state[props.slug]} key={props.slug} />
|
||||||
case "text_list":
|
case 'text_list':
|
||||||
return <TextListInput {...props} handleChange={this.handleChange}
|
return <TextListInput {...props} handleChange={this.handleChange}
|
||||||
value={this.state[props.slug]} key={props.slug} />
|
value={this.state[props.slug]} key={props.slug} />
|
||||||
case "text_long":
|
case 'text_long':
|
||||||
return <LongTextInput {...props} handleChange={this.handleChange}
|
return <LongTextInput {...props} handleChange={this.handleChange}
|
||||||
value={this.state[props.slug]} key={props.slug} />
|
value={this.state[props.slug]} key={props.slug} />
|
||||||
case "number":
|
case 'number':
|
||||||
return <NumberInput {...props} handleChange={this.handleChange}
|
return <NumberInput {...props} handleChange={this.handleChange}
|
||||||
value={this.state[props.slug]} key={props.slug} />
|
value={this.state[props.slug]} key={props.slug} />
|
||||||
case "year_estimator":
|
case 'year_estimator':
|
||||||
return <YearEstimator {...props} handleChange={this.handleChange}
|
return <YearEstimator {...props} handleChange={this.handleChange}
|
||||||
value={this.state[props.slug]} key={props.slug} />
|
value={this.state[props.slug]} key={props.slug} />
|
||||||
case "text_multi":
|
case 'text_multi':
|
||||||
return <MultiTextInput {...props} handleChange={this.handleUpdate}
|
return <MultiTextInput {...props} handleChange={this.handleUpdate}
|
||||||
value={this.state[props.slug]} key={props.slug} />
|
value={this.state[props.slug]} key={props.slug} />
|
||||||
case "checkbox":
|
case 'checkbox':
|
||||||
return <CheckboxInput {...props} handleChange={this.handleCheck}
|
return <CheckboxInput {...props} handleChange={this.handleCheck}
|
||||||
value={this.state[props.slug]} key={props.slug} />
|
value={this.state[props.slug]} key={props.slug} />
|
||||||
case "like":
|
case 'like':
|
||||||
return <LikeButton {...props} handleLike={this.handleLike}
|
return <LikeButton {...props} handleLike={this.handleLike}
|
||||||
building_like={building_like}
|
building_like={building_like}
|
||||||
value={this.state[props.slug]} key={props.slug} />
|
value={this.state[props.slug]} key={props.slug} />
|
||||||
@ -265,7 +265,7 @@ const TextInput = (props) => (
|
|||||||
<Label slug={props.slug} title={props.title} tooltip={props.tooltip} />
|
<Label slug={props.slug} title={props.title} tooltip={props.tooltip} />
|
||||||
<input className="form-control" type="text"
|
<input className="form-control" type="text"
|
||||||
id={props.slug} name={props.slug}
|
id={props.slug} name={props.slug}
|
||||||
value={props.value || ""}
|
value={props.value || ''}
|
||||||
maxLength={props.max_length}
|
maxLength={props.max_length}
|
||||||
disabled={props.disabled}
|
disabled={props.disabled}
|
||||||
placeholder={props.placeholder}
|
placeholder={props.placeholder}
|
||||||
@ -282,7 +282,7 @@ const LongTextInput = (props) => (
|
|||||||
disabled={props.disabled}
|
disabled={props.disabled}
|
||||||
placeholder={props.placeholder}
|
placeholder={props.placeholder}
|
||||||
onChange={props.handleChange}
|
onChange={props.handleChange}
|
||||||
value={props.value || ""}></textarea>
|
value={props.value || ''}></textarea>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -312,7 +312,7 @@ class MultiTextInput extends Component {
|
|||||||
|
|
||||||
add(event) {
|
add(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const values = this.getValues().concat("");
|
const values = this.getValues().concat('');
|
||||||
this.props.handleChange(this.props.slug, values);
|
this.props.handleChange(this.props.slug, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +335,7 @@ class MultiTextInput extends Component {
|
|||||||
<input className="form-control" type="text"
|
<input className="form-control" type="text"
|
||||||
key={`${this.props.slug}-${i}`} name={`${this.props.slug}-${i}`}
|
key={`${this.props.slug}-${i}`} name={`${this.props.slug}-${i}`}
|
||||||
data-index={i}
|
data-index={i}
|
||||||
value={item || ""}
|
value={item || ''}
|
||||||
placeholder={this.props.placeholder}
|
placeholder={this.props.placeholder}
|
||||||
disabled={this.props.disabled}
|
disabled={this.props.disabled}
|
||||||
onChange={this.edit}
|
onChange={this.edit}
|
||||||
@ -360,7 +360,7 @@ const TextListInput = (props) => (
|
|||||||
<Label slug={props.slug} title={props.title} tooltip={props.tooltip} />
|
<Label slug={props.slug} title={props.title} tooltip={props.tooltip} />
|
||||||
<select className="form-control"
|
<select className="form-control"
|
||||||
id={props.slug} name={props.slug}
|
id={props.slug} name={props.slug}
|
||||||
value={props.value || ""}
|
value={props.value || ''}
|
||||||
disabled={props.disabled}
|
disabled={props.disabled}
|
||||||
list={`${props.slug}_suggestions`}
|
list={`${props.slug}_suggestions`}
|
||||||
onChange={props.handleChange}>
|
onChange={props.handleChange}>
|
||||||
@ -379,7 +379,7 @@ const NumberInput = (props) => (
|
|||||||
<Label slug={props.slug} title={props.title} tooltip={props.tooltip} />
|
<Label slug={props.slug} title={props.title} tooltip={props.tooltip} />
|
||||||
<input className="form-control" type="number" step={props.step}
|
<input className="form-control" type="number" step={props.step}
|
||||||
id={props.slug} name={props.slug}
|
id={props.slug} name={props.slug}
|
||||||
value={props.value || ""}
|
value={props.value || ''}
|
||||||
disabled={props.disabled}
|
disabled={props.disabled}
|
||||||
onChange={props.handleChange}
|
onChange={props.handleChange}
|
||||||
/>
|
/>
|
||||||
|
@ -24,7 +24,7 @@ const BuildingView = (props) => {
|
|||||||
}
|
}
|
||||||
const cat = parseCategoryURL(props.match.url);
|
const cat = parseCategoryURL(props.match.url);
|
||||||
return (
|
return (
|
||||||
<Sidebar title={`Data available for this building`} back={`/view/${cat}.html`}>
|
<Sidebar title={'Data available for this building'} back={`/view/${cat}.html`}>
|
||||||
{
|
{
|
||||||
CONFIG.map(section_props => (
|
CONFIG.map(section_props => (
|
||||||
<DataSection
|
<DataSection
|
||||||
@ -35,19 +35,19 @@ const BuildingView = (props) => {
|
|||||||
section_props.fields.map(field_props => {
|
section_props.fields.map(field_props => {
|
||||||
|
|
||||||
switch (field_props.type) {
|
switch (field_props.type) {
|
||||||
case "uprn_list":
|
case 'uprn_list':
|
||||||
return <UPRNsDataEntry
|
return <UPRNsDataEntry
|
||||||
key={field_props.slug}
|
key={field_props.slug}
|
||||||
title={field_props.title}
|
title={field_props.title}
|
||||||
value={props.uprns}
|
value={props.uprns}
|
||||||
tooltip={field_props.tooltip} />
|
tooltip={field_props.tooltip} />
|
||||||
case "text_multi":
|
case 'text_multi':
|
||||||
return <MultiDataEntry
|
return <MultiDataEntry
|
||||||
key={field_props.slug}
|
key={field_props.slug}
|
||||||
title={field_props.title}
|
title={field_props.title}
|
||||||
value={props[field_props.slug]}
|
value={props[field_props.slug]}
|
||||||
tooltip={field_props.tooltip} />
|
tooltip={field_props.tooltip} />
|
||||||
case "like":
|
case 'like':
|
||||||
return <LikeDataEntry
|
return <LikeDataEntry
|
||||||
key={field_props.slug}
|
key={field_props.slug}
|
||||||
title={field_props.title}
|
title={field_props.title}
|
||||||
@ -74,8 +74,8 @@ const BuildingView = (props) => {
|
|||||||
const DataSection = (props) => {
|
const DataSection = (props) => {
|
||||||
const match = props.cat === props.slug;
|
const match = props.cat === props.slug;
|
||||||
return (
|
return (
|
||||||
<section id={props.slug} className={(props.inactive)? "data-section inactive": "data-section"}>
|
<section id={props.slug} className={(props.inactive)? 'data-section inactive': 'data-section'}>
|
||||||
<header className={`section-header view ${props.slug} ${(match? "active" : "")}`}>
|
<header className={`section-header view ${props.slug} ${(match? 'active' : '')}`}>
|
||||||
<NavLink
|
<NavLink
|
||||||
to={`/view/${props.slug}/building/${props.building_id}.html`}
|
to={`/view/${props.slug}/building/${props.building_id}.html`}
|
||||||
title={(props.inactive)? 'Coming soon… Click the ? for more info.' :
|
title={(props.inactive)? 'Coming soon… Click the ? for more info.' :
|
||||||
@ -120,8 +120,8 @@ const DataEntry = (props) => (
|
|||||||
{ props.tooltip? <Tooltip text={ props.tooltip } /> : null }
|
{ props.tooltip? <Tooltip text={ props.tooltip } /> : null }
|
||||||
</dt>
|
</dt>
|
||||||
<dd>{
|
<dd>{
|
||||||
(props.value != null && props.value !== "")?
|
(props.value != null && props.value !== '')?
|
||||||
(typeof(props.value) === "boolean")?
|
(typeof(props.value) === 'boolean')?
|
||||||
(props.value)? 'Yes' : 'No'
|
(props.value)? 'Yes' : 'No'
|
||||||
: props.value
|
: props.value
|
||||||
: '\u00A0'}</dd>
|
: '\u00A0'}</dd>
|
||||||
|
@ -5,8 +5,8 @@ import './legend.css';
|
|||||||
|
|
||||||
const LEGEND_CONFIG = {
|
const LEGEND_CONFIG = {
|
||||||
location: {
|
location: {
|
||||||
title: "Location",
|
title: 'Location',
|
||||||
description: "% data collected",
|
description: '% data collected',
|
||||||
elements: [
|
elements: [
|
||||||
{ color: '#084081', text: '≥80%' },
|
{ color: '#084081', text: '≥80%' },
|
||||||
{ color: '#0868ac', text: '60–80%' },
|
{ color: '#0868ac', text: '60–80%' },
|
||||||
@ -16,7 +16,7 @@ const LEGEND_CONFIG = {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
age: {
|
age: {
|
||||||
title: "Age",
|
title: 'Age',
|
||||||
elements: [
|
elements: [
|
||||||
{ color: '#f0eaba', text: '≥2000' },
|
{ color: '#f0eaba', text: '≥2000' },
|
||||||
{ color: '#fae269', text: '1980–2000' },
|
{ color: '#fae269', text: '1980–2000' },
|
||||||
@ -40,7 +40,7 @@ const LEGEND_CONFIG = {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
size: {
|
size: {
|
||||||
title: "Number of storeys",
|
title: 'Number of storeys',
|
||||||
elements: [
|
elements: [
|
||||||
{ color: '#ffffcc', text: '≥40' },
|
{ color: '#ffffcc', text: '≥40' },
|
||||||
{ color: '#fed976', text: '20–39' },
|
{ color: '#fed976', text: '20–39' },
|
||||||
@ -50,48 +50,48 @@ const LEGEND_CONFIG = {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
like: {
|
like: {
|
||||||
title: "Like Me",
|
title: 'Like Me',
|
||||||
elements: [
|
elements: [
|
||||||
{ color: "#bd0026", text: '👍👍👍 ≥10' },
|
{ color: '#bd0026', text: '👍👍👍 ≥10' },
|
||||||
{ color: "#e31a1c", text: '👍👍 5–10' },
|
{ color: '#e31a1c', text: '👍👍 5–10' },
|
||||||
{ color: "#fc4e2a", text: '👍 4' },
|
{ color: '#fc4e2a', text: '👍 4' },
|
||||||
{ color: "#fd8d3c", text: '👍 3' },
|
{ color: '#fd8d3c', text: '👍 3' },
|
||||||
{ color: "#feb24c", text: '👍 2' },
|
{ color: '#feb24c', text: '👍 2' },
|
||||||
{ color: "#fed976", text: '👍 1' },
|
{ color: '#fed976', text: '👍 1' },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
use: {
|
use: {
|
||||||
title: "Use",
|
title: 'Use',
|
||||||
elements: []
|
elements: []
|
||||||
},
|
},
|
||||||
ownership: {
|
ownership: {
|
||||||
title: "Ownership",
|
title: 'Ownership',
|
||||||
elements: []
|
elements: []
|
||||||
},
|
},
|
||||||
construction: {
|
construction: {
|
||||||
title: "Construction",
|
title: 'Construction',
|
||||||
elements: []
|
elements: []
|
||||||
},
|
},
|
||||||
team: {
|
team: {
|
||||||
title: "Team",
|
title: 'Team',
|
||||||
elements: []
|
elements: []
|
||||||
},
|
},
|
||||||
sustainability: {
|
sustainability: {
|
||||||
title: "Sustainability",
|
title: 'Sustainability',
|
||||||
elements: []
|
elements: []
|
||||||
},
|
},
|
||||||
greenery: {
|
greenery: {
|
||||||
title: "Greenery",
|
title: 'Greenery',
|
||||||
elements: []
|
elements: []
|
||||||
},
|
},
|
||||||
planning: {
|
planning: {
|
||||||
title: "Planning",
|
title: 'Planning',
|
||||||
elements: [
|
elements: [
|
||||||
{ color: "#73ebaf", text: 'within conservation area' },
|
{ color: '#73ebaf', text: 'within conservation area' },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
demolition: {
|
demolition: {
|
||||||
title: "Demolition",
|
title: 'Demolition',
|
||||||
elements: []
|
elements: []
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -112,8 +112,8 @@ class ColouringMap extends Component {
|
|||||||
: null;
|
: null;
|
||||||
|
|
||||||
const base_layer_url = (this.state.theme === 'light')?
|
const base_layer_url = (this.state.theme === 'light')?
|
||||||
`/tiles/base_light/{z}/{x}/{y}.png`
|
'/tiles/base_light/{z}/{x}/{y}.png'
|
||||||
: `/tiles/base_night/{z}/{x}/{y}.png`
|
: '/tiles/base_night/{z}/{x}/{y}.png'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
|
@ -35,8 +35,8 @@ const OverviewSection = (props) => {
|
|||||||
const inactive = props.inactive;
|
const inactive = props.inactive;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className={(inactive? "inactive ": "") + "data-section legend"}>
|
<section className={(inactive? 'inactive ': '') + 'data-section legend'}>
|
||||||
<header className={`section-header ${props.mode} ${props.slug} ${(match? "active" : "")}`}>
|
<header className={`section-header ${props.mode} ${props.slug} ${(match? 'active' : '')}`}>
|
||||||
<NavLink
|
<NavLink
|
||||||
to={`/${props.mode}/${props.slug}.html`}
|
to={`/${props.mode}/${props.slug}.html`}
|
||||||
isActive={() => match}
|
isActive={() => match}
|
||||||
|
@ -10,7 +10,7 @@ class SearchBox extends Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
q: "",
|
q: '',
|
||||||
results: [],
|
results: [],
|
||||||
fetching: false
|
fetching: false
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ class SearchBox extends Component {
|
|||||||
q: e.target.value
|
q: e.target.value
|
||||||
});
|
});
|
||||||
// If the ‘clear’ icon has been clicked, clear results list as well
|
// If the ‘clear’ icon has been clicked, clear results list as well
|
||||||
if(e.target.value === "") {
|
if(e.target.value === '') {
|
||||||
this.clearResults();
|
this.clearResults();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ class SearchBox extends Component {
|
|||||||
|
|
||||||
clearQuery(){
|
clearQuery(){
|
||||||
this.setState({
|
this.setState({
|
||||||
q: ""
|
q: ''
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ class SearchBox extends Component {
|
|||||||
</ul>
|
</ul>
|
||||||
: null;
|
: null;
|
||||||
return (
|
return (
|
||||||
<div className={`search-box ${this.props.is_building? "building" : ""}`} onKeyDown={this.handleKeyPress}>
|
<div className={`search-box ${this.props.is_building? 'building' : ''}`} onKeyDown={this.handleKeyPress}>
|
||||||
<form action="/search" method="GET" onSubmit={this.search}
|
<form action="/search" method="GET" onSubmit={this.search}
|
||||||
className="form-inline">
|
className="form-inline">
|
||||||
<input
|
<input
|
||||||
|
@ -22,7 +22,7 @@ class Tooltip extends Component {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className="tooltip-wrap">
|
<div className="tooltip-wrap">
|
||||||
<button className={(this.state.active? "active ": "") + "tooltip-hint icon-button"}
|
<button className={(this.state.active? 'active ': '') + 'tooltip-hint icon-button'}
|
||||||
title={this.props.text}
|
title={this.props.text}
|
||||||
onClick={this.handleClick}>
|
onClick={this.handleClick}>
|
||||||
Hint
|
Hint
|
||||||
|
@ -40,7 +40,7 @@ function parseBuildingURL(url) {
|
|||||||
*/
|
*/
|
||||||
function parseCategoryURL(url) {
|
function parseCategoryURL(url) {
|
||||||
const default_cat = 'age';
|
const default_cat = 'age';
|
||||||
if (url === "/") {
|
if (url === '/') {
|
||||||
return default_cat
|
return default_cat
|
||||||
}
|
}
|
||||||
const matches = /^\/(view|edit)\/([^/.]+)/.exec(url);
|
const matches = /^\/(view|edit)\/([^/.]+)/.exec(url);
|
||||||
|
@ -78,7 +78,7 @@ function frontendRoute(req, res) {
|
|||||||
|
|
||||||
const user_id = req.session.user_id;
|
const user_id = req.session.user_id;
|
||||||
const building_id = parseBuildingURL(req.url);
|
const building_id = parseBuildingURL(req.url);
|
||||||
const is_building = (typeof (building_id) !== "undefined");
|
const is_building = (typeof (building_id) !== 'undefined');
|
||||||
if (is_building && isNaN(building_id)) {
|
if (is_building && isNaN(building_id)) {
|
||||||
context.status = 404;
|
context.status = 404;
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ function frontendRoute(req, res) {
|
|||||||
const building = values[1];
|
const building = values[1];
|
||||||
const uprns = values[2];
|
const uprns = values[2];
|
||||||
const building_like = values[3];
|
const building_like = values[3];
|
||||||
if (is_building && typeof (building) === "undefined") {
|
if (is_building && typeof (building) === 'undefined') {
|
||||||
context.status = 404
|
context.status = 404
|
||||||
}
|
}
|
||||||
data.user = user;
|
data.user = user;
|
||||||
@ -226,7 +226,7 @@ function updateBuilding(req, res, user_id) {
|
|||||||
res.send(building)
|
res.send(building)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (typeof (building) === "undefined") {
|
if (typeof (building) === 'undefined') {
|
||||||
res.send({ error: 'Database error' })
|
res.send({ error: 'Database error' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -240,7 +240,7 @@ function updateBuilding(req, res, user_id) {
|
|||||||
server.get('/building/:building_id/uprns.json', function (req, res) {
|
server.get('/building/:building_id/uprns.json', function (req, res) {
|
||||||
const { building_id } = req.params;
|
const { building_id } = req.params;
|
||||||
getBuildingUPRNsById(building_id).then(function (result) {
|
getBuildingUPRNsById(building_id).then(function (result) {
|
||||||
if (typeof (result) === "undefined") {
|
if (typeof (result) === 'undefined') {
|
||||||
res.send({ error: 'Database error' })
|
res.send({ error: 'Database error' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -281,7 +281,7 @@ server.route('/building/:building_id/like.json')
|
|||||||
res.send(building)
|
res.send(building)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (typeof (building) === "undefined") {
|
if (typeof (building) === 'undefined') {
|
||||||
res.send({ error: 'Database error' })
|
res.send({ error: 'Database error' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -295,7 +295,7 @@ server.route('/building/:building_id/like.json')
|
|||||||
res.send(building)
|
res.send(building)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (typeof (building) === "undefined") {
|
if (typeof (building) === 'undefined') {
|
||||||
res.send({ error: 'Database error' })
|
res.send({ error: 'Database error' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -316,7 +316,7 @@ server.post('/users', function (req, res) {
|
|||||||
|
|
||||||
if (user.email) {
|
if (user.email) {
|
||||||
if (user.email != user.confirm_email) {
|
if (user.email != user.confirm_email) {
|
||||||
res.send({ error: "Email did not match confirmation." });
|
res.send({ error: 'Email did not match confirmation.' });
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -401,7 +401,7 @@ server.get('/search', function (req, res) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
queryLocation(search_term).then((results) => {
|
queryLocation(search_term).then((results) => {
|
||||||
if (typeof (results) === "undefined") {
|
if (typeof (results) === 'undefined') {
|
||||||
res.send({
|
res.send({
|
||||||
error: 'Database error'
|
error: 'Database error'
|
||||||
})
|
})
|
||||||
|
@ -97,7 +97,7 @@ function remove(tileset, z, x, y) {
|
|||||||
if(err){
|
if(err){
|
||||||
// pass
|
// pass
|
||||||
} else {
|
} else {
|
||||||
console.log("Expire cache", tileset, z, x, y)
|
console.log('Expire cache', tileset, z, x, y)
|
||||||
}
|
}
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
|
@ -60,7 +60,7 @@ function handle_tile_request(tileset, req, res) {
|
|||||||
const int_y = strictParseInt(y);
|
const int_y = strictParseInt(y);
|
||||||
|
|
||||||
if (isNaN(int_x) || isNaN(int_y) || isNaN(int_z)) {
|
if (isNaN(int_x) || isNaN(int_y) || isNaN(int_z)) {
|
||||||
console.error("Missing x or y or z")
|
console.error('Missing x or y or z')
|
||||||
return { error: 'Bad parameter' }
|
return { error: 'Bad parameter' }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ function handle_highlight_tile_request(req, res) {
|
|||||||
const int_y = strictParseInt(y);
|
const int_y = strictParseInt(y);
|
||||||
|
|
||||||
if (isNaN(int_x) || isNaN(int_y) || isNaN(int_z)) {
|
if (isNaN(int_x) || isNaN(int_y) || isNaN(int_z)) {
|
||||||
console.error("Missing x or y or z")
|
console.error('Missing x or y or z')
|
||||||
return { error: 'Bad parameter' }
|
return { error: 'Bad parameter' }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user