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

View File

@ -19,6 +19,19 @@ interface YearDataEntryProps {
user_verified_as: string;
verified_count: number;
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> {
@ -73,6 +86,14 @@ class YearDataEntry extends Component<YearDataEntryProps, any> {
max={currentYear}
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
title={dataFields.date_upper.title}
@ -85,6 +106,14 @@ class YearDataEntry extends Component<YearDataEntryProps, any> {
min={1}
max={currentYear}
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>
);

View File

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

View File

@ -35,6 +35,18 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
user_verified={props.user_verified.hasOwnProperty("date_year")}
user_verified_as={props.user_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
title={dataFields.facade_year.title}
@ -68,6 +80,14 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
placeholder={dataFields.date_source.example}
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>
);
};
@ -86,6 +106,18 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
user_verified={props.user_verified.hasOwnProperty("date_year")}
user_verified_as={props.user_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
title={dataFields.facade_year.title}
@ -119,6 +151,14 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
options={dataFields.date_source.items}
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
title={dataFields.date_link.title}
slug="date_link"
@ -130,6 +170,14 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
placeholder="https://..."
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>
);
};

View File

@ -155,6 +155,14 @@ const CommunityView: React.FunctionComponent<CategoryViewProps> = (props) => {
onChange={props.onChange}
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);

View File

@ -4,6 +4,7 @@ import { dataFields } from '../../config/data-fields-config';
import DataEntry from '../data-components/data-entry';
import SelectDataEntry from '../data-components/select-data-entry';
import withCopyEdit from '../data-container';
import Verification from '../data-components/verification';
import { CategoryViewProps } from './category-view-props';
@ -45,6 +46,14 @@ const ConstructionView: React.FunctionComponent<CategoryViewProps> = (props) =>
copy={props.copy}
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
title={dataFields.construction_secondary_materials.title}
disabled={true}
@ -66,6 +75,14 @@ const ConstructionView: React.FunctionComponent<CategoryViewProps> = (props) =>
copy={props.copy}
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
title="Construction system type"
slug=""

View File

@ -127,6 +127,14 @@ const LocationView: React.FunctionComponent<CategoryViewProps> = (props) => (
maxLength={20}
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
title={dataFields.location_latitude.title}
slug="location_latitude"
@ -139,6 +147,14 @@ const LocationView: React.FunctionComponent<CategoryViewProps> = (props) => (
placeholder="Latitude, e.g. 51.5467"
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
title={dataFields.location_longitude.title}
slug="location_longitude"
@ -151,6 +167,14 @@ const LocationView: React.FunctionComponent<CategoryViewProps> = (props) => (
placeholder="Longitude, e.g. -0.0586"
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>
);
const LocationContainer = withCopyEdit(LocationView);

View File

@ -69,6 +69,14 @@ const UseView: React.FunctionComponent<CategoryViewProps> = (props) => {
placeholder={dataFields.date_source.example}
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>
);
};
@ -122,6 +130,14 @@ const UseView: React.FunctionComponent<CategoryViewProps> = (props) => {
placeholder={dataFields.date_source.example}
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
title={dataFields.current_landuse_link.title}
slug="current_landuse_link"
@ -133,6 +149,14 @@ const UseView: React.FunctionComponent<CategoryViewProps> = (props) => {
placeholder="https://..."
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>
);
};