Merge pull request #832 from colouring-cities/activate-all-verification-buttons

Activate verification buttons for all active fields
This commit is contained in:
Ed Chalstrey 2022-05-26 15:17:56 +01:00 committed by GitHub
commit 5451877ffe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 165 additions and 1 deletions

View File

@ -53,6 +53,7 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
}, },
ref_osm_id: { ref_osm_id: {
edit: true, edit: true,
verify: true,
}, },
location_name: { location_name: {
edit: false, edit: false,
@ -77,9 +78,11 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
}, },
location_latitude: { location_latitude: {
edit: true, edit: true,
verify: true,
}, },
location_longitude: { location_longitude: {
edit: true, edit: true,
verify: true,
}, },
date_year: { date_year: {
edit: true, edit: true,
@ -87,21 +90,26 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
}, },
date_lower: { date_lower: {
edit: true, edit: true,
verify: true,
}, },
date_upper: { date_upper: {
edit: true, edit: true,
verify: true,
}, },
date_source: { date_source: {
edit: true, edit: true,
verify: true,
}, },
date_source_detail: { date_source_detail: {
edit: true, edit: true,
}, },
date_link: { date_link: {
edit: true, edit: true,
verify: true,
}, },
facade_year: { facade_year: {
edit: true, edit: true,
verify: true,
}, },
facade_upper: { facade_upper: {
edit: false, edit: false,
@ -145,12 +153,14 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
}, },
construction_core_material: { construction_core_material: {
edit: true, edit: true,
verify: true,
}, },
construction_secondary_materials: { construction_secondary_materials: {
edit: false, edit: false,
}, },
construction_roof_covering: { construction_roof_covering: {
edit: true, edit: true,
verify: true,
}, },
planning_portal_link: { planning_portal_link: {
edit: true, edit: true,
@ -259,12 +269,14 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
}, },
current_landuse_source: { current_landuse_source: {
edit: true, edit: true,
verify: true,
}, },
current_landuse_source_detail: { current_landuse_source_detail: {
edit: true, edit: true,
}, },
current_landuse_link: { current_landuse_link: {
edit: true, edit: true,
verify: true,
}, },
dynamics_has_demolished_buildings: { dynamics_has_demolished_buildings: {
edit: true, edit: true,
@ -306,7 +318,7 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
}, },
community_public_ownership_sources: { community_public_ownership_sources: {
edit: true, edit: true,
verify: false verify: true
} }
}); });

View File

@ -19,6 +19,19 @@ interface YearDataEntryProps {
user_verified_as: string; user_verified_as: string;
verified_count: number; verified_count: number;
allow_verify: boolean; allow_verify: boolean;
onVerify_upper: (slug: string, verify: boolean, x: number, y: number) => void;
user_verified_upper: boolean;
user_verified_as_upper: string;
verified_count_upper: number;
allow_verify_upper: boolean;
onVerify_lower: (slug: string, verify: boolean, x: number, y: number) => void;
user_verified_lower: boolean;
user_verified_as_lower: string;
verified_count_lower: number;
allow_verify_lower: boolean;
} }
class YearDataEntry extends Component<YearDataEntryProps, any> { class YearDataEntry extends Component<YearDataEntryProps, any> {
@ -73,6 +86,14 @@ class YearDataEntry extends Component<YearDataEntryProps, any> {
max={currentYear} max={currentYear}
tooltip={dataFields.date_lower.tooltip} tooltip={dataFields.date_lower.tooltip}
/> />
<Verification
slug="date_lower"
allow_verify={props.allow_verify_lower}
onVerify={props.onVerify_lower}
user_verified={props.user_verified_lower}
user_verified_as={props.user_verified_as_lower}
verified_count={props.verified_count_lower}
/>
<NumericDataEntry <NumericDataEntry
title={dataFields.date_upper.title} title={dataFields.date_upper.title}
@ -86,6 +107,14 @@ class YearDataEntry extends Component<YearDataEntryProps, any> {
max={currentYear} max={currentYear}
tooltip={dataFields.date_upper.tooltip} tooltip={dataFields.date_upper.tooltip}
/> />
<Verification
slug="date_upper"
allow_verify={props.allow_verify_upper}
onVerify={props.onVerify_upper}
user_verified={props.user_verified_upper}
user_verified_as={props.user_verified_as_upper}
verified_count={props.verified_count_upper}
/>
</Fragment> </Fragment>
); );
} }

View File

