colouring-montreal/app/src/frontend/building/data-components/planning-data-entry.tsx

85 lines
3.4 KiB
TypeScript
Raw Normal View History

2022-10-05 13:52:14 -04:00
import React, { Fragment } from 'react';
import InfoBox from '../../components/info-box';
import CheckboxDataEntry from '../data-components/checkbox-data-entry';
interface PlanningDataOfficialDataEntryProps {
value: any; // TODO: proper structuring!
}
const {useState} = React;
const LongText = ({ content,limit}) => {
const [showAll, setShowAll] = useState(false);
const showMore = () => setShowAll(true);
const showLess = () => setShowAll(false);
if (content.length <= limit) {
return <div>{content}</div>
}
if (showAll) {
return <div>
{content}
2022-08-29 07:28:06 -04:00
<br/>
<b onClick={showLess}>Shorten description</b>
2022-10-05 13:52:14 -04:00
</div>
}
const toShow = content.substring(0, limit).trim() + "... ";
return <div>
{toShow}
2022-08-29 07:28:06 -04:00
<br/>
<b onClick={showMore}>Show full description</b>
2022-10-05 13:52:14 -04:00
</div>
}
2022-08-30 06:25:20 -04:00
const Disclaimer = () => { return <Fragment><div>Disclaimer: Planning application status is visualised using data uploaded by local authorities to the <a href="https://data.london.gov.uk/dataset/planning-london-datahub?_gl=1%2aprwpc%2a_ga%2aMzQyOTg0MjcxLjE2NTk0NDA4NTM">Greater London Authority's Planning London DataHub</a>. Please note that these data are currently incomplete and also often do not provide information on minor alterations. For comprehensive information on all applications please visit the UK Planning Portal site.</div></Fragment> }
2022-10-05 13:52:14 -04:00
const PlanningDataOfficialDataEntry: React.FC<PlanningDataOfficialDataEntryProps> = (props) => {
const data = props.value || [];
if(data.length == 0) {
return (<Fragment>
<DataTitle
title={"Planning Application Status"}
tooltip={null}
2022-09-14 06:57:47 -04:00
/>
<InfoBox type='success'>
2022-08-30 06:25:20 -04:00
<i>No live planning data available currently for this building polygon via the Planning London DataHub.</i>
<Disclaimer />
2022-10-05 13:52:14 -04:00
</InfoBox>
</Fragment>);
}
return (
<Fragment>
<InfoBox type='success'>
2022-09-14 06:57:47 -04:00
<Fragment>
2022-08-29 07:28:06 -04:00
<b>Current planning application status for this site:</b> {data[0]["status"]}
2022-10-05 13:52:14 -04:00
<br/>
2022-09-14 08:15:49 -04:00
<div><b>Planning application ID:</b> {data[0]["planning_application_id"]}</div>
2022-09-14 09:52:46 -04:00
<b>Date registered by the planning authority (validation date)</b>: TODO
2022-08-29 07:28:06 -04:00
<b>Decision date</b>: {data[0]["decision_date"].toString()}
2022-08-29 11:51:40 -04:00
<div><b>Description of proposed work</b>: <LongText content = {data[0]["description"]} limit = {400}/></div>
<div><b>Most recent update by data provider:</b> {data[0]["decision_date"]}</div>
<div><b>Data source:</b> <a href={data[0]["data_source_link"]}>{data[0]["data_source"]}</a></div>
2022-08-30 06:25:20 -04:00
<Disclaimer />
<div className="form-check">
<label
className="form-check-label">
Show conservation areas from '<a href="http://www.bedfordpark.net/leo/planning/">English Conservation Area dataset 2020</a>' by Ian Hall."
<input className="form-check-input" type="checkbox"
checked={false}
disabled={true}
/>
</label>
</div>
2022-10-05 13:52:14 -04:00
</Fragment>
</InfoBox>
</Fragment>
);
};
export default PlanningDataOfficialDataEntry;