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 == null) { return
{MissingData}
} if (content.length <= limit) { return
{content}
} if (showAll) { return
{content}
Shorten description
} const toShow = content.substring(0, limit).trim() + "... "; return
{toShow}
Show full description
} const Disclaimer = () => { return
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.
} const MissingData = "not available" function ShowIfAvailable(data) { return <>{data ? data.toString() : MissingData } } const LinkIfAvailable = (link) => { return <>{link ? {link.toString()} : MissingData } } const PlanningDataOfficialDataEntry: React.FC = (props) => { const data = props.value || []; if(data.length == 0) { return ( No live planning data available currently for this building polygon via the Planning London DataHub.
); } return (data.map((item) => (
Planning application status is streamed using live data uploaded by local authorities to the {item["data_source"]}.

Current planning application status for this site: {ShowIfAvailable(item["status"])}
Planning application ID: {ShowIfAvailable(item["planning_application_id"])}
Date registered by the planning authority (validation date): {ShowIfAvailable(item["registered_with_local_authority_date"])}
Decision date: {ShowIfAvailable(item["decision_date"])}
Planning application link: {LinkIfAvailable(item["planning_application_link"])}
Description of proposed work: {item["description"] ? : MissingData}
Most recent update by data provider: {ShowIfAvailable(item["decision_date"])}

) ) ) }; export default PlanningDataOfficialDataEntry;