@ -246,6 +246,8 @@ const withCopyEdit: (wc: React.ComponentType<CategoryViewProps>) => DataContaine
} catch(err) { } catch(err) {
this.setState({error: err}); this.setState({error: err});
} }
console.log(slug + " verify button clicked")
} }
render() { render() {

View File

@ -35,6 +35,18 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
user_verified={props.user_verified.hasOwnProperty("date_year")} user_verified={props.user_verified.hasOwnProperty("date_year")}
user_verified_as={props.user_verified.date_year} user_verified_as={props.user_verified.date_year}
verified_count={props.building.verified.date_year} verified_count={props.building.verified.date_year}
allow_verify_upper={props.user !== undefined && props.building.date_upper !== null && !props.edited}
onVerify_upper={props.onVerify}
user_verified_upper={props.user_verified.hasOwnProperty("date_upper")}
user_verified_as_upper={props.user_verified.date_upper}
verified_count_upper={props.building.verified.date_upper}
allow_verify_lower={props.user !== undefined && props.building.date_lower !== null && !props.edited}
onVerify_lower={props.onVerify}
user_verified_lower={props.user_verified.hasOwnProperty("date_lower")}
user_verified_as_lower={props.user_verified.date_lower}
verified_count_lower={props.building.verified.date_lower}
/> />
<NumericDataEntry <NumericDataEntry
title={dataFields.facade_year.title} title={dataFields.facade_year.title}
@ -68,6 +80,14 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
placeholder={dataFields.date_source.example} placeholder={dataFields.date_source.example}
options={dataFields.date_source.items} options={dataFields.date_source.items}
/> />
<Verification
slug="date_source"
allow_verify={props.user !== undefined && props.building.date_source !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("date_source")}
user_verified_as={props.user_verified.date_source}
verified_count={props.building.verified.date_source}
/>
</Fragment> </Fragment>
); );
}; };
@ -86,6 +106,18 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
user_verified={props.user_verified.hasOwnProperty("date_year")} user_verified={props.user_verified.hasOwnProperty("date_year")}
user_verified_as={props.user_verified.date_year} user_verified_as={props.user_verified.date_year}
verified_count={props.building.verified.date_year} verified_count={props.building.verified.date_year}
allow_verify_upper={props.user !== undefined && props.building.date_upper !== null && !props.edited}
onVerify_upper={props.onVerify}
user_verified_upper={props.user_verified.hasOwnProperty("date_upper")}
user_verified_as_upper={props.user_verified.date_upper}
verified_count_upper={props.building.verified.date_upper}
allow_verify_lower={props.user !== undefined && props.building.date_lower !== null && !props.edited}
onVerify_lower={props.onVerify}
user_verified_lower={props.user_verified.hasOwnProperty("date_lower")}
user_verified_as_lower={props.user_verified.date_lower}
verified_count_lower={props.building.verified.date_lower}
/> />
<NumericDataEntry <NumericDataEntry
title={dataFields.facade_year.title} title={dataFields.facade_year.title}
@ -119,6 +151,14 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
options={dataFields.date_source.items} options={dataFields.date_source.items}
placeholder={dataFields.date_source.example} placeholder={dataFields.date_source.example}
/> />
<Verification
slug="date_source"
allow_verify={props.user !== undefined && props.building.date_source !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("date_source")}
user_verified_as={props.user_verified.date_source}
verified_count={props.building.verified.date_source}
/>
<MultiDataEntry <MultiDataEntry
title={dataFields.date_link.title} title={dataFields.date_link.title}
slug="date_link" slug="date_link"
@ -130,6 +170,14 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
placeholder="https://..." placeholder="https://..."
editableEntries={true} editableEntries={true}
/> />
<Verification
slug="date_link"
allow_verify={props.user !== undefined && props.building.date_link !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("date_link")}
user_verified_as={props.user_verified.date_link}
verified_count={props.building.verified.date_link}
/>
</Fragment> </Fragment>
); );
}; };

View File

@ -155,6 +155,14 @@ const CommunityView: React.FunctionComponent<CategoryViewProps> = (props) => {
onChange={props.onChange} onChange={props.onChange}
mode={props.mode} mode={props.mode}
/> />
<Verification
slug="community_public_ownership_sources"
allow_verify={props.user !== undefined && props.building.community_public_ownership_sources !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("community_public_ownership_sources")}
user_verified_as={props.user_verified.community_public_ownership_sources}
verified_count={props.building.verified.community_public_ownership_sources}
/>
</> </>
}; };
const CommunityContainer = withCopyEdit(CommunityView); const CommunityContainer = withCopyEdit(CommunityView);

View File

