import React, { Fragment } from 'react'; import InfoBox from '../../components/info-box'; import CheckboxDataEntry from '../data-components/checkbox-data-entry'; interface PlanningDataOfficialDataEntryProps { shownData: { uprn: string; building_id: number; status?: string, status_before_aliasing?: string, description?: string; planning_application_link?: string; registered_with_local_authority_date?: string; decision_date?: string; last_synced_date?: string; data_source: string; data_source_link?: string; }[]; allEntryCount: number, } 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 provided by data source" function ShowIfAvailable(data) { return <>{data ? data.toString() : MissingData } } const LinkIfAvailable = (link) => { return <>{link ? {link.toString()} : MissingData } } const StatusInfo = ({status, statusBeforeAliasing}) => { if(status == null) { return <>{LinkIfAvailable(null)} } if(status != statusBeforeAliasing) { return <>{status} - status in raw data was: {statusBeforeAliasing} } return <>{status} } const PlanningDataOfficialDataEntry: React.FC = (props) => { const data = props.shownData || []; if(data.length == 0) { if (props.allEntryCount == 0) { return ( No live planning data available currently for this building polygon via the Planning London DataHub.
); } else { return ( No live planning data for this date range, but this building has associated planning data now shown here.
); } } return <>{data.map((item) => (
Planning application status is streamed using live data uploaded by local authorities to the {item["data_source_link"] ? {item["data_source"]} : item["data_source"] }.

Current planning application status for this site:
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;