2018-10-01 07:45:33 -04:00
|
|
|
import React, { Fragment } from 'react';
|
2018-09-30 19:13:01 -04:00
|
|
|
import { Link, NavLink } from 'react-router-dom';
|
2018-09-09 17:22:44 -04:00
|
|
|
|
2018-09-11 15:59:59 -04:00
|
|
|
import Sidebar from './sidebar';
|
|
|
|
import Tooltip from './tooltip';
|
2018-09-13 15:41:42 -04:00
|
|
|
import InfoBox from './info-box';
|
2018-10-01 12:20:25 -04:00
|
|
|
import { HelpIcon, EditIcon } from './icons';
|
2018-09-11 15:59:59 -04:00
|
|
|
|
2018-09-30 19:32:24 -04:00
|
|
|
|
|
|
|
const DataSection = function(props){
|
|
|
|
const match = props.hash && props.slug.match(props.hash);
|
|
|
|
return (
|
2018-10-01 07:45:33 -04:00
|
|
|
<section className={(props.inactive)? "data-section inactive": "data-section"}>
|
2018-10-01 11:59:39 -04:00
|
|
|
<header className="bullet-prefix section-header" isActive={() => match}>
|
|
|
|
<NavLink to={(match)? '#': `#${props.slug}`}>
|
|
|
|
<h3 className="h3">{props.title}</h3>
|
|
|
|
</NavLink>
|
|
|
|
{
|
|
|
|
props.helpLink?
|
|
|
|
<a className="icon-button help" title="Find out more" href={props.helpLink} target="_blank" rel="noopener noreferrer">
|
2018-10-01 12:20:25 -04:00
|
|
|
<HelpIcon />
|
2018-10-01 11:59:39 -04:00
|
|
|
</a>
|
|
|
|
: null
|
|
|
|
}
|
|
|
|
{
|
|
|
|
!props.inactive?
|
|
|
|
<NavLink className="icon-button edit" title="Edit data" to={`/building/${props.building_id}/edit.html#${props.slug}`}>
|
|
|
|
<EditIcon />
|
|
|
|
</NavLink>
|
|
|
|
: null
|
|
|
|
}
|
|
|
|
</header>
|
2018-10-01 07:45:33 -04:00
|
|
|
<Fragment>{ (match)? props.children : null }</Fragment>
|
2018-10-01 11:59:39 -04:00
|
|
|
{
|
2018-10-01 07:45:33 -04:00
|
|
|
(match && !props.inactive)?
|
|
|
|
<div className="buttons-container with-space">
|
2018-10-01 11:59:39 -04:00
|
|
|
<Link to={`/building/${props.building_id}/edit.html#${props.slug}`} className="btn btn-primary">Edit data</Link>
|
2018-10-01 07:45:33 -04:00
|
|
|
</div>
|
|
|
|
: null
|
2018-10-01 11:59:39 -04:00
|
|
|
}
|
2018-09-30 19:32:24 -04:00
|
|
|
</section>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-09-13 15:41:42 -04:00
|
|
|
const BuildingView = function(props){
|
2018-09-30 16:54:47 -04:00
|
|
|
if (!props.building_id){
|
2018-09-13 15:41:42 -04:00
|
|
|
return (
|
|
|
|
<Sidebar title="Building Not Found">
|
|
|
|
<InfoBox msg="We can't find that one anywhere - try the map again?" />
|
2018-10-01 07:45:33 -04:00
|
|
|
<div className="buttons-container with-space">
|
2018-09-13 15:41:42 -04:00
|
|
|
<Link to="/map/date_year.html" className="btn btn-secondary">Back to maps</Link>
|
|
|
|
</div>
|
|
|
|
</Sidebar>
|
|
|
|
);
|
|
|
|
}
|
2018-09-30 19:32:24 -04:00
|
|
|
const hash = (props.location && props.location.hash)? props.location.hash.replace('#', ''): undefined;
|
2018-09-13 15:41:42 -04:00
|
|
|
return (
|
2018-10-01 12:20:25 -04:00
|
|
|
<Sidebar title={`View Building`} back="/map/date_year.html">
|
2018-10-01 11:59:39 -04:00
|
|
|
<DataSection title="Location" slug="location" hash={hash}
|
2018-10-02 16:25:46 -04:00
|
|
|
helpLink="https://pages.colouring.london/location">
|
2018-09-30 19:32:24 -04:00
|
|
|
<p className="data-intro">
|
2018-09-09 17:22:44 -04:00
|
|
|
|
2018-09-30 19:32:24 -04:00
|
|
|
Section introduction of up to roughly 100 characters will take
|
|
|
|
approx­imately this much space.
|
2018-09-09 17:22:44 -04:00
|
|
|
|
2018-09-30 19:32:24 -04:00
|
|
|
</p>
|
|
|
|
<dl id="data-list-location" className="data-list collapse show">
|
|
|
|
<dt>
|
|
|
|
Building Name
|
2018-10-02 16:25:46 -04:00
|
|
|
<Tooltip text="May not be needed for many buildings." />
|
2018-09-30 19:32:24 -04:00
|
|
|
</dt>
|
|
|
|
<dd>{props.location_name ? props.location_name : '-'}</dd>
|
|
|
|
<dt>Building Number</dt>
|
|
|
|
<dd>{props.location_number ? props.location_number : '-'}</dd>
|
|
|
|
<dt>Street</dt>
|
|
|
|
<dd>{props.location_street ? props.location_street : '-'}</dd>
|
|
|
|
<dt>Address line 2</dt>
|
|
|
|
<dd>{props.location_line_two ? props.location_line_two : '-'}</dd>
|
|
|
|
<dt>Town</dt>
|
|
|
|
<dd>{props.location_town ? props.location_town : '-'}</dd>
|
|
|
|
<dt>Postcode</dt>
|
|
|
|
<dd>{props.location_postcode ? props.location_postcode : '-'}</dd>
|
|
|
|
</dl>
|
|
|
|
</DataSection>
|
2018-10-01 11:59:39 -04:00
|
|
|
<DataSection inactive={true} title="Use" slug="use" hash={hash}
|
2018-10-02 16:25:46 -04:00
|
|
|
helpLink="https://pages.colouring.london/use">
|
2018-10-01 11:59:39 -04:00
|
|
|
<p className="data-intro">Coming soon… Click the ? for more info.</p>
|
2018-10-01 07:45:33 -04:00
|
|
|
</DataSection>
|
2018-10-01 11:59:39 -04:00
|
|
|
<DataSection inactive={true} title="Type" slug="type" hash={hash}
|
2018-10-02 16:25:46 -04:00
|
|
|
helpLink="https://pages.colouring.london/type">
|
2018-10-01 11:59:39 -04:00
|
|
|
<p className="data-intro">Coming soon… Click the ? for more info.</p>
|
2018-10-01 07:45:33 -04:00
|
|
|
</DataSection>
|
2018-10-01 11:59:39 -04:00
|
|
|
<DataSection title="Age" slug="age" hash={hash}
|
2018-10-02 16:25:46 -04:00
|
|
|
helpLink="https://pages.colouring.london/age">
|
2018-09-13 15:41:42 -04:00
|
|
|
<dl className="data-list">
|
|
|
|
<dt>Year built (best estimate)</dt>
|
|
|
|
<dd>{props.date_year? props.date_year : '-'}</dd>
|
|
|
|
<dt>Year built (lower estimate)</dt>
|
|
|
|
<dd>{props.date_lower? props.date_lower : '-'}</dd>
|
|
|
|
<dt>Year built (upper estimate)</dt>
|
|
|
|
<dd>{props.date_upper? props.date_upper : '-'}</dd>
|
|
|
|
<dt>Date Source</dt>
|
|
|
|
<dd>{props.date_source? props.date_source : '-'}</dd>
|
|
|
|
<dt>Facade date</dt>
|
|
|
|
<dd>{props.date_facade? props.date_facade : '-'}</dd>
|
|
|
|
</dl>
|
2018-09-30 19:32:24 -04:00
|
|
|
</DataSection>
|
2018-10-01 11:59:39 -04:00
|
|
|
<DataSection title="Size" slug="size" hash={hash}
|
2018-10-02 16:25:46 -04:00
|
|
|
helpLink="https://pages.colouring.london/shape">
|
2018-09-13 15:41:42 -04:00
|
|
|
<dl className="data-list">
|
2018-10-01 07:45:33 -04:00
|
|
|
<dt>Total storeys</dt>
|
|
|
|
<dd>{(props.size_storeys_attic + props.size_storeys_basement + props.size_storeys_core)}</dd>
|
2018-09-13 15:41:42 -04:00
|
|
|
<dt>Attic storeys</dt>
|
2018-09-30 18:06:30 -04:00
|
|
|
<dd>{props.size_storeys_attic? props.size_storeys_attic : '-'}</dd>
|
2018-09-13 15:41:42 -04:00
|
|
|
<dt>Basement storeys</dt>
|
2018-09-30 18:06:30 -04:00
|
|
|
<dd>{props.size_storeys_basement? props.size_storeys_basement : '-'}</dd>
|
2018-09-13 15:41:42 -04:00
|
|
|
</dl>
|
2018-10-01 07:45:33 -04:00
|
|
|
<dl className="data-list">
|
|
|
|
<dt>Height to apex (m)</dt>
|
|
|
|
<dd>{props.size_height_apex? props.size_height_apex : '-'}</dd>
|
|
|
|
<dt>Ground floor area (m²)</dt>
|
|
|
|
<dd>{props.size_floor_area_ground? props.size_floor_area_ground : '-'}</dd>
|
|
|
|
<dt>Total floor area (m²)</dt>
|
|
|
|
<dd>{props.size_floor_area_total? props.size_floor_area_total : '-'}</dd>
|
|
|
|
<dt>Frontage Width (m)</dt>
|
|
|
|
<dd>{props.size_width_frontage? props.size_width_frontage : '-'}</dd>
|
|
|
|
</dl>
|
|
|
|
</DataSection>
|
2018-10-01 11:59:39 -04:00
|
|
|
<DataSection inactive={true} title="Shape & Position" slug="form" hash={hash}
|
2018-10-02 16:25:46 -04:00
|
|
|
helpLink="https://pages.colouring.london/form">
|
2018-10-01 11:59:39 -04:00
|
|
|
<p className="data-intro">Coming soon… Click the ? for more info.</p>
|
2018-10-01 07:45:33 -04:00
|
|
|
</DataSection>
|
2018-10-01 11:59:39 -04:00
|
|
|
<DataSection inactive={true} title="Build Team" slug="build-team" hash={hash}
|
2018-10-02 16:25:46 -04:00
|
|
|
helpLink="https://pages.colouring.london/builder">
|
2018-10-01 11:59:39 -04:00
|
|
|
<p className="data-intro">Coming soon… Click the ? for more info.</p>
|
2018-10-01 07:45:33 -04:00
|
|
|
</DataSection>
|
2018-10-01 11:59:39 -04:00
|
|
|
<DataSection inactive={true} title="Construction & Design" slug="construction" hash={hash}
|
2018-10-02 16:25:46 -04:00
|
|
|
helpLink="https://pages.colouring.london/contstruction">
|
2018-10-01 11:59:39 -04:00
|
|
|
<p className="data-intro">Coming soon… Click the ? for more info.</p>
|
2018-10-01 07:45:33 -04:00
|
|
|
</DataSection>
|
2018-10-01 11:59:39 -04:00
|
|
|
<DataSection inactive={true} title="Energy" slug="energy" hash={hash}
|
2018-10-02 16:25:46 -04:00
|
|
|
helpLink="https://pages.colouring.london/energy">
|
2018-10-01 11:59:39 -04:00
|
|
|
<p className="data-intro">Coming soon… Click the ? for more info.</p>
|
2018-10-01 07:45:33 -04:00
|
|
|
</DataSection>
|
2018-10-01 11:59:39 -04:00
|
|
|
<DataSection inactive={true} title="Greenery" slug="greenery" hash={hash}
|
2018-10-02 16:25:46 -04:00
|
|
|
helpLink="https://pages.colouring.london/copy-of-street-context">
|
2018-10-01 11:59:39 -04:00
|
|
|
<p className="data-intro">Coming soon… Click the ? for more info.</p>
|
2018-10-01 07:45:33 -04:00
|
|
|
</DataSection>
|
2018-10-01 11:59:39 -04:00
|
|
|
<DataSection inactive={true} title="Planning & Protection" slug="planning" hash={hash}
|
2018-10-02 16:25:46 -04:00
|
|
|
helpLink="https://pages.colouring.london/planning">
|
2018-10-01 11:59:39 -04:00
|
|
|
<p className="data-intro">Coming soon… Click the ? for more info.</p>
|
2018-10-01 07:45:33 -04:00
|
|
|
</DataSection>
|
2018-10-01 11:59:39 -04:00
|
|
|
<DataSection inactive={true} title="Demolition" slug="demolition" hash={hash}
|
2018-10-02 16:25:46 -04:00
|
|
|
helpLink="https://pages.colouring.london/demolitions">
|
2018-10-01 11:59:39 -04:00
|
|
|
<p className="data-intro">Coming soon… Click the ? for more info.</p>
|
2018-09-30 19:32:24 -04:00
|
|
|
</DataSection>
|
2018-10-01 11:59:39 -04:00
|
|
|
<DataSection title="Like Me!" slug="like" hash={hash}
|
2018-10-02 16:25:46 -04:00
|
|
|
helpLink="https://pages.colouring.london/likeme">
|
2018-09-13 15:41:42 -04:00
|
|
|
<dl className="data-list">
|
|
|
|
<dt>Likes</dt>
|
|
|
|
<dd>{props.likes ? props.likes.length : 0}</dd>
|
|
|
|
</dl>
|
2018-09-30 19:32:24 -04:00
|
|
|
</DataSection>
|
2018-09-13 15:41:42 -04:00
|
|
|
</Sidebar>
|
|
|
|
);
|
|
|
|
}
|
2018-09-09 17:22:44 -04:00
|
|
|
|
|
|
|
export default BuildingView;
|