From fd1429e2da7b93a9f34f59b6eaf206a5102157da Mon Sep 17 00:00:00 2001 From: Mike Simpson Date: Wed, 28 Jun 2023 16:40:45 +0100 Subject: [PATCH] Disable free-text boxes on Team category Edit Multi Data Entry to display something when editing and the box is disabled when it has no data. --- .../multi-data-entry/multi-data-entry.tsx | 142 +++++++++--------- .../building/data-containers/team.tsx | 5 +- app/src/frontend/config/data-fields-config.ts | 6 +- 3 files changed, 81 insertions(+), 72 deletions(-) diff --git a/app/src/frontend/building/data-components/multi-data-entry/multi-data-entry.tsx b/app/src/frontend/building/data-components/multi-data-entry/multi-data-entry.tsx index 318debf1..6c1565c6 100644 --- a/app/src/frontend/building/data-components/multi-data-entry/multi-data-entry.tsx +++ b/app/src/frontend/building/data-components/multi-data-entry/multi-data-entry.tsx @@ -69,83 +69,89 @@ export const MultiDataEntry: React.FC = ({ copy={copyable ? props.copy : undefined} />
+ { + values.length === 0 && !isEditing && +
+ +
+ } +
    { - values.length === 0 && !isEditing && + isEditing && isDisabled && values.length === 0 &&
    } -
      - { - values.map((val, i) => ( -
    • - edit(i, val)} + { + values.map((val, i) => ( +
    • + edit(i, val)} - maxLength={props.maxLength} - isUrl={props.isUrl} - valueTransform={props.valueTransform} + maxLength={props.maxLength} + isUrl={props.isUrl} + valueTransform={props.valueTransform} - autofill={props.autofill} - showAllOptionsOnEmpty={props.showAllOptionsOnEmpty} - /> - { - !isDisabled && -
      - -
      - } -
    • - )) - } - { - !isDisabled && -
    • - setNewValue(val)} - onConfirm={(_key, val) => addNew(val)} + autofill={props.autofill} + showAllOptionsOnEmpty={props.showAllOptionsOnEmpty} + /> + { + !isDisabled && +
      + +
      + } +
    • + )) + } + { + !isDisabled && +
    • + setNewValue(val)} + onConfirm={(_key, val) => addNew(val)} - maxLength={props.maxLength} - placeholder={props.placeholder} - isUrl={props.isUrl} - valueTransform={props.valueTransform} - confirmOnEnter={confirmOnEnter} + maxLength={props.maxLength} + placeholder={props.placeholder} + isUrl={props.isUrl} + valueTransform={props.valueTransform} + confirmOnEnter={confirmOnEnter} - autofill={props.autofill} - showAllOptionsOnEmpty={props.showAllOptionsOnEmpty} - confirmOnAutofillSelect={true} - /> - { - newValue != undefined && - <> -
      - -
      -
      - -
      - - } -
    • + autofill={props.autofill} + showAllOptionsOnEmpty={props.showAllOptionsOnEmpty} + confirmOnAutofillSelect={true} + /> + { + newValue != undefined && + <> +
      + +
      +
      + +
      + + } + }
diff --git a/app/src/frontend/building/data-containers/team.tsx b/app/src/frontend/building/data-containers/team.tsx index 4cd78237..cf9773ef 100644 --- a/app/src/frontend/building/data-containers/team.tsx +++ b/app/src/frontend/building/data-containers/team.tsx @@ -146,6 +146,7 @@ const TeamView: React.FunctionComponent = (props) => { tooltip={dataFields.landowner.tooltip} placeholder="" editableEntries={true} + disabled={true} /> = (props) => { tooltip={dataFields.developer_name.tooltip} placeholder="" editableEntries={true} + disabled={true} /> = (props) => { tooltip={dataFields.designers.tooltip} placeholder="" editableEntries={true} + disabled={true} /> = (props) => { user_verified_as={props.user_verified.designers} verified_count={props.building.verified.designers} /> - = (props) => { onChange={props.onChange} placeholder="" editableEntries={true} + disabled={true} /> For info on current land ownership, see 'Planning Controls'.", + tooltip: "Land owner when the building was constructed.

Free-text entry disabled for security reasons.

For info on current land ownership, see 'Planning Controls'.", example: ["", "", ""], }, landowner_source_type: { @@ -988,7 +988,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ designers: { category: Category.Team, title: "Who were the main designer(s)?", - tooltip: "Free text. First name, space, then Last name", + tooltip: "First name, space, then Last name.

Free-text entry disabled for security reasons.", example: ["", "", ""], }, designers_source_type: { @@ -1031,7 +1031,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ }, builder: { category: Category.Team, - title: "Name of builder/construction team", + title: "Name of builder/construction team.

Free-text entry disabled for security reasons.", example: ["", "", ""], }, builder_source_type: {