@ -4,6 +4,7 @@ import { dataFields } from '../../config/data-fields-config';
import DataEntry from '../data-components/data-entry'; import DataEntry from '../data-components/data-entry';
import SelectDataEntry from '../data-components/select-data-entry'; import SelectDataEntry from '../data-components/select-data-entry';
import withCopyEdit from '../data-container'; import withCopyEdit from '../data-container';
import Verification from '../data-components/verification';
import { CategoryViewProps } from './category-view-props'; import { CategoryViewProps } from './category-view-props';
@ -45,6 +46,14 @@ const ConstructionView: React.FunctionComponent<CategoryViewProps> = (props) =>
copy={props.copy} copy={props.copy}
onChange={props.onChange} onChange={props.onChange}
/> />
<Verification
slug="construction_core_material"
allow_verify={props.user !== undefined && props.building.construction_core_material !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("construction_core_material")}
user_verified_as={props.user_verified.construction_core_material}
verified_count={props.building.verified.construction_core_material}
/>
<SelectDataEntry <SelectDataEntry
title={dataFields.construction_secondary_materials.title} title={dataFields.construction_secondary_materials.title}
disabled={true} disabled={true}
@ -66,6 +75,14 @@ const ConstructionView: React.FunctionComponent<CategoryViewProps> = (props) =>
copy={props.copy} copy={props.copy}
onChange={props.onChange} onChange={props.onChange}
/> />
<Verification
slug="construction_roof_covering"
allow_verify={props.user !== undefined && props.building.construction_roof_covering !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("construction_roof_covering")}
user_verified_as={props.user_verified.construction_roof_covering}
verified_count={props.building.verified.construction_roof_covering}
/>
<DataEntry <DataEntry
title="Construction system type" title="Construction system type"
slug="" slug=""

View File

@ -127,6 +127,14 @@ const LocationView: React.FunctionComponent<CategoryViewProps> = (props) => (
maxLength={20} maxLength={20}
onChange={props.onChange} onChange={props.onChange}
/> />
<Verification
slug="ref_osm_id"
allow_verify={props.user !== undefined && props.building.ref_osm_id !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("ref_osm_id")}
user_verified_as={props.user_verified.ref_osm_id}
verified_count={props.building.verified.ref_osm_id}
/>
<NumericDataEntry <NumericDataEntry
title={dataFields.location_latitude.title} title={dataFields.location_latitude.title}
slug="location_latitude" slug="location_latitude"
@ -139,6 +147,14 @@ const LocationView: React.FunctionComponent<CategoryViewProps> = (props) => (
placeholder="Latitude, e.g. 51.5467" placeholder="Latitude, e.g. 51.5467"
onChange={props.onChange} onChange={props.onChange}
/> />
<Verification
slug="location_latitude"
allow_verify={props.user !== undefined && props.building.location_latitude !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("location_latitude")}
user_verified_as={props.user_verified.location_latitude}
verified_count={props.building.verified.location_latitude}
/>
<NumericDataEntry <NumericDataEntry
title={dataFields.location_longitude.title} title={dataFields.location_longitude.title}
slug="location_longitude" slug="location_longitude"
@ -151,6 +167,14 @@ const LocationView: React.FunctionComponent<CategoryViewProps> = (props) => (
placeholder="Longitude, e.g. -0.0586" placeholder="Longitude, e.g. -0.0586"
onChange={props.onChange} onChange={props.onChange}
/> />
<Verification
slug="location_longitude"
allow_verify={props.user !== undefined && props.building.location_longitude !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("location_longitude")}
user_verified_as={props.user_verified.location_longitude}
verified_count={props.building.verified.location_longitude}
/>
</Fragment> </Fragment>
); );
const LocationContainer = withCopyEdit(LocationView); const LocationContainer = withCopyEdit(LocationView);

View File

@ -69,6 +69,14 @@ const UseView: React.FunctionComponent<CategoryViewProps> = (props) => {
placeholder={dataFields.date_source.example} placeholder={dataFields.date_source.example}
options={dataFields.current_landuse_source.items} options={dataFields.current_landuse_source.items}
/> />
<Verification
slug="current_landuse_source"
allow_verify={props.user !== undefined && props.building.current_landuse_source !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("current_landuse_source")}
user_verified_as={props.user_verified.current_landuse_source}
verified_count={props.building.verified.current_landuse_source}
/>
</Fragment> </Fragment>
); );
}; };
@ -122,6 +130,14 @@ const UseView: React.FunctionComponent<CategoryViewProps> = (props) => {
placeholder={dataFields.date_source.example} placeholder={dataFields.date_source.example}
options={dataFields.current_landuse_source.items} options={dataFields.current_landuse_source.items}
/> />
<Verification
slug="current_landuse_source"
allow_verify={props.user !== undefined && props.building.current_landuse_source !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("current_landuse_source")}
user_verified_as={props.user_verified.current_landuse_source}
verified_count={props.building.verified.current_landuse_source}
/>
<MultiDataEntry <MultiDataEntry
title={dataFields.current_landuse_link.title} title={dataFields.current_landuse_link.title}
slug="current_landuse_link" slug="current_landuse_link"
@ -133,6 +149,14 @@ const UseView: React.FunctionComponent<CategoryViewProps> = (props) => {
placeholder="https://..." placeholder="https://..."
editableEntries={true} editableEntries={true}
/> />
<Verification
slug="current_landuse_link"
allow_verify={props.user !== undefined && props.building.current_landuse_link !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("current_landuse_link")}
user_verified_as={props.user_verified.current_landuse_link}
verified_count={props.building.verified.current_landuse_link}
/>
</Fragment> </Fragment>
); );
}; };