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

81 lines
3.1 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-09-14 11:10:08 -04:00
const Disclaimer = () => { return <Fragment><div>Disclaimer: these data are currently incomplete and also often do not provide information on minor alterations. For comprehensive information on all applications please visit the local authorities' planning websites.</div></Fragment> }
2022-08-30 06:25:20 -04:00
2022-10-05 13:52:14 -04:00
const PlanningDataOfficialDataEntry: React.FC<PlanningDataOfficialDataEntryProps> = (props) => {
const data = props.value || [];
if(data.length == 0) {
return (<Fragment>
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>
<div><i>Planning application status is streamed using live data uploaded by local authorities to the <a href={data[0]["data_source_link"]}>{data[0]["data_source"]}</a></i></div>
2022-09-15 07:14:35 -04:00
<br/>
<div><b>Current planning application status for this site:</b> {data[0]["status"]}</div>
2022-09-14 08:15:49 -04:00
<div><b>Planning application ID:</b> {data[0]["planning_application_id"]}</div>
2022-09-15 06:41:52 -04:00
<div><b>Date registered by the planning authority (validation date)</b>: {data[0]["registered_with_local_authority_date"]}</div>
2022-09-14 11:23:50 -04:00
<div><b>Decision date</b>: {data[0]["decision_date"].toString()}</div>
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>
2022-08-30 06:25:20 -04:00
<Disclaimer />
<div className="form-check">
<label
className="form-check-label">
2022-09-14 11:10:17 -04:00
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;