Lint semicolons
This commit is contained in:
parent
b95185d9dd
commit
739bcad08a
@ -28,7 +28,7 @@ server.post('/login', function (req, res) {
|
||||
res.send(user);
|
||||
}).catch(function (error) {
|
||||
res.send(error);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
// POST user logout
|
||||
@ -45,7 +45,7 @@ server.post('/logout', function (req, res) {
|
||||
server.post('/api/key', function (req, res) {
|
||||
if (!req.session.user_id) {
|
||||
res.send({ error: 'Must be logged in' });
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
getNewUserAPIKey(req.session.user_id).then(function (apiKey) {
|
||||
@ -53,7 +53,7 @@ server.post('/api/key', function (req, res) {
|
||||
}).catch(function (error) {
|
||||
res.send(error);
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
// GET search
|
||||
server.get('/search', function (req, res) {
|
||||
@ -61,20 +61,20 @@ server.get('/search', function (req, res) {
|
||||
if (!searchTerm) {
|
||||
res.send({
|
||||
error: 'Please provide a search term'
|
||||
})
|
||||
return
|
||||
});
|
||||
return;
|
||||
}
|
||||
queryLocation(searchTerm).then((results) => {
|
||||
if (typeof (results) === 'undefined') {
|
||||
res.send({
|
||||
error: 'Database error'
|
||||
})
|
||||
return
|
||||
});
|
||||
return;
|
||||
}
|
||||
res.send({
|
||||
results: results.map(item => {
|
||||
// map from DB results to GeoJSON Feature objects
|
||||
const geom = JSON.parse(item.st_asgeojson)
|
||||
const geom = JSON.parse(item.st_asgeojson);
|
||||
return {
|
||||
type: 'Feature',
|
||||
attributes: {
|
||||
@ -82,13 +82,13 @@ server.get('/search', function (req, res) {
|
||||
zoom: item.zoom || 9
|
||||
},
|
||||
geometry: geom
|
||||
}
|
||||
})
|
||||
};
|
||||
})
|
||||
});
|
||||
}).catch(function (error) {
|
||||
res.send(error);
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
server.use((err, req, res, next) => {
|
||||
if (res.headersSent) {
|
||||
@ -103,7 +103,7 @@ server.use((err, req, res, next) => {
|
||||
|
||||
server.use((req, res) => {
|
||||
res.status(404).json({ error: 'Resource not found'});
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
export default server;
|
||||
|
@ -107,7 +107,7 @@ const getBuildingLikeById = asyncController(async (req: express.Request, res: ex
|
||||
// any value returned means like
|
||||
res.send({ like: like });
|
||||
} catch(error) {
|
||||
res.send({ error: 'Database error' })
|
||||
res.send({ error: 'Database error' });
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -277,7 +277,7 @@ async function updateBuildingData(
|
||||
|
||||
console.log(update);
|
||||
const patches = compare(oldBuilding, update);
|
||||
console.log('Patching', buildingId, patches)
|
||||
console.log('Patching', buildingId, patches);
|
||||
const [forward, reverse] = patches;
|
||||
if (Object.keys(forward).length === 0) {
|
||||
throw 'No change provided';
|
||||
@ -337,7 +337,7 @@ function privateQueryBuildingBBOX(buildingId: number){
|
||||
}
|
||||
|
||||
async function expireBuildingTileCache(buildingId: number) {
|
||||
const bbox = await privateQueryBuildingBBOX(buildingId)
|
||||
const bbox = await privateQueryBuildingBBOX(buildingId);
|
||||
const buildingBbox: BoundingBox = [bbox.xmax, bbox.ymax, bbox.xmin, bbox.ymin];
|
||||
tileCache.removeAllAtBbox(buildingBbox);
|
||||
}
|
||||
|
@ -50,12 +50,12 @@ function getDataExtractFromRow(er: DataExtractRow): DataExtract {
|
||||
extract_id: er.extract_id,
|
||||
extracted_on: er.extracted_on,
|
||||
download_path: getDownloadLinkForExtract(er)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function getDownloadLinkForExtract(extract: DataExtractRow): string {
|
||||
const file_name = path.basename(extract.extract_path);
|
||||
return `/downloads/${file_name}` // TODO: potentially move base path to env var
|
||||
return `/downloads/${file_name}`; // TODO: potentially move base path to env var
|
||||
}
|
||||
|
||||
export {
|
||||
|
@ -71,9 +71,9 @@ async function authUser(username: string, password: string) {
|
||||
);
|
||||
|
||||
if (user && user.auth_ok) {
|
||||
return { user_id: user.user_id }
|
||||
return { user_id: user.user_id };
|
||||
} else {
|
||||
return { error: 'Username or password not recognised' }
|
||||
return { error: 'Username or password not recognised' };
|
||||
}
|
||||
} catch(err) {
|
||||
if (err instanceof errors.QueryResultError) {
|
||||
@ -99,7 +99,7 @@ async function getUserById(id: string) {
|
||||
]
|
||||
);
|
||||
} catch(error) {
|
||||
console.error('Error:', error)
|
||||
console.error('Error:', error);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
@ -137,7 +137,7 @@ async function getNewUserAPIKey(id: string) {
|
||||
]
|
||||
);
|
||||
} catch(error) {
|
||||
console.error('Error:', error)
|
||||
console.error('Error:', error);
|
||||
return { error: 'Failed to generate new API key.' };
|
||||
}
|
||||
}
|
||||
@ -156,7 +156,7 @@ async function authAPIUser(key: string) {
|
||||
]
|
||||
);
|
||||
} catch(error) {
|
||||
console.error('Error:', error)
|
||||
console.error('Error:', error);
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import InfoBox from '../components/info-box';
|
||||
|
||||
|
||||
interface BuildingNotFoundProps {
|
||||
mode: string
|
||||
mode: string;
|
||||
}
|
||||
|
||||
const BuildingNotFound: React.FunctionComponent<BuildingNotFoundProps> = (props) => (
|
||||
|
@ -23,7 +23,7 @@ interface BuildingViewProps {
|
||||
building?: Building;
|
||||
building_like?: boolean;
|
||||
user?: any;
|
||||
selectBuilding: (building: Building) => void
|
||||
selectBuilding: (building: Building) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -39,7 +39,7 @@ const BuildingView: React.FunctionComponent<BuildingViewProps> = (props) => {
|
||||
title="Location"
|
||||
help="https://pages.colouring.london/location"
|
||||
intro="Where are the buildings? Address, location and cross-references."
|
||||
/>
|
||||
/>;
|
||||
case 'use':
|
||||
return <UseContainer
|
||||
{...props}
|
||||
@ -47,7 +47,7 @@ const BuildingView: React.FunctionComponent<BuildingViewProps> = (props) => {
|
||||
title="Land Use"
|
||||
intro="How are buildings used, and how does use change over time? Coming soon…"
|
||||
help="https://pages.colouring.london/use"
|
||||
/>
|
||||
/>;
|
||||
case 'type':
|
||||
return <TypeContainer
|
||||
{...props}
|
||||
@ -55,21 +55,21 @@ const BuildingView: React.FunctionComponent<BuildingViewProps> = (props) => {
|
||||
title="Type"
|
||||
intro="How were buildings previously used?"
|
||||
help="https://www.pages.colouring.london/buildingtypology"
|
||||
/>
|
||||
/>;
|
||||
case 'age':
|
||||
return <AgeContainer
|
||||
{...props}
|
||||
title="Age"
|
||||
help="https://pages.colouring.london/age"
|
||||
intro="Building age data can support energy analysis and help predict long-term change."
|
||||
/>
|
||||
/>;
|
||||
case 'size':
|
||||
return <SizeContainer
|
||||
{...props}
|
||||
title="Size & Shape"
|
||||
intro="How big are buildings?"
|
||||
help="https://pages.colouring.london/shapeandsize"
|
||||
/>
|
||||
/>;
|
||||
case 'construction':
|
||||
return <ConstructionContainer
|
||||
{...props}
|
||||
@ -77,7 +77,7 @@ const BuildingView: React.FunctionComponent<BuildingViewProps> = (props) => {
|
||||
intro="How are buildings built? Coming soon…"
|
||||
help="https://pages.colouring.london/construction"
|
||||
inactive={true}
|
||||
/>
|
||||
/>;
|
||||
case 'team':
|
||||
return <TeamContainer
|
||||
{...props}
|
||||
@ -85,7 +85,7 @@ const BuildingView: React.FunctionComponent<BuildingViewProps> = (props) => {
|
||||
intro="Who built the buildings? Coming soon…"
|
||||
help="https://pages.colouring.london/team"
|
||||
inactive={true}
|
||||
/>
|
||||
/>;
|
||||
case 'sustainability':
|
||||
return <SustainabilityContainer
|
||||
{...props}
|
||||
@ -93,7 +93,7 @@ const BuildingView: React.FunctionComponent<BuildingViewProps> = (props) => {
|
||||
intro="Are buildings energy efficient?"
|
||||
help="https://pages.colouring.london/sustainability"
|
||||
inactive={false}
|
||||
/>
|
||||
/>;
|
||||
case 'streetscape':
|
||||
return <StreetscapeContainer
|
||||
{...props}
|
||||
@ -101,7 +101,7 @@ const BuildingView: React.FunctionComponent<BuildingViewProps> = (props) => {
|
||||
intro="What's the building's context? Coming soon…"
|
||||
help="https://pages.colouring.london/streetscape"
|
||||
inactive={true}
|
||||
/>
|
||||
/>;
|
||||
case 'community':
|
||||
return <CommunityContainer
|
||||
{...props}
|
||||
@ -109,24 +109,24 @@ const BuildingView: React.FunctionComponent<BuildingViewProps> = (props) => {
|
||||
intro="How does this building work for the local community?"
|
||||
help="https://pages.colouring.london/community"
|
||||
inactive={true}
|
||||
/>
|
||||
/>;
|
||||
case 'planning':
|
||||
return <PlanningContainer
|
||||
{...props}
|
||||
title="Planning"
|
||||
intro="Planning controls relating to protection and reuse."
|
||||
help="https://pages.colouring.london/planning"
|
||||
/>
|
||||
/>;
|
||||
case 'like':
|
||||
return <LikeContainer
|
||||
{...props}
|
||||
title="Like Me!"
|
||||
intro="Do you like the building and think it contributes to the city?"
|
||||
help="https://pages.colouring.london/likeme"
|
||||
/>
|
||||
/>;
|
||||
default:
|
||||
return <BuildingNotFound mode="view" />
|
||||
return <BuildingNotFound mode="view" />;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default BuildingView;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
|
||||
import './categories.css'
|
||||
import './categories.css';
|
||||
|
||||
interface CategoriesProps {
|
||||
mode: 'view' | 'edit' | 'multi-edit';
|
||||
@ -119,7 +119,7 @@ const Categories: React.FC<CategoriesProps> = (props) => (
|
||||
building_id={props.building_id}
|
||||
/>
|
||||
</ol>
|
||||
)
|
||||
);
|
||||
|
||||
interface CategoryProps {
|
||||
mode: 'view' | 'edit' | 'multi-edit';
|
||||
@ -152,6 +152,6 @@ const Category: React.FC<CategoryProps> = (props) => {
|
||||
</NavLink>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default Categories;
|
||||
|
@ -19,6 +19,6 @@ const ContainerHeader: React.FunctionComponent<ContainerHeaderProps> = (props) =
|
||||
{props.children}
|
||||
</nav>
|
||||
</header>
|
||||
)
|
||||
);
|
||||
|
||||
export default ContainerHeader;
|
||||
|
@ -33,6 +33,6 @@ const CheckboxDataEntry: React.FunctionComponent<CheckboxDataEntryProps> = (prop
|
||||
</div>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default CheckboxDataEntry;
|
||||
|
@ -30,7 +30,7 @@ const DataEntryGroup: React.FunctionComponent<DataEntryGroupProps> = (props) =>
|
||||
</div>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const CollapseIcon: React.FunctionComponent<{collapsed: boolean}> = (props) => (
|
||||
<span className="collapse-icon">
|
||||
|
@ -18,7 +18,7 @@ interface DataEntryProps extends BaseDataEntryProps {
|
||||
value?: string;
|
||||
maxLength?: number;
|
||||
placeholder?: string;
|
||||
valueTransform?: (string) => string
|
||||
valueTransform?: (string) => string;
|
||||
}
|
||||
|
||||
const DataEntry: React.FunctionComponent<DataEntryProps> = (props) => {
|
||||
@ -48,7 +48,7 @@ const DataEntry: React.FunctionComponent<DataEntryProps> = (props) => {
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default DataEntry;
|
||||
export {
|
||||
|
@ -15,8 +15,8 @@ const DataTitle: React.FunctionComponent<DataTitleProps> = (props) => {
|
||||
{ props.title }
|
||||
{ props.tooltip? <Tooltip text={ props.tooltip } /> : null }
|
||||
</dt>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
interface DataTitleCopyableProps {
|
||||
@ -48,7 +48,7 @@ const DataTitleCopyable: React.FunctionComponent<DataTitleCopyableProps> = (prop
|
||||
</label>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default DataTitle;
|
||||
export { DataTitleCopyable }
|
||||
export { DataTitleCopyable };
|
||||
|
@ -46,6 +46,6 @@ const LikeDataEntry: React.FunctionComponent<LikeDataEntryProps> = (props) => {
|
||||
</label>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default LikeDataEntry;
|
||||
|
@ -69,7 +69,7 @@ class MultiDataEntry extends Component<MultiDataEntryProps> {
|
||||
key={index}
|
||||
className="form-control">
|
||||
<a href={sanitiseURL(item)}>{item}</a>
|
||||
</li>
|
||||
</li>;
|
||||
})
|
||||
}
|
||||
</ul>
|
||||
@ -98,7 +98,7 @@ class MultiDataEntry extends Component<MultiDataEntryProps> {
|
||||
onClick={this.add}
|
||||
disabled={props.mode === 'view'}
|
||||
className="btn btn-outline-dark">+</button>
|
||||
</Fragment>
|
||||
</Fragment>;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,6 @@ const NumericDataEntry: React.FunctionComponent<NumericDataEntryProps> = (props)
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default NumericDataEntry;
|
||||
|
@ -41,6 +41,6 @@ const SelectDataEntry: React.FunctionComponent<SelectDataEntryProps> = (props) =
|
||||
</select>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default SelectDataEntry;
|
||||
|
@ -39,6 +39,6 @@ const TextboxDataEntry: React.FunctionComponent<TextboxDataEntryProps> = (props)
|
||||
></textarea>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default TextboxDataEntry;
|
||||
|
@ -53,7 +53,7 @@ const UPRNsDataEntry: React.FC<UPRNsDataEntryProps> = (props) => {
|
||||
}
|
||||
</dd>
|
||||
</Fragment>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
export default UPRNsDataEntry;
|
||||
|
@ -23,7 +23,7 @@ class YearDataEntry extends Component<YearDataEntryProps, any> {
|
||||
lower: props.lower,
|
||||
decade: Math.floor(props.year / 10) * 10,
|
||||
century: Math.floor(props.year / 100) * 100
|
||||
}
|
||||
};
|
||||
}
|
||||
// TODO add dropdown for decade, century
|
||||
// TODO roll in first/last year estimate
|
||||
@ -62,7 +62,7 @@ class YearDataEntry extends Component<YearDataEntryProps, any> {
|
||||
tooltip={dataFields.date_lower.tooltip}
|
||||
/>
|
||||
</Fragment>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ interface DataContainerProps {
|
||||
mode: 'view' | 'edit';
|
||||
building?: Building;
|
||||
building_like?: boolean;
|
||||
selectBuilding: (building: Building) => void
|
||||
selectBuilding: (building: Building) => void;
|
||||
}
|
||||
|
||||
interface DataContainerState {
|
||||
@ -89,7 +89,7 @@ const withCopyEdit = (WrappedComponent: React.ComponentType<CategoryViewProps>)
|
||||
toggleCopying() {
|
||||
this.setState({
|
||||
copying: !this.state.copying
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,7 +106,7 @@ const withCopyEdit = (WrappedComponent: React.ComponentType<CategoryViewProps>)
|
||||
}
|
||||
this.setState({
|
||||
keys_to_copy: keys
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
isEdited() {
|
||||
@ -173,7 +173,7 @@ const withCopyEdit = (WrappedComponent: React.ComponentType<CategoryViewProps>)
|
||||
const data = await res.json();
|
||||
|
||||
if (data.error) {
|
||||
this.setState({error: data.error})
|
||||
this.setState({error: data.error});
|
||||
} else {
|
||||
this.props.selectBuilding(data);
|
||||
this.updateBuildingState('likes_total', data.likes_total);
|
||||
@ -199,7 +199,7 @@ const withCopyEdit = (WrappedComponent: React.ComponentType<CategoryViewProps>)
|
||||
const data = await res.json();
|
||||
|
||||
if (data.error) {
|
||||
this.setState({error: data.error})
|
||||
this.setState({error: data.error});
|
||||
} else {
|
||||
this.props.selectBuilding(data);
|
||||
}
|
||||
@ -210,14 +210,14 @@ const withCopyEdit = (WrappedComponent: React.ComponentType<CategoryViewProps>)
|
||||
|
||||
render() {
|
||||
if (this.props.mode === 'edit' && !this.props.user){
|
||||
return <Redirect to="/sign-up.html" />
|
||||
return <Redirect to="/sign-up.html" />;
|
||||
}
|
||||
|
||||
const currentBuilding = this.getEditedBuilding();
|
||||
|
||||
const values_to_copy = {}
|
||||
const values_to_copy = {};
|
||||
for (const key of Object.keys(this.state.keys_to_copy)) {
|
||||
values_to_copy[key] = currentBuilding[key]
|
||||
values_to_copy[key] = currentBuilding[key];
|
||||
}
|
||||
const data_string = JSON.stringify(values_to_copy);
|
||||
const copy: CopyProps = {
|
||||
@ -225,7 +225,7 @@ const withCopyEdit = (WrappedComponent: React.ComponentType<CategoryViewProps>)
|
||||
toggleCopying: this.toggleCopying,
|
||||
toggleCopyAttribute: this.toggleCopyAttribute,
|
||||
copyingKey: (key: string) => this.state.keys_to_copy[key]
|
||||
}
|
||||
};
|
||||
|
||||
const headerBackLink = `/${this.props.mode}/categories${this.props.building != undefined ? `/${this.props.building.building_id}` : ''}`;
|
||||
const edited = this.isEdited();
|
||||
@ -347,7 +347,7 @@ const withCopyEdit = (WrappedComponent: React.ComponentType<CategoryViewProps>)
|
||||
</section>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export default withCopyEdit;
|
||||
|
@ -75,7 +75,7 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
placeholder="https://..."
|
||||
/>
|
||||
</Fragment>
|
||||
)
|
||||
);
|
||||
const AgeContainer = withCopyEdit(AgeView);
|
||||
|
||||
export default AgeContainer;
|
||||
|
@ -28,7 +28,7 @@ const CommunityView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
}
|
||||
</ul>
|
||||
</Fragment>
|
||||
)
|
||||
);
|
||||
const CommunityContainer = withCopyEdit(CommunityView);
|
||||
|
||||
export default CommunityContainer;
|
||||
|
@ -49,7 +49,7 @@ const ConstructionView = (props) => (
|
||||
}
|
||||
</ul>
|
||||
</Fragment>
|
||||
)
|
||||
);
|
||||
const ConstructionContainer = withCopyEdit(ConstructionView);
|
||||
|
||||
export default ConstructionContainer;
|
||||
|
@ -17,7 +17,7 @@ const LikeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
onLike={props.onLike}
|
||||
/>
|
||||
</Fragment>
|
||||
)
|
||||
);
|
||||
const LikeContainer = withCopyEdit(LikeView);
|
||||
|
||||
export default LikeContainer;
|
||||
|
@ -114,7 +114,7 @@ const LocationView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
onChange={props.onChange}
|
||||
/>
|
||||
</Fragment>
|
||||
)
|
||||
);
|
||||
const LocationContainer = withCopyEdit(LocationView);
|
||||
|
||||
export default LocationContainer;
|
||||
|
@ -203,7 +203,7 @@ const PlanningView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
/>
|
||||
</DataEntryGroup>
|
||||
</Fragment>
|
||||
)
|
||||
);
|
||||
const PlanningContainer = withCopyEdit(PlanningView);
|
||||
|
||||
export default PlanningContainer
|
||||
export default PlanningContainer;
|
||||
|
@ -147,7 +147,7 @@ const SizeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
]}
|
||||
/>
|
||||
</Fragment>
|
||||
)
|
||||
);
|
||||
const SizeContainer = withCopyEdit(SizeView);
|
||||
|
||||
export default SizeContainer;
|
||||
|
@ -19,7 +19,7 @@ const StreetscapeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
<li>Building shading</li>
|
||||
</ul>
|
||||
</Fragment>
|
||||
)
|
||||
);
|
||||
const StreetscapeContainer = withCopyEdit(StreetscapeView);
|
||||
|
||||
export default StreetscapeContainer;
|
||||
|
@ -78,7 +78,7 @@ const SustainabilityView: React.FunctionComponent<CategoryViewProps> = (props) =
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
};
|
||||
const SustainabilityContainer = withCopyEdit(SustainabilityView);
|
||||
|
||||
export default SustainabilityContainer;
|
||||
|
@ -25,7 +25,7 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
}
|
||||
</ul>
|
||||
</Fragment>
|
||||
)
|
||||
);
|
||||
const TeamContainer = withCopyEdit(TeamView);
|
||||
|
||||
export default TeamContainer;
|
||||
|
@ -55,7 +55,7 @@ const TypeView: React.FunctionComponent<CategoryViewProps> = (props) => {
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
};
|
||||
const TypeContainer = withCopyEdit(TypeView);
|
||||
|
||||
export default TypeContainer;
|
||||
|
@ -32,7 +32,7 @@ const UseView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
}
|
||||
</ul>
|
||||
</Fragment>
|
||||
)
|
||||
);
|
||||
const UseContainer = withCopyEdit(UseView);
|
||||
|
||||
export default UseContainer;
|
||||
|
@ -9,7 +9,7 @@ import { CategoryEditSummary } from './category-edit-summary';
|
||||
import './building-edit-summary.css';
|
||||
|
||||
interface BuildingEditSummaryProps {
|
||||
historyEntry: EditHistoryEntry
|
||||
historyEntry: EditHistoryEntry;
|
||||
}
|
||||
|
||||
function formatDate(dt: Date) {
|
||||
@ -47,7 +47,7 @@ const BuildingEditSummary: React.FunctionComponent<BuildingEditSummaryProps> = p
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export {
|
||||
BuildingEditSummary
|
||||
|
@ -41,7 +41,7 @@ const EditHistory: React.FunctionComponent<EditHistoryProps> = (props) => {
|
||||
</ul>
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export {
|
||||
EditHistory
|
||||
|
@ -20,7 +20,7 @@ interface MultiEditProps extends RouteComponentProps<MultiEditRouteParams> {
|
||||
|
||||
const MultiEdit: React.FC<MultiEditProps> = (props) => {
|
||||
if (!props.user){
|
||||
return <Redirect to="/sign-up.html" />
|
||||
return <Redirect to="/sign-up.html" />;
|
||||
}
|
||||
const cat = props.match.params.cat;
|
||||
if (cat === 'like') {
|
||||
@ -46,14 +46,14 @@ const MultiEdit: React.FC<MultiEditProps> = (props) => {
|
||||
|
||||
let data: object;
|
||||
if (cat === 'like'){
|
||||
data = { like: true }
|
||||
data = { like: true };
|
||||
} else {
|
||||
try {
|
||||
// TODO: verify what happens if data is string[]
|
||||
data = JSON.parse(q.data as string);
|
||||
} catch (error) {
|
||||
console.error(error, q)
|
||||
data = {}
|
||||
console.error(error, q);
|
||||
data = {};
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ const MultiEdit: React.FC<MultiEditProps> = (props) => {
|
||||
disabled={true}
|
||||
value={data[key]}
|
||||
/>
|
||||
)
|
||||
);
|
||||
}))
|
||||
}
|
||||
</form>
|
||||
@ -91,6 +91,6 @@ const MultiEdit: React.FC<MultiEditProps> = (props) => {
|
||||
</section>
|
||||
</Sidebar>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default MultiEdit;
|
||||
|
@ -3,14 +3,14 @@ import React from 'react';
|
||||
import './confirmation-modal.css';
|
||||
|
||||
interface ConfirmationModalProps {
|
||||
show: boolean,
|
||||
title: string,
|
||||
description: string,
|
||||
confirmButtonText?: string,
|
||||
confirmButtonClass?: string,
|
||||
cancelButtonClass?: string,
|
||||
onConfirm: () => void,
|
||||
onCancel: () => void
|
||||
show: boolean;
|
||||
title: string;
|
||||
description: string;
|
||||
confirmButtonText?: string;
|
||||
confirmButtonClass?: string;
|
||||
cancelButtonClass?: string;
|
||||
onConfirm: () => void;
|
||||
onCancel: () => void;
|
||||
}
|
||||
|
||||
const ConfirmationModal: React.FunctionComponent<ConfirmationModalProps> = ({
|
||||
|
@ -1,11 +1,11 @@
|
||||
/**
|
||||
* Mini-library of icons
|
||||
*/
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import { library } from '@fortawesome/fontawesome-svg-core';
|
||||
import { faAngleLeft, faCaretDown, faCaretRight, faCaretUp, faCheck, faCheckDouble,
|
||||
faEye, faInfoCircle, faPaintBrush, faQuestionCircle, faSearch, faTimes } from '@fortawesome/free-solid-svg-icons'
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||
import React from 'react'
|
||||
faEye, faInfoCircle, faPaintBrush, faQuestionCircle, faSearch, faTimes } from '@fortawesome/free-solid-svg-icons';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import React from 'react';
|
||||
|
||||
library.add(
|
||||
faQuestionCircle,
|
||||
|
@ -45,6 +45,6 @@ const LogoGrid: React.FunctionComponent = () => (
|
||||
<div className="cell background-like"></div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
);
|
||||
|
||||
export { Logo };
|
||||
|
@ -1,27 +1,27 @@
|
||||
import urlapi from 'url';
|
||||
|
||||
function sanitiseURL(string){
|
||||
let url_
|
||||
let url_;
|
||||
|
||||
// http or https
|
||||
if (!(string.substring(0, 7) === 'http://' || string.substring(0, 8) === 'https://')){
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
url_ = document.createElement('a')
|
||||
url_.href = string
|
||||
url_ = document.createElement('a');
|
||||
url_.href = string;
|
||||
} catch (error) {
|
||||
try {
|
||||
url_ = urlapi.parse(string)
|
||||
url_ = urlapi.parse(string);
|
||||
} catch (error) {
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// required (www.example.com)
|
||||
if (!url_.hostname || url_.hostname === '' || url_.hostname === 'localhost'){
|
||||
return null
|
||||
return null;
|
||||
}
|
||||
|
||||
// optional (/some/path)
|
||||
@ -33,7 +33,7 @@ function sanitiseURL(string){
|
||||
// optional (#anchor)
|
||||
// url_.hash;
|
||||
|
||||
return `${url_.protocol}//${url_.hostname}${url_.pathname || ''}${url_.search || ''}${url_.hash || ''}`
|
||||
return `${url_.protocol}//${url_.hostname}${url_.pathname || ''}${url_.search || ''}${url_.hash || ''}`;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -63,8 +63,8 @@ function parseDate(isoUtcDate: string): Date {
|
||||
}
|
||||
|
||||
function compareObjects(objA: object, objB: object): [object, object] {
|
||||
const reverse = {}
|
||||
const forward = {}
|
||||
const reverse = {};
|
||||
const forward = {};
|
||||
for (const [key, value] of Object.entries(objB)) {
|
||||
if (objA[key] !== value) {
|
||||
reverse[key] = objA[key];
|
||||
|
@ -85,7 +85,7 @@ class MapApp extends React.Component<MapAppProps, MapAppState> {
|
||||
revisionId = +revisionId;
|
||||
// bump revision id, only ever increasing
|
||||
if (revisionId > this.state.revision_id) {
|
||||
this.setState({ revision_id: revisionId })
|
||||
this.setState({ revision_id: revisionId });
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ class MapApp extends React.Component<MapAppProps, MapAppState> {
|
||||
this.setState({ building: building });
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.error(err)
|
||||
console.error(err);
|
||||
this.setState({ building: building });
|
||||
});
|
||||
|
||||
@ -138,7 +138,7 @@ class MapApp extends React.Component<MapAppProps, MapAppState> {
|
||||
this.props.history.push(`/${mode}/${category}/${building.building_id}`);
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.error(err)
|
||||
console.error(err);
|
||||
this.setState({ building_like: false });
|
||||
});
|
||||
}
|
||||
@ -157,14 +157,14 @@ class MapApp extends React.Component<MapAppProps, MapAppState> {
|
||||
const q = parse(window.location.search);
|
||||
|
||||
if (cat === 'like') {
|
||||
this.likeBuilding(building.building_id)
|
||||
this.likeBuilding(building.building_id);
|
||||
} else {
|
||||
try {
|
||||
// TODO: verify what happens if data is string[]
|
||||
const data = JSON.parse(q.data as string);
|
||||
this.updateBuilding(building.building_id, data)
|
||||
this.updateBuilding(building.building_id, data);
|
||||
} catch (error) {
|
||||
console.error(error, q)
|
||||
console.error(error, q);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -181,7 +181,7 @@ class MapApp extends React.Component<MapAppProps, MapAppState> {
|
||||
res => res.json()
|
||||
).then(function (res) {
|
||||
if (res.error) {
|
||||
console.error({ error: res.error })
|
||||
console.error({ error: res.error });
|
||||
} else {
|
||||
this.increaseRevision(res.revision_id);
|
||||
}
|
||||
@ -202,7 +202,7 @@ class MapApp extends React.Component<MapAppProps, MapAppState> {
|
||||
res => res.json()
|
||||
).then(res => {
|
||||
if (res.error) {
|
||||
console.error({ error: res.error })
|
||||
console.error({ error: res.error });
|
||||
} else {
|
||||
this.increaseRevision(res.revision_id);
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ import Legend from './legend';
|
||||
import SearchBox from './search-box';
|
||||
import ThemeSwitcher from './theme-switcher';
|
||||
|
||||
import '../../../node_modules/leaflet/dist/leaflet.css'
|
||||
import './map.css'
|
||||
import '../../../node_modules/leaflet/dist/leaflet.css';
|
||||
import './map.css';
|
||||
|
||||
const OS_API_KEY = 'NVUxtY5r8eA6eIfwrPTAGKrAAsoeI9E9';
|
||||
|
||||
@ -84,7 +84,7 @@ class ColouringMap extends Component<ColouringMapProps, ColouringMapState> {
|
||||
}
|
||||
}.bind(this)).catch(
|
||||
(err) => console.error(err)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
themeSwitch(e) {
|
||||
|
@ -11,12 +11,12 @@ interface SearchResult {
|
||||
label: string;
|
||||
zoom: number;
|
||||
};
|
||||
geometry: Point
|
||||
geometry: Point;
|
||||
}
|
||||
|
||||
|
||||
interface SearchBoxProps {
|
||||
onLocate: (lat: number, lng: number, zoom: number) => void
|
||||
onLocate: (lat: number, lng: number, zoom: number) => void;
|
||||
}
|
||||
|
||||
interface SearchBoxState {
|
||||
@ -41,7 +41,7 @@ class SearchBox extends Component<SearchBoxProps, SearchBoxState> {
|
||||
collapsedSearch: true,
|
||||
//is this a small screen device? if not we will disable collapse option
|
||||
smallScreen: false
|
||||
}
|
||||
};
|
||||
this.handleChange = this.handleChange.bind(this);
|
||||
this.search = this.search.bind(this);
|
||||
this.handleKeyPress = this.handleKeyPress.bind(this);
|
||||
@ -94,7 +94,7 @@ class SearchBox extends Component<SearchBoxProps, SearchBoxState> {
|
||||
e.preventDefault();
|
||||
this.setState({
|
||||
fetching: true
|
||||
})
|
||||
});
|
||||
|
||||
fetch(
|
||||
'/api/search?q='+this.state.q
|
||||
@ -105,23 +105,23 @@ class SearchBox extends Component<SearchBoxProps, SearchBoxState> {
|
||||
this.setState({
|
||||
results: data.results,
|
||||
fetching: false
|
||||
})
|
||||
});
|
||||
} else {
|
||||
console.error(data);
|
||||
|
||||
this.setState({
|
||||
results: [],
|
||||
fetching: false
|
||||
})
|
||||
});
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.error(err)
|
||||
console.error(err);
|
||||
|
||||
this.setState({
|
||||
results: [],
|
||||
fetching: false
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@ -149,7 +149,7 @@ class SearchBox extends Component<SearchBoxProps, SearchBoxState> {
|
||||
<div className="collapse-btn" onClick={this.expandSearch}>
|
||||
<SearchIcon />
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const resultsList = this.state.results.length?
|
||||
@ -160,7 +160,7 @@ class SearchBox extends Component<SearchBoxProps, SearchBoxState> {
|
||||
const lng = result.geometry.coordinates[0];
|
||||
const lat = result.geometry.coordinates[1];
|
||||
const zoom = result.attributes.zoom;
|
||||
const href = `?lng=${lng}&lat=${lat}&zoom=${zoom}`
|
||||
const href = `?lng=${lng}&lat=${lat}&zoom=${zoom}`;
|
||||
return (
|
||||
<li key={result.attributes.label}>
|
||||
<a
|
||||
@ -172,7 +172,7 @@ class SearchBox extends Component<SearchBoxProps, SearchBoxState> {
|
||||
href={href}
|
||||
>{`${label.substring(0, 4)} ${label.substring(4, 7)}`}</a>
|
||||
</li>
|
||||
)
|
||||
);
|
||||
})
|
||||
}
|
||||
</ul>
|
||||
@ -197,7 +197,7 @@ class SearchBox extends Component<SearchBoxProps, SearchBoxState> {
|
||||
</form>
|
||||
{ resultsList }
|
||||
</div>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ const AboutPage = () => (
|
||||
onSubmit={function() {window.open(
|
||||
'https://tinyletter.com/colouringlondon',
|
||||
'popupwindow',
|
||||
'scrollbars=yes,width=800,height=600'); return true}}>
|
||||
'scrollbars=yes,width=800,height=600'); return true;}}>
|
||||
<h3 className="h1">Keep in touch</h3>
|
||||
<p>
|
||||
|
||||
|
@ -38,6 +38,6 @@ const ContributorAgreementPage : React.SFC<any> = () => (
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
||||
)
|
||||
);
|
||||
|
||||
export default ContributorAgreementPage;
|
||||
|
@ -116,6 +116,6 @@ const PrivacyPolicyPage: React.SFC<any> = () => (
|
||||
</div>
|
||||
</section>
|
||||
</article>
|
||||
)
|
||||
);
|
||||
|
||||
export default PrivacyPolicyPage;
|
||||
|
@ -80,6 +80,6 @@ export default class ForgottenPassword extends React.Component<{}, ForgottenPass
|
||||
</form>
|
||||
</section>
|
||||
</article>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import SupporterLogos from '../components/supporter-logos';
|
||||
import { User } from '../models/user';
|
||||
|
||||
interface LoginProps {
|
||||
user: User,
|
||||
user: User;
|
||||
login: (user: User) => void;
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ class Login extends Component<LoginProps, any> {
|
||||
|
||||
handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
this.setState({error: undefined})
|
||||
this.setState({error: undefined});
|
||||
|
||||
fetch('/api/login', {
|
||||
method: 'POST',
|
||||
@ -50,7 +50,7 @@ class Login extends Component<LoginProps, any> {
|
||||
res => res.json()
|
||||
).then(function(res){
|
||||
if (res.error) {
|
||||
this.setState({error: res.error})
|
||||
this.setState({error: res.error});
|
||||
} else {
|
||||
fetch('/api/users/me', {
|
||||
credentials: 'same-origin'
|
||||
@ -58,13 +58,13 @@ class Login extends Component<LoginProps, any> {
|
||||
(res) => res.json()
|
||||
).then(user => {
|
||||
if (user.error) {
|
||||
this.setState({error: user.error})
|
||||
this.setState({error: user.error});
|
||||
} else {
|
||||
this.props.login(user)
|
||||
this.props.login(user);
|
||||
}
|
||||
}).catch(
|
||||
(err) => this.setState({error: err})
|
||||
)
|
||||
);
|
||||
}
|
||||
}.bind(this)).catch(
|
||||
(err) => this.setState({error: err})
|
||||
@ -73,7 +73,7 @@ class Login extends Component<LoginProps, any> {
|
||||
|
||||
render() {
|
||||
if (this.props.user && !this.props.user.error) {
|
||||
return <Redirect to="/my-account.html" />
|
||||
return <Redirect to="/my-account.html" />;
|
||||
}
|
||||
return (
|
||||
<article>
|
||||
@ -130,7 +130,7 @@ class Login extends Component<LoginProps, any> {
|
||||
<SupporterLogos />
|
||||
</section>
|
||||
</article>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ class MyAccountPage extends Component<MyAccountPageProps, MyAccountPageState> {
|
||||
res => res.json()
|
||||
).then(function(res){
|
||||
if (res.error) {
|
||||
this.setState({error: res.error})
|
||||
this.setState({error: res.error});
|
||||
} else {
|
||||
this.props.logout();
|
||||
}
|
||||
@ -59,7 +59,7 @@ class MyAccountPage extends Component<MyAccountPageProps, MyAccountPageState> {
|
||||
res => res.json()
|
||||
).then(function(res){
|
||||
if (res.error) {
|
||||
this.setState({error: res.error})
|
||||
this.setState({error: res.error});
|
||||
} else {
|
||||
this.props.updateUser(res);
|
||||
}
|
||||
@ -170,7 +170,7 @@ class MyAccountPage extends Component<MyAccountPageProps, MyAccountPageState> {
|
||||
} else {
|
||||
return (
|
||||
<Redirect to="/login.html" />
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,6 +117,6 @@ export default class PasswordReset extends React.Component<RouteComponentProps,
|
||||
</form>
|
||||
</section>
|
||||
</article>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ class SignUp extends Component<SignUpProps, SignUpState> {
|
||||
|
||||
handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
this.setState({error: undefined})
|
||||
this.setState({error: undefined});
|
||||
|
||||
fetch('/api/users', {
|
||||
method: 'POST',
|
||||
@ -63,7 +63,7 @@ class SignUp extends Component<SignUpProps, SignUpState> {
|
||||
res => res.json()
|
||||
).then(function(res){
|
||||
if (res.error) {
|
||||
this.setState({error: res.error})
|
||||
this.setState({error: res.error});
|
||||
} else {
|
||||
fetch('/api/users/me', {
|
||||
credentials: 'same-origin'
|
||||
@ -73,7 +73,7 @@ class SignUp extends Component<SignUpProps, SignUpState> {
|
||||
(user) => this.props.login(user)
|
||||
).catch(
|
||||
(err) => this.setState({error: err})
|
||||
)
|
||||
);
|
||||
}
|
||||
}.bind(this)).catch(
|
||||
(err) => this.setState({error: err})
|
||||
@ -82,7 +82,7 @@ class SignUp extends Component<SignUpProps, SignUpState> {
|
||||
|
||||
render() {
|
||||
if (this.props.user) {
|
||||
return <Redirect to="/my-account.html" />
|
||||
return <Redirect to="/my-account.html" />;
|
||||
}
|
||||
return (
|
||||
<article>
|
||||
@ -175,7 +175,7 @@ class SignUp extends Component<SignUpProps, SignUpState> {
|
||||
<SupporterLogos />
|
||||
</section>
|
||||
</article>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ function parseBuildingURL(url) {
|
||||
const matches = re.exec(url);
|
||||
|
||||
if (matches && matches.length >= 2) {
|
||||
return strictParseInt(matches[1])
|
||||
return strictParseInt(matches[1]);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
@ -37,9 +37,9 @@ const sess: any = { // TODO: remove any
|
||||
};
|
||||
if (server.get('env') === 'production') {
|
||||
// trust first proxy
|
||||
server.set('trust proxy', 1)
|
||||
server.set('trust proxy', 1);
|
||||
// serve secure cookies
|
||||
sess.cookie.secure = true
|
||||
sess.cookie.secure = true;
|
||||
}
|
||||
server.use(session(sess));
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
// and then use stdlib `import fs from 'fs';`
|
||||
import { Image } from 'mapnik';
|
||||
import fs from 'node-fs';
|
||||
import { promisify } from 'util'
|
||||
import { promisify } from 'util';
|
||||
|
||||
import { BoundingBox, TileParams } from './types';
|
||||
import { formatParams, getXYZ } from './util';
|
||||
@ -113,7 +113,7 @@ class TileCache {
|
||||
if(!this.shouldBulkClearTileset(tileset)) continue;
|
||||
|
||||
for (let z = this.cacheDomain.minZoom; z <= this.cacheDomain.maxZoom; z++) {
|
||||
let tileBounds = getXYZ(bbox, z)
|
||||
let tileBounds = getXYZ(bbox, z);
|
||||
for (let x = tileBounds.minX; x <= tileBounds.maxX; x++) {
|
||||
for (let y = tileBounds.minY; y <= tileBounds.maxY; y++) {
|
||||
for (const scale of this.cacheDomain.scales) {
|
||||
|
@ -31,7 +31,7 @@ const handleTileRequest = asyncController(async function (req: express.Request,
|
||||
});
|
||||
|
||||
// tiles router
|
||||
const router = express.Router()
|
||||
const router = express.Router();
|
||||
|
||||
router.get('/:tileset/:z/:x/:y(\\d+):scale(@\\dx)?.png', handleTileRequest);
|
||||
|
||||
|
@ -44,7 +44,7 @@ type Tile = Image | Sharp;
|
||||
type RendererFunction = (tileParams: TileParams, dataParams: any) => Promise<Tile>;
|
||||
|
||||
interface TileRenderer {
|
||||
getTile: RendererFunction
|
||||
getTile: RendererFunction;
|
||||
}
|
||||
|
||||
export {
|
||||
|
@ -13,7 +13,7 @@ function getBbox(z, x, y) {
|
||||
}
|
||||
|
||||
function getXYZ(bbox, z) {
|
||||
return mercator.xyz(bbox, z, false, '900913')
|
||||
return mercator.xyz(bbox, z, false, '900913');
|
||||
}
|
||||
|
||||
function formatParams({ tileset, z, x, y, scale }: TileParams): string {
|
||||
|
@ -13,6 +13,7 @@
|
||||
{ "name": "libraries", "match": ".*", "order": 10 }
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"semicolon": true
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user