Add standard source types (below historical ones)

#1193
This commit is contained in:
Mike Simpson 2023-07-14 14:30:50 +01:00
parent 85b0821490
commit 8cab9bbe2c
4 changed files with 59 additions and 4 deletions

View File

@ -134,6 +134,14 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
edit: true, edit: true,
verify: true, verify: true,
}, },
date_source_type: {
edit: true,
verify: true,
},
date_source_links: {
edit: true,
verify: true,
},
facade_year: { facade_year: {
edit: true, edit: true,
verify: true, verify: true,

View File

@ -103,6 +103,7 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
user_verified_as={props.user_verified.facade_year} user_verified_as={props.user_verified.facade_year}
verified_count={props.building.verified.facade_year} verified_count={props.building.verified.facade_year}
/> />
<hr/>
<SelectDataEntry <SelectDataEntry
title={dataFields.date_source.title} title={dataFields.date_source.title}
slug="date_source" slug="date_source"
@ -132,13 +133,43 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
/> />
</> </>
} }
<DataEntry <hr/>
<SelectDataEntry
title={dataFields.date_source_type.title}
slug="date_source_type"
value={props.building.date_source_type}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.date_source_type.tooltip}
options={dataFields.date_source_type.items}
placeholder={dataFields.date_source_type.example}
/>
{(props.building.date_source_type == dataFields.date_source_type.items[0] ||
props.building.date_source_type == dataFields.date_source_type.items[1] ||
props.building.date_source_type == null) ? <></> :
<>
<MultiDataEntry
title={dataFields.date_source_links.title}
slug="date_source_links"
value={props.building.date_source_links}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.date_source_links.tooltip}
placeholder="https://..."
editableEntries={true}
isUrl={true}
/>
</>
}
{/*<DataEntry
title="Year of completion (best estimate)" title="Year of completion (best estimate)"
slug="" slug=""
value="" value=""
mode='view' mode='view'
tooltip='Coming Soon' tooltip='Coming Soon'
/> />*/}
</DataEntryGroup> </DataEntryGroup>
<DataEntryGroup name="Cladding, extensions and retrofits"> <DataEntryGroup name="Cladding, extensions and retrofits">
<NumericDataEntry <NumericDataEntry

View File

@ -362,7 +362,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
}, },
date_source: { date_source: {
category: Category.Age, category: Category.Age,
title: "Source type", title: "Historical source type",
tooltip: "Source type for the building dates above", tooltip: "Source type for the building dates above",
items: [ items: [
"Expert knowledge of building", "Expert knowledge of building",
@ -389,6 +389,19 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
example: "", example: "",
}, },
date_link: { date_link: {
category: Category.Age,
title: "Historical source link(s)",
tooltip: "URL for age and date reference",
example: ["", "", ""],
},
date_source_type: {
category: Category.Age,
title: "Source type",
tooltip: "Source type for the building dates above",
items: commonSourceTypes,
example: "",
},
date_source_links: {
category: Category.Age, category: Category.Age,
title: "Source link(s)", title: "Source link(s)",
tooltip: "URL for age and date reference", tooltip: "URL for age and date reference",

View File

@ -17,4 +17,7 @@ ALTER TABLE buildings ADD COLUMN IF NOT EXISTS energy_green_roof_source_links te
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_crowdsourced_site_completion_source_type text; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_crowdsourced_site_completion_source_type text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_crowdsourced_site_completion_source_links text[]; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_crowdsourced_site_completion_source_links text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_missing_data boolean; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_missing_data boolean;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_missing_data_links text[]; ALTER TABLE buildings ADD COLUMN IF NOT EXISTS planning_missing_data_links text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS date_source_type text;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS date_source_links text[];