Merge pull request #877 from colouring-cities/team-edits
Team section new fields and renaming some things
This commit is contained in:
commit
324370cf21
@ -351,6 +351,14 @@ export const buildingAttributesConfig = valueType<DataFieldConfig>()({ /* eslint
|
||||
edit: true,
|
||||
verify: true
|
||||
},
|
||||
landowner: {
|
||||
edit: true,
|
||||
verify: true
|
||||
},
|
||||
landowner_source_link: {
|
||||
edit: true,
|
||||
verify: true
|
||||
},
|
||||
designers: {
|
||||
edit: true,
|
||||
verify: true
|
||||
|
@ -107,3 +107,41 @@ export const LogicalDataEntry: React.FC<LogicalDataEntryProps> = (props) => {
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export const LogicalDataEntryYesOnly: React.FC<LogicalDataEntryProps> = (props) => {
|
||||
function handleValueChange(e: React.ChangeEvent<HTMLInputElement>) {
|
||||
props.onChange?.(props.slug, e.target.value === 'true');
|
||||
}
|
||||
|
||||
function handleClear(e: React.MouseEvent<HTMLButtonElement>) {
|
||||
props.onChange?.(props.slug, null);
|
||||
}
|
||||
|
||||
const isDisabled = props.mode === 'view' || props.disabled;
|
||||
|
||||
return (
|
||||
<>
|
||||
<DataTitleCopyable
|
||||
slug={props.slug}
|
||||
title={props.title}
|
||||
tooltip={props.tooltip}
|
||||
disabled={props.disabled || props.value == undefined}
|
||||
copy={props.copy}
|
||||
/>
|
||||
<div className="btn-group btn-group-toggle">
|
||||
<ToggleButton
|
||||
value="true"
|
||||
checked={props.value === true}
|
||||
disabled={isDisabled || props.disallowTrue}
|
||||
checkedClassName='btn-outline-dark active'
|
||||
uncheckedClassName='btn-outline-dark'
|
||||
onChange={handleValueChange}
|
||||
>Yes</ToggleButton>
|
||||
</div>
|
||||
{
|
||||
!isDisabled && props.value != null &&
|
||||
<ClearButton onClick={handleClear} disabled={props.disallowNull}/>
|
||||
}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
@ -5,7 +5,7 @@ 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 { LogicalDataEntry, LogicalDataEntryYesOnly } from '../data-components/logical-data-entry/logical-data-entry';
|
||||
import { DataEntryGroup } from '../data-components/data-entry-group';
|
||||
|
||||
import withCopyEdit from '../data-container';
|
||||
@ -22,6 +22,45 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
|
||||
return (
|
||||
<form>
|
||||
<InfoBox msg="Can you help us capture information on who built the current building?"></InfoBox>
|
||||
<MultiDataEntry
|
||||
title={dataFields.landowner.title}
|
||||
slug="landowner"
|
||||
value={props.building.landowner}
|
||||
mode={props.mode}
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
tooltip={dataFields.landowner.tooltip}
|
||||
placeholder=""
|
||||
editableEntries={true}
|
||||
/>
|
||||
<Verification
|
||||
slug="landowner"
|
||||
allow_verify={props.user !== undefined && props.building.landowner !== null && !props.edited}
|
||||
onVerify={props.onVerify}
|
||||
user_verified={props.user_verified.hasOwnProperty("landowner")}
|
||||
user_verified_as={props.user_verified.landowner}
|
||||
verified_count={props.building.verified.landowner}
|
||||
/>
|
||||
<MultiDataEntry
|
||||
title={dataFields.landowner_source_link.title}
|
||||
slug="landowner_source_link"
|
||||
value={props.building.landowner_source_link}
|
||||
mode={props.mode}
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
tooltip={dataFields.landowner_source_link.tooltip}
|
||||
placeholder="https://..."
|
||||
editableEntries={true}
|
||||
isUrl={true}
|
||||
/>
|
||||
<Verification
|
||||
slug="landowner_source_link"
|
||||
allow_verify={props.user !== undefined && props.building.landowner_source_link !== null && !props.edited}
|
||||
onVerify={props.onVerify}
|
||||
user_verified={props.user_verified.hasOwnProperty("landowner_source_link")}
|
||||
user_verified_as={props.user_verified.landowner_source_link}
|
||||
verified_count={props.building.verified.landowner_source_link}
|
||||
/>
|
||||
<NumericDataEntry
|
||||
slug='date_year'
|
||||
title={dataFields.date_year.title}
|
||||
@ -187,7 +226,7 @@ const TeamView: React.FunctionComponent<CategoryViewProps> = (props) => {
|
||||
user_verified_as={props.user_verified.lead_designer_type}
|
||||
verified_count={props.building.verified.lead_designer_type}
|
||||
/>
|
||||
<LogicalDataEntry
|
||||
<LogicalDataEntryYesOnly
|
||||
slug='designer_awards'
|
||||
title={dataFields.designer_awards.title}
|
||||
tooltip={dataFields.designer_awards.tooltip}
|
||||
|
@ -672,7 +672,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
|
||||
"Community/Cooperative",
|
||||
"Other non-profit body",
|
||||
"Private (individual)",
|
||||
"Private (company/estate)",
|
||||
"Commercial (company/estate)",
|
||||
"Religious body",
|
||||
"Other"
|
||||
]
|
||||
@ -689,6 +689,18 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
|
||||
tooltip: "URL for source for developer(s)",
|
||||
example: ["", "", ""],
|
||||
},
|
||||
landowner: {
|
||||
category: Category.Team,
|
||||
title: "Landowner(s) at time of construction",
|
||||
tooltip: "Free text. First name, space, then Last name",
|
||||
example: ["", "", ""],
|
||||
},
|
||||
landowner_source_link: {
|
||||
category: Category.Team,
|
||||
title: "Source links for landowner(s)",
|
||||
tooltip: "URL for source for landowner(s)",
|
||||
example: ["", "", ""],
|
||||
},
|
||||
designers: {
|
||||
category: Category.Team,
|
||||
title: "Who were the main designer(s)?",
|
||||
@ -710,7 +722,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */
|
||||
"Speculative builder",
|
||||
"Government architecture department",
|
||||
"Architect/ architectural firm",
|
||||
"Engineering firm",
|
||||
"Engineer/ Engineering firm",
|
||||
"Other"
|
||||
]
|
||||
},
|
||||
|
2
migrations/031.landowner.down.sql
Normal file
2
migrations/031.landowner.down.sql
Normal file
@ -0,0 +1,2 @@
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS landowner;
|
||||
ALTER TABLE buildings DROP COLUMN IF EXISTS landowner_source_link;
|
2
migrations/031.landowner.up.sql
Normal file
2
migrations/031.landowner.up.sql
Normal file
@ -0,0 +1,2 @@
|
||||
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS landowner text[];
|
||||
ALTER TABLE buildings ADD COLUMN IF NOT EXISTS landowner_source_link text[];
|
Loading…
Reference in New Issue
Block a user