Merge pull request #834 from colouring-cities/activate-team

Activate team section
This commit is contained in:
Ed Chalstrey 2022-06-10 15:35:40 +01:00 committed by GitHub
commit 3140f575c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 543 additions and 29 deletions

View File

@ -79,6 +79,39 @@
<LineSymbolizer stroke="#888" stroke-width="3.0"/> <LineSymbolizer stroke="#888" stroke-width="3.0"/>
</Rule> </Rule>
</Style> </Style>
<Style name="team">
<Rule>
<Filter>[team_info_count] &gt;= 8</Filter>
<PolygonSymbolizer fill="#994d00" />
</Rule>
<Rule>
<Filter>[team_info_count] &gt;= 6 and [team_info_count] &lt; 8</Filter>
<PolygonSymbolizer fill="#e67300" />
</Rule>
<Rule>
<Filter>[team_info_count] &gt;= 4 and [team_info_count] &lt; 6</Filter>
<PolygonSymbolizer fill="#ff9933" />
</Rule>
<Rule>
<Filter>[team_info_count] &gt;= 2 and [team_info_count] &lt; 4</Filter>
<PolygonSymbolizer fill="#ffbf80" />
</Rule>
<Rule>
<Filter>[team_info_count] &gt; 0 and [team_info_count] &lt; 2</Filter>
<PolygonSymbolizer fill="#ffe6cc" />
</Rule>
<Rule>
<MaxScaleDenominator>17061</MaxScaleDenominator>
<MinScaleDenominator>4264</MinScaleDenominator>
<LineSymbolizer stroke="#888" stroke-width="1.0"/>
</Rule>
<Rule>
<MaxScaleDenominator>4264</MaxScaleDenominator>
<MinScaleDenominator>0</MinScaleDenominator>
<LineSymbolizer stroke="#888" stroke-width="3.0"/>
</Rule>
</Style>
<Style name="size_storeys"> <Style name="size_storeys">
<Rule> <Rule>
<Filter>[size_storeys] &gt;= 40</Filter> <Filter>[size_storeys] &gt;= 40</Filter>

View File

@ -322,6 +322,62 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
community_public_ownership_sources: { community_public_ownership_sources: {
edit: true, edit: true,
verify: true verify: true
},
has_extension: {
edit: true,
verify: true
},
extension_year: {
edit: true,
verify: true
},
developer_type: {
edit: true,
verify: true
},
developer_name: {
edit: true,
verify: true
},
developer_source_link: {
edit: true,
verify: true
},
designers: {
edit: true,
verify: true
},
designers_source_link: {
edit: true,
verify: true
},
lead_designer_type: {
edit: true,
verify: true
},
designer_awards: {
edit: true,
verify: true
},
awards_source_link: {
edit: true,
verify: true
},
builder: {
edit: true,
verify: true
},
builder_source_link: {
edit: true,
verify: true
},
other_team: {
edit: true,
verify: true
},
other_team_source_link: {
edit: true,
verify: true
} }
}); });

View File

@ -1,5 +1,12 @@
import React, { Fragment } from 'react'; import React, { Fragment } from 'react';
import InfoBox from '../../components/info-box'; import InfoBox from '../../components/info-box';
import { dataFields } from '../../config/data-fields-config';
import SelectDataEntry from '../data-components/select-data-entry';
import NumericDataEntry from '../data-components/numeric-data-entry';
import Verification from '../data-components/verification';
import { MultiDataEntry } from '../data-components/multi-data-entry/multi-data-entry';
import { LogicalDataEntry } from '../data-components/logical-data-entry/logical-data-entry';
import { DataEntryGroup } from '../data-components/data-entry-group';
import withCopyEdit from '../data-container'; import withCopyEdit from '../data-container';
@ -8,27 +15,291 @@ import { CategoryViewProps } from './category-view-props';
/** /**
* Team view/edit section * Team view/edit section
*/ */
const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => ( const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
<Fragment> const building = props.building;
<InfoBox msg="This is what we're planning to collect in this section" /> const currentYear = new Date().getFullYear();
<InfoBox msg="Can you help us capture information on who built the current building?"></InfoBox> const currentBuildingConstructionYear = building.date_year || undefined;
<ul> return (
<li>Construction and design team (original building)</li> <form>
{ <InfoBox msg="Can you help us capture information on who built the current building?"></InfoBox>
// "disabled": true, <NumericDataEntry
// "slug": "team_original", slug='date_year'
// "type": "text" title={dataFields.date_year.title}
} value={currentBuildingConstructionYear}
<li>Construction and design team (significant additional works)</li> mode={props.mode}
{ copy={props.copy}
// "disabled": true, onChange={props.onChange}
// "slug": "team_after_original", step={1}
// "type": "text_multi" min={1}
} max={currentYear}
<li>Awards</li> tooltip={dataFields.extension_year.tooltip}
</ul> />
</Fragment> <Verification
); slug="date_year"
allow_verify={props.user !== undefined && props.building.date_year !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("date_year")}
user_verified_as={props.user_verified.date_year}
verified_count={props.building.verified.date_year}
/>
<LogicalDataEntry
title={dataFields.has_extension.title}
slug="has_extension"
value={props.building.has_extension}
mode={props.mode}
onChange={props.onChange}
tooltip={dataFields.has_extension.tooltip}
/>
{props.building.has_extension ? (
<>
<NumericDataEntry
slug='extension_year'
title={dataFields.extension_year.title}
value={props.building.extension_year}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
step={1}
min={1}
max={currentYear}
tooltip={dataFields.extension_year.tooltip_extension}
/>
<Verification
slug="extension_year"
allow_verify={props.user !== undefined && props.building.extension_year !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("extension_year")}
user_verified_as={props.user_verified.extension_year}
verified_count={props.building.verified.extension_year}
/>
</>
) : (null)}
<SelectDataEntry
slug='developer_type'
title={dataFields.developer_type.title}
value={props.building.developer_type}
options={dataFields.developer_type.items}
onChange={props.onChange}
mode={props.mode}
copy={props.copy}
/>
<Verification
slug="developer_type"
allow_verify={props.user !== undefined && props.building.developer_type !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("developer_type")}
user_verified_as={props.user_verified.developer_type}
verified_count={props.building.verified.developer_type}
/>
<MultiDataEntry
title={dataFields.developer_name.title}
slug="developer_name"
value={props.building.developer_name}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.developer_name.tooltip}
placeholder=""
editableEntries={true}
/>
<Verification
slug="developer_name"
allow_verify={props.user !== undefined && props.building.developer_name !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("developer_name")}
user_verified_as={props.user_verified.developer_name}
verified_count={props.building.verified.developer_name}
/>
<MultiDataEntry
title={dataFields.developer_source_link.title}
slug="developer_source_link"
value={props.building.developer_source_link}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.developer_source_link.tooltip}
placeholder="https://..."
editableEntries={true}
/>
<Verification
slug="developer_source_link"
allow_verify={props.user !== undefined && props.building.developer_source_link !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("developer_source_link")}
user_verified_as={props.user_verified.developer_source_link}
verified_count={props.building.verified.developer_source_link}
/>
<MultiDataEntry
title={dataFields.designers.title}
slug="designers"
value={props.building.designers}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.designers.tooltip}
placeholder=""
editableEntries={true}
/>
<Verification
slug="designers"
allow_verify={props.user !== undefined && props.building.designers !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("designers")}
user_verified_as={props.user_verified.designers}
verified_count={props.building.verified.designers}
/>
<MultiDataEntry
title={dataFields.designers_source_link.title}
slug="designers_source_link"
value={props.building.designers_source_link}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.designers_source_link.tooltip}
placeholder="https://..."
editableEntries={true}
/>
<Verification
slug="designers_source_link"
allow_verify={props.user !== undefined && props.building.designers_source_link !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("designers_source_link")}
user_verified_as={props.user_verified.designers_source_link}
verified_count={props.building.verified.designers_source_link}
/>
<SelectDataEntry
slug='lead_designer_type'
title={dataFields.lead_designer_type.title}
value={props.building.lead_designer_type}
options={dataFields.lead_designer_type.items}
onChange={props.onChange}
mode={props.mode}
copy={props.copy}
/>
<Verification
slug="lead_designer_type"
allow_verify={props.user !== undefined && props.building.lead_designer_type !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("lead_designer_type")}
user_verified_as={props.user_verified.lead_designer_type}
verified_count={props.building.verified.lead_designer_type}
/>
<LogicalDataEntry
slug='designer_awards'
title={dataFields.designer_awards.title}
tooltip={dataFields.designer_awards.tooltip}
value={props.building.designer_awards}
onChange={props.onChange}
mode={props.mode}
/>
<Verification
slug="designer_awards"
allow_verify={props.user !== undefined && props.building.designer_awards !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("designer_awards")}
user_verified_as={props.user_verified.designer_awards}
verified_count={props.building.verified.designer_awards}
/>
{props.building.designer_awards ? (
<>
<MultiDataEntry
title={dataFields.awards_source_link.title}
slug="awards_source_link"
value={props.building.awards_source_link}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
tooltip={dataFields.awards_source_link.tooltip}
placeholder="https://..."
editableEntries={true}
/>
<Verification
slug="awards_source_link"
allow_verify={props.user !== undefined && props.building.awards_source_link !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("awards_source_link")}
user_verified_as={props.user_verified.awards_source_link}
verified_count={props.building.verified.awards_source_link}
/>
</>
) : (null)
}
<MultiDataEntry
title={dataFields.builder.title}
slug="builder"
value={props.building.builder}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
placeholder=""
editableEntries={true}
/>
<Verification
slug="builder"
allow_verify={props.user !== undefined && props.building.builder !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("builder")}
user_verified_as={props.user_verified.builder}
verified_count={props.building.verified.builder}
/>
<MultiDataEntry
title={dataFields.builder_source_link.title}
slug="builder_source_link"
value={props.building.builder_source_link}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
placeholder="https://..."
editableEntries={true}
/>
<Verification
slug="builder_source_link"
allow_verify={props.user !== undefined && props.building.builder_source_link !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("builder_source_link")}
user_verified_as={props.user_verified.builder_source_link}
verified_count={props.building.verified.builder_source_link}
/>
<MultiDataEntry
title={dataFields.other_team.title}
slug="other_team"
value={props.building.other_team}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
placeholder=""
editableEntries={true}
/>
<Verification
slug="other_team"
allow_verify={props.user !== undefined && props.building.other_team !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("other_team")}
user_verified_as={props.user_verified.other_team}
verified_count={props.building.verified.other_team}
/>
<MultiDataEntry
title={dataFields.other_team_source_link.title}
slug="other_team_source_link"
value={props.building.other_team_source_link}
mode={props.mode}
copy={props.copy}
onChange={props.onChange}
placeholder="https://..."
editableEntries={true}
/>
<Verification
slug="other_team_source_link"
allow_verify={props.user !== undefined && props.building.other_team_source_link !== null && !props.edited}
onVerify={props.onVerify}
user_verified={props.user_verified.hasOwnProperty("other_team_source_link")}
user_verified_as={props.user_verified.other_team_source_link}
verified_count={props.building.verified.other_team_source_link}
/>
</form>
);
};
const TeamContainer = withCopyEdit(TeamView); const TeamContainer = withCopyEdit(TeamView);
export default TeamContainer; export default TeamContainer;

View File

@ -66,7 +66,7 @@ const UseView: React.FunctionComponent<CategoryViewProps> = (props) => {
copy={props.copy} copy={props.copy}
onChange={props.onChange} onChange={props.onChange}
tooltip={dataFields.current_landuse_source.tooltip} tooltip={dataFields.current_landuse_source.tooltip}
placeholder={dataFields.date_source.example} placeholder={dataFields.current_landuse_source.example}
options={dataFields.current_landuse_source.items} options={dataFields.current_landuse_source.items}
/> />
<Verification <Verification
@ -127,7 +127,7 @@ const UseView: React.FunctionComponent<CategoryViewProps> = (props) => {
copy={props.copy} copy={props.copy}
onChange={props.onChange} onChange={props.onChange}
tooltip={dataFields.current_landuse_source.tooltip} tooltip={dataFields.current_landuse_source.tooltip}
placeholder={dataFields.date_source.example} placeholder={dataFields.current_landuse_source.example}
options={dataFields.current_landuse_source.items} options={dataFields.current_landuse_source.items}
/> />
<Verification <Verification

View File

@ -59,11 +59,10 @@ export const categoriesConfig: {[key in Category]: CategoryDefinition} = {
intro: 'How big are buildings?', intro: 'How big are buildings?',
}, },
[Category.Team]: { [Category.Team]: {
inactive: true,
slug: 'team', slug: 'team',
name: 'Team', name: 'Team',
aboutUrl: 'https://pages.colouring.london/team', aboutUrl: 'https://pages.colouring.london/team',
intro: 'Who built the buildings? Coming soon…', intro: 'Who built the buildings?',
}, },
[Category.Construction]: { [Category.Construction]: {
slug: 'construction', slug: 'construction',

View File

@ -64,10 +64,17 @@ export const categoryMapsConfig: {[key in Category]: CategoryMapDefinition[]} =
}, },
}], }],
[Category.Team]: [{ [Category.Team]: [{
mapStyle: undefined, mapStyle: 'team',
legend: { legend: {
title: 'Team', title: 'Team',
elements: [] description: '% data collected',
elements: [
{ color: '#994d00', text: '≥80%' },
{ color: '#e67300', text: '6080%' },
{ color: '#ff9933', text: '4060%' },
{ color: '#ffbf80', text: '2040%' },
{ color: '#ffe6cc', text: '<20%' }
]
}, },
}], }],
[Category.Construction]: [{ [Category.Construction]: [{

View File

@ -636,7 +636,104 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
year_demolished: { min: 1993, max: 1994 }, year_demolished: { min: 1993, max: 1994 },
lifespan: "2-5", overlap_present: "50%", links: ["", ""]} lifespan: "2-5", overlap_present: "50%", links: ["", ""]}
] ]
} },
has_extension: {
category: Category.Team,
title: "Is there an extension?",
tooltip: "",
example: false
},
extension_year: {
category: Category.Team,
title: "Year extension built (best estimate)",
tooltip: "This field is the same as 'Year built (best estimate)' in the Age category'",
tooltip_extension: "This should be the year the extension was built, not the original building",
example: 2020
},
developer_type: {
category: Category.Team,
title: "What type of developer built the building?",
example: "",
items: [
"State",
"Charity",
"Community/Cooperative",
"Other non-profit body",
"Private (individual)",
"Private (company/estate)",
"Religious body",
"Other"
]
},
developer_name: {
category: Category.Team,
title: "Who were the developer(s)?",
tooltip: "Free text. First name, space, then Last name",
example: ["", "", ""],
},
developer_source_link: {
category: Category.Team,
title: "Source links for developer(s)",
tooltip: "URL for source for developer(s)",
example: ["", "", ""],
},
designers: {
category: Category.Team,
title: "Who were the main designer(s)?",
tooltip: "Free text. First name, space, then Last name",
example: ["", "", ""],
},
designers_source_link: {
category: Category.Team,
title: "Source links for designer(s)",
tooltip: "URL for source for designer(s)",
example: ["", "", ""],
},
lead_designer_type: {
category: Category.Team,
title: "Which best describes the lead designer?",
example: "",
items: [
"Landowner",
"Speculative builder",
"Government architecture department",
"Architect/ architectural firm",
"Engineering firm",
"Other"
]
},
designer_awards: {
category: Category.Team,
title: "Did the design team win any awards for this building?",
tooltip: "",
example: false
},
awards_source_link: {
category: Category.Team,
title: "Source links for designer award(s)",
tooltip: "URL for source for designer award(s)",
example: ["", "", ""],
},
builder: {
category: Category.Team,
title: "Name of builder/ construction team",
example: ["", "", ""],
},
builder_source_link: {
category: Category.Team,
title: "Source builder/ construction team",
example: ["", "", ""],
},
other_team: {
category: Category.Team,
title: "Other significant members of the team",
example: ["", "", ""],
},
other_team_source_link: {
category: Category.Team,
title: "Source other significant team members",
example: ["", "", ""],
},
}; };
export const allFieldsConfig = {...dataFields, ...buildingUserFields}; export const allFieldsConfig = {...dataFields, ...buildingUserFields};

View File

@ -14,7 +14,8 @@ export type BuildingMapTileset = 'date_year' |
'sust_dec' | 'sust_dec' |
'building_attachment_form' | 'building_attachment_form' |
'landuse' | 'landuse' |
'dynamics_demolished_count'; 'dynamics_demolished_count' |
'team';
export type SpecialMapTileset = 'base_light' | 'base_night' | 'highlight' | 'number_labels'; export type SpecialMapTileset = 'base_light' | 'base_night' | 'highlight' | 'number_labels';

View File

@ -76,6 +76,28 @@ const LAYER_QUERIES = {
) AS location_info_count ) AS location_info_count
FROM FROM
buildings`, buildings`,
team: `
SELECT
geometry_id,
(
case when has_extension IS NULL then 0 else 1 end +
case when extension_year IS NULL then 0 else 1 end +
case when developer_type IS NULL then 0 else 1 end +
case when developer_name IS NULL then 0 else 1 end +
case when developer_source_link IS NULL then 0 else 1 end +
case when designers IS NULL then 0 else 1 end +
case when designers_source_link IS NULL then 0 else 1 end +
case when lead_designer_type IS NULL then 0 else 1 end +
case when designer_awards IS NULL then 0 else 1 end +
case when awards_source_link IS NULL then 0 else 1 end +
case when builder IS NULL then 0 else 1 end +
case when builder_source_link IS NULL then 0 else 1 end +
case when other_team IS NULL then 0 else 1 end +
case when other_team_source_link IS NULL then 0 else 1 end +
case when date_year IS NULL then 0 else 1 end
) AS team_info_count
FROM
buildings`,
likes: ` likes: `
SELECT SELECT
geometry_id, geometry_id,

View File

@ -0,0 +1,14 @@
ALTER TABLE buildings DROP COLUMN IF EXISTS has_extension;
ALTER TABLE buildings DROP COLUMN IF EXISTS extension_year;
ALTER TABLE buildings DROP COLUMN IF EXISTS developer_type;
ALTER TABLE buildings DROP COLUMN IF EXISTS developer_name;
ALTER TABLE buildings DROP COLUMN IF EXISTS developer_source_link;
ALTER TABLE buildings DROP COLUMN IF EXISTS designers;
ALTER TABLE buildings DROP COLUMN IF EXISTS designers_source_link;
ALTER TABLE buildings DROP COLUMN IF EXISTS lead_designer_type;
ALTER TABLE buildings DROP COLUMN IF EXISTS designer_awards;
ALTER TABLE buildings DROP COLUMN IF EXISTS awards_source_link;
ALTER TABLE buildings DROP COLUMN IF EXISTS builder;
ALTER TABLE buildings DROP COLUMN IF EXISTS builder_source_link;
ALTER TABLE buildings DROP COLUMN IF EXISTS other_team;
ALTER TABLE buildings DROP COLUMN IF EXISTS other_team_source_link;

View File

@ -0,0 +1,14 @@
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS has_extension boolean null;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS extension_year smallint;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS developer_type varchar;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS developer_name text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS developer_source_link text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS designers text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS designers_source_link text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS lead_designer_type varchar;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS designer_awards boolean null;
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS awards_source_link text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS builder text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS builder_source_link text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS other_team text[];
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS other_team_source_link text[];