colouring-montreal/app/src/frontend/building/data-containers/use.tsx

60 lines
2.5 KiB
TypeScript
Raw Normal View History

2019-08-14 17:23:12 -04:00
import React, { Fragment } from 'react';
import InfoBox from '../../components/info-box';
import { dataFields } from '../../config/data-fields-config';
import DataEntry from '../data-components/data-entry';
import MultiDataEntry from '../data-components/multi-data-entry/multi-data-entry';
import withCopyEdit from '../data-container';
2019-11-07 02:39:26 -05:00
import { CategoryViewProps } from './category-view-props';
2020-08-04 12:16:57 -04:00
import Verification from '../data-components/verification';
/**
* Use view/edit section
*/
const UseView: React.FunctionComponent<CategoryViewProps> = (props) => (
2019-08-14 17:23:12 -04:00
<Fragment>
<InfoBox msg="93% of properties in UK are dwellings so we have set this as the default colour. Can you help us colour-in all non-residential and mixed use buildings, and verify residential buildings too?"></InfoBox>
<MultiDataEntry
title={dataFields.current_landuse_group.title}
slug="current_landuse_group"
value={props.building.current_landuse_group}
2020-01-06 14:48:47 -05:00
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
2020-03-27 10:32:19 -04:00
confirmOnEnter={true}
tooltip={dataFields.current_landuse_group.tooltip}
placeholder="Type new land use group here"
2020-06-24 23:50:16 -04:00
copyable={true}
2020-03-19 14:17:56 -04:00
autofill={true}
showAllOptionsOnEmpty={true}
2020-03-27 10:32:19 -04:00
addOnAutofillSelect={true}
/>
2020-08-04 12:16:57 -04:00
<Verification
slug="current_landuse_group"
2020-08-04 14:15:37 -04:00
allow_verify={props.user !== undefined && props.building.current_landuse_group !== null && !props.edited}
2020-08-04 12:16:57 -04:00
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("current_landuse_group")}
user_verified_as={props.user_verified.current_landuse_group && props.user_verified.current_landuse_group.join(", ")}
verified_count={props.building.verified.current_landuse_group}
/>
2020-03-27 10:32:19 -04:00
{
props.mode != 'view' &&
2020-06-18 07:39:30 -04:00
<InfoBox msg="Land use order, shown below, is automatically derived from the land use groups"></InfoBox>
2020-03-27 10:32:19 -04:00
}
<DataEntry
title={dataFields.current_landuse_order.title}
2020-03-23 19:33:03 -04:00
tooltip={dataFields.current_landuse_order.tooltip}
slug="current_landuse_order"
value={props.building.current_landuse_order}
2020-01-06 14:48:47 -05:00
mode={props.mode}
disabled={true}
copy={props.copy}
onChange={props.onChange}
/>
2019-08-14 17:23:12 -04:00
</Fragment>
2019-11-07 03:13:30 -05:00
);
const UseContainer = withCopyEdit(UseView);
export default UseContainer;