From 394266cf2cfce5da97640f9d3fe27a644c74f463 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Thu, 12 May 2022 15:17:00 +0100 Subject: [PATCH 01/15] get deafult value for date_source --- .../frontend/building/data-containers/age.tsx | 17 +---------------- app/src/frontend/config/data-fields-config.ts | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/app/src/frontend/building/data-containers/age.tsx b/app/src/frontend/building/data-containers/age.tsx index 7175d54d..4caf5bd9 100644 --- a/app/src/frontend/building/data-containers/age.tsx +++ b/app/src/frontend/building/data-containers/age.tsx @@ -63,22 +63,7 @@ const AgeView: React.FunctionComponent = (props) => { onChange={props.onChange} tooltip={dataFields.date_source.tooltip} placeholder="" - options={[ - "Expert knowledge of building", - "Expert estimate from image", - "Survey of London", - "Pevsner Guides", - "Victoria County History", - "Local history publication", - "Other publication", - "National Heritage List for England", - "Other database or gazetteer", - "Historical map", - "Other archive document", - "Film/Video", - "Other website", - "Other" - ]} + options={dataFields.date_source.items} /> Date: Thu, 12 May 2022 15:48:19 +0100 Subject: [PATCH 02/15] Merge branch 'source-details-edits-2' into source-details-edits-3 --- .../frontend/building/data-containers/age.tsx | 60 ++++++++++++++++--- 1 file changed, 51 insertions(+), 9 deletions(-) diff --git a/app/src/frontend/building/data-containers/age.tsx b/app/src/frontend/building/data-containers/age.tsx index 4caf5bd9..d493d61f 100644 --- a/app/src/frontend/building/data-containers/age.tsx +++ b/app/src/frontend/building/data-containers/age.tsx @@ -16,7 +16,58 @@ import { CategoryViewProps } from './category-view-props'; */ const AgeView: React.FunctionComponent = (props) => { const currentYear = new Date().getFullYear(); + if (props.building.date_source == "Expert knowledge of building" || "Expert estimate from image"){ + return ( + + + + + + + + ); + }; return ( = (props) => { placeholder="" options={dataFields.date_source.items} /> - Date: Thu, 12 May 2022 15:53:15 +0100 Subject: [PATCH 03/15] pre-populate with example --- app/src/frontend/building/data-containers/age.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/frontend/building/data-containers/age.tsx b/app/src/frontend/building/data-containers/age.tsx index d493d61f..8e247183 100644 --- a/app/src/frontend/building/data-containers/age.tsx +++ b/app/src/frontend/building/data-containers/age.tsx @@ -115,6 +115,7 @@ const AgeView: React.FunctionComponent = (props) => { tooltip={dataFields.date_source.tooltip} placeholder="" options={dataFields.date_source.items} + placeholder={dataFields.date_source.example} /> Date: Thu, 12 May 2022 15:56:31 +0100 Subject: [PATCH 04/15] fix duplicate attributes same name --- app/src/frontend/building/data-containers/age.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/frontend/building/data-containers/age.tsx b/app/src/frontend/building/data-containers/age.tsx index 8e247183..0303acb6 100644 --- a/app/src/frontend/building/data-containers/age.tsx +++ b/app/src/frontend/building/data-containers/age.tsx @@ -113,7 +113,6 @@ const AgeView: React.FunctionComponent = (props) => { copy={props.copy} onChange={props.onChange} tooltip={dataFields.date_source.tooltip} - placeholder="" options={dataFields.date_source.items} placeholder={dataFields.date_source.example} /> From 8bc77b38b3a99c54e7075b6e18954293105613d2 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Thu, 12 May 2022 15:57:46 +0100 Subject: [PATCH 05/15] fix if statement --- app/src/frontend/building/data-containers/age.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/frontend/building/data-containers/age.tsx b/app/src/frontend/building/data-containers/age.tsx index 0303acb6..f0fd429f 100644 --- a/app/src/frontend/building/data-containers/age.tsx +++ b/app/src/frontend/building/data-containers/age.tsx @@ -16,7 +16,7 @@ import { CategoryViewProps } from './category-view-props'; */ const AgeView: React.FunctionComponent = (props) => { const currentYear = new Date().getFullYear(); - if (props.building.date_source == "Expert knowledge of building" || "Expert estimate from image"){ + if (props.building.date_source == "Expert knowledge of building" || props.building.date_source == "Expert estimate from image"){ return ( Date: Thu, 12 May 2022 16:09:17 +0100 Subject: [PATCH 06/15] make default dataFields.date_source.example "N/A" --- app/src/frontend/config/data-fields-config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/frontend/config/data-fields-config.ts b/app/src/frontend/config/data-fields-config.ts index 450570ad..e6a827ce 100644 --- a/app/src/frontend/config/data-fields-config.ts +++ b/app/src/frontend/config/data-fields-config.ts @@ -285,7 +285,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ "Other website", "Other" ], - example: "Expert knowledge of building", + example: "N/A", }, date_source_detail: { category: Category.Age, From 121437d5cc7294ff29bf8b314940711efed97c83 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Thu, 12 May 2022 16:13:06 +0100 Subject: [PATCH 07/15] make link not appear for N/A --- app/src/frontend/building/data-containers/age.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/frontend/building/data-containers/age.tsx b/app/src/frontend/building/data-containers/age.tsx index f0fd429f..efd58a95 100644 --- a/app/src/frontend/building/data-containers/age.tsx +++ b/app/src/frontend/building/data-containers/age.tsx @@ -16,7 +16,10 @@ import { CategoryViewProps } from './category-view-props'; */ const AgeView: React.FunctionComponent = (props) => { const currentYear = new Date().getFullYear(); - if (props.building.date_source == "Expert knowledge of building" || props.building.date_source == "Expert estimate from image"){ + if (props.building.date_source == "Expert knowledge of building" || + props.building.date_source == "Expert estimate from image" || + props.building.date_source == "N/A" + ){ return ( Date: Thu, 12 May 2022 16:13:29 +0100 Subject: [PATCH 08/15] switch N/A for blank --- app/src/frontend/building/data-containers/age.tsx | 2 +- app/src/frontend/config/data-fields-config.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/frontend/building/data-containers/age.tsx b/app/src/frontend/building/data-containers/age.tsx index efd58a95..914f059b 100644 --- a/app/src/frontend/building/data-containers/age.tsx +++ b/app/src/frontend/building/data-containers/age.tsx @@ -18,7 +18,7 @@ const AgeView: React.FunctionComponent = (props) => { const currentYear = new Date().getFullYear(); if (props.building.date_source == "Expert knowledge of building" || props.building.date_source == "Expert estimate from image" || - props.building.date_source == "N/A" + props.building.date_source == "" ){ return ( diff --git a/app/src/frontend/config/data-fields-config.ts b/app/src/frontend/config/data-fields-config.ts index e6a827ce..cf90d551 100644 --- a/app/src/frontend/config/data-fields-config.ts +++ b/app/src/frontend/config/data-fields-config.ts @@ -285,7 +285,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ "Other website", "Other" ], - example: "N/A", + example: "", }, date_source_detail: { category: Category.Age, From dbf747d3661249f28d99a841fc16c46be5846316 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Thu, 12 May 2022 16:17:57 +0100 Subject: [PATCH 09/15] turn off link box whe null --- app/src/frontend/building/data-containers/age.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/frontend/building/data-containers/age.tsx b/app/src/frontend/building/data-containers/age.tsx index 914f059b..fb50f751 100644 --- a/app/src/frontend/building/data-containers/age.tsx +++ b/app/src/frontend/building/data-containers/age.tsx @@ -18,7 +18,7 @@ const AgeView: React.FunctionComponent = (props) => { const currentYear = new Date().getFullYear(); if (props.building.date_source == "Expert knowledge of building" || props.building.date_source == "Expert estimate from image" || - props.building.date_source == "" + props.building.date_source == null ){ return ( From 694335cf3b3ccd78e233c84783be60e450c78fc9 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Thu, 12 May 2022 16:19:03 +0100 Subject: [PATCH 10/15] revert pointless placeholder changes --- app/src/frontend/building/data-containers/age.tsx | 2 +- app/src/frontend/config/data-fields-config.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/frontend/building/data-containers/age.tsx b/app/src/frontend/building/data-containers/age.tsx index fb50f751..132513c3 100644 --- a/app/src/frontend/building/data-containers/age.tsx +++ b/app/src/frontend/building/data-containers/age.tsx @@ -116,8 +116,8 @@ const AgeView: React.FunctionComponent = (props) => { copy={props.copy} onChange={props.onChange} tooltip={dataFields.date_source.tooltip} + placeholder="" options={dataFields.date_source.items} - placeholder={dataFields.date_source.example} /> Date: Thu, 12 May 2022 16:30:55 +0100 Subject: [PATCH 11/15] set up current_landuse_source like date_source --- .../frontend/building/data-containers/use.tsx | 189 +++++++++++------- app/src/frontend/config/data-fields-config.ts | 9 + 2 files changed, 129 insertions(+), 69 deletions(-) diff --git a/app/src/frontend/building/data-containers/use.tsx b/app/src/frontend/building/data-containers/use.tsx index 04090357..8535767c 100644 --- a/app/src/frontend/building/data-containers/use.tsx +++ b/app/src/frontend/building/data-containers/use.tsx @@ -14,77 +14,128 @@ import Verification from '../data-components/verification'; /** * Use view/edit section */ -const UseView: React.FunctionComponent = (props) => ( - - - - = (props) => { + if (props.building.current_landuse_source == "Expert/personal knowledge of building" || + props.building.current_landuse_source == "Online streetview image" || + props.building.current_landuse_source == null + ){ + return ( + + + + + { + props.mode != 'view' && + + } + + + + ); + }; + return ( + + + - { - props.mode != 'view' && - - } - - + { + props.mode != 'view' && + + } + - - -); + + + + ); +}; const UseContainer = withCopyEdit(UseView); export default UseContainer; diff --git a/app/src/frontend/config/data-fields-config.ts b/app/src/frontend/config/data-fields-config.ts index 83c9cc79..a77998c1 100644 --- a/app/src/frontend/config/data-fields-config.ts +++ b/app/src/frontend/config/data-fields-config.ts @@ -198,6 +198,15 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ title: "Source of information", tooltip: "Source for the current land use", example: "", + items: [ + "Expert/personal knowledge of building", + "Online streetview image", + "Open planning authority dataset", + "Open property tax dataset", + "Open housing dataset", + "Open address dataset", + "Other" + ], }, current_landuse_source_detail: { category: Category.LandUse, From 8bfcf2349d447fd4a7e479e006ea910a9f443fb9 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Thu, 12 May 2022 16:34:16 +0100 Subject: [PATCH 12/15] Revert "revert pointless placeholder changes" This reverts commit 694335cf3b3ccd78e233c84783be60e450c78fc9. --- app/src/frontend/building/data-containers/age.tsx | 2 +- app/src/frontend/config/data-fields-config.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/frontend/building/data-containers/age.tsx b/app/src/frontend/building/data-containers/age.tsx index 132513c3..fb50f751 100644 --- a/app/src/frontend/building/data-containers/age.tsx +++ b/app/src/frontend/building/data-containers/age.tsx @@ -116,8 +116,8 @@ const AgeView: React.FunctionComponent = (props) => { copy={props.copy} onChange={props.onChange} tooltip={dataFields.date_source.tooltip} - placeholder="" options={dataFields.date_source.items} + placeholder={dataFields.date_source.example} /> Date: Thu, 12 May 2022 16:36:14 +0100 Subject: [PATCH 13/15] fix placeholder age --- app/src/frontend/building/data-containers/age.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/frontend/building/data-containers/age.tsx b/app/src/frontend/building/data-containers/age.tsx index fb50f751..15ff3c70 100644 --- a/app/src/frontend/building/data-containers/age.tsx +++ b/app/src/frontend/building/data-containers/age.tsx @@ -65,7 +65,7 @@ const AgeView: React.FunctionComponent = (props) => { copy={props.copy} onChange={props.onChange} tooltip={dataFields.date_source.tooltip} - placeholder="" + placeholder={dataFields.date_source.example} options={dataFields.date_source.items} /> From 8e21bf2982394a2977fea595a3f42cb11fc70ae3 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Thu, 12 May 2022 16:37:15 +0100 Subject: [PATCH 14/15] update placeholder to use example for current use --- app/src/frontend/building/data-containers/use.tsx | 4 ++-- app/src/frontend/config/data-fields-config.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/frontend/building/data-containers/use.tsx b/app/src/frontend/building/data-containers/use.tsx index 8535767c..64ba958c 100644 --- a/app/src/frontend/building/data-containers/use.tsx +++ b/app/src/frontend/building/data-containers/use.tsx @@ -66,7 +66,7 @@ const UseView: React.FunctionComponent = (props) => { copy={props.copy} onChange={props.onChange} tooltip={dataFields.current_landuse_source.tooltip} - placeholder="" + placeholder={dataFields.date_source.example} options={dataFields.current_landuse_source.items} /> @@ -119,7 +119,7 @@ const UseView: React.FunctionComponent = (props) => { copy={props.copy} onChange={props.onChange} tooltip={dataFields.current_landuse_source.tooltip} - placeholder="" + placeholder={dataFields.date_source.example} options={dataFields.current_landuse_source.items} /> Date: Thu, 12 May 2022 16:41:20 +0100 Subject: [PATCH 15/15] remive duplicate --- app/src/frontend/config/data-fields-config.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/frontend/config/data-fields-config.ts b/app/src/frontend/config/data-fields-config.ts index 7c7c8ee9..f808f000 100644 --- a/app/src/frontend/config/data-fields-config.ts +++ b/app/src/frontend/config/data-fields-config.ts @@ -207,7 +207,6 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ "Open address dataset", "Other" ], - example: "", }, current_landuse_source_detail: { category: Category.LandUse,