add logic based on is_extension

This commit is contained in:
Ed Chalstrey 2022-06-01 14:08:46 +01:00
parent 6a7bfdf5e7
commit 2d65372a56

View File

@ -15,35 +15,37 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
const building = props.building; const building = props.building;
const currentYear = new Date().getFullYear(); const currentYear = new Date().getFullYear();
const currentBuildingConstructionYear = building.date_year || undefined; const currentBuildingConstructionYear = building.date_year || undefined;
return ( if (props.building.is_extension == "The main building"){
<Fragment> return (
<InfoBox msg="Can you help us capture information on who built the current building?"></InfoBox> <Fragment>
<SelectDataEntry <InfoBox msg="Can you help us capture information on who built the current building?"></InfoBox>
title={dataFields.is_extension.title} <SelectDataEntry
slug="is_extension" title={dataFields.is_extension.title}
value={props.building.is_extension} slug="is_extension"
mode={props.mode} value={props.building.is_extension}
copy={props.copy} mode={props.mode}
onChange={props.onChange} copy={props.copy}
tooltip={dataFields.is_extension.tooltip} onChange={props.onChange}
placeholder={dataFields.is_extension.example} tooltip={dataFields.is_extension.tooltip}
options={dataFields.is_extension.items} placeholder={dataFields.is_extension.example}
/> options={dataFields.is_extension.items}
/>
<NumericDataEntry <NumericDataEntry
slug='date_year' slug='date_year'
title={dataFields.work_carried_out.title} title={dataFields.work_carried_out.title}
value={currentBuildingConstructionYear} value={currentBuildingConstructionYear}
mode={props.mode} mode={props.mode}
copy={props.copy} copy={props.copy}
onChange={props.onChange} onChange={props.onChange}
step={1} step={1}
min={1} min={1}
max={currentYear} max={currentYear}
tooltip={dataFields.work_carried_out.tooltip} tooltip={dataFields.work_carried_out.tooltip}
/> />
</Fragment> </Fragment>
); );
};
}; };
const TeamContainer = withCopyEdit(TeamView); const TeamContainer = withCopyEdit(TeamView);