diff --git a/app/src/frontend/building/data-components/pattern-data-entry.tsx b/app/src/frontend/building/data-components/pattern-data-entry.tsx index 9681e981..187fb0df 100644 --- a/app/src/frontend/building/data-components/pattern-data-entry.tsx +++ b/app/src/frontend/building/data-components/pattern-data-entry.tsx @@ -12,11 +12,20 @@ interface PatternDataEntryProps extends BaseDataEntryProps { */ pattern: string; maxLength?: number; + valueTransform?: (val: string) => string; } export const PatternDataEntry: React.FC = props => { const handleChange = (value: string) => { - props.onChange?.(props.slug, value); + props.onChange?.(props.slug, transformValue(value)); + }; + + const transformValue = (value: string) => { + const transform = props.valueTransform || (x => x); + const transformedValue = value === '' ? + null : + transform(value); + return transformedValue; }; return ( diff --git a/app/src/frontend/building/data-containers/location.tsx b/app/src/frontend/building/data-containers/location.tsx index 9ffe6e2d..a1b7ef1e 100644 --- a/app/src/frontend/building/data-containers/location.tsx +++ b/app/src/frontend/building/data-containers/location.tsx @@ -12,9 +12,11 @@ import SelectDataEntry from '../data-components/select-data-entry'; import { MultiDataEntry } from '../data-components/multi-data-entry/multi-data-entry'; const locationNumberPattern = "[1-9]\\d*[a-z]?(-([1-9]\\d*))?"; ///[1-9]\d*[a-z]?(-([1-9]\d*))?/; +const postcodeCharacterPattern = "^[A-Z]{1,2}[0-9]{1,2}[A-Z]?(\\s*[0-9][A-Z]{1,2})?$"; +const osmIdentifierPattern = "[0-9]{1,9}"; const LocationView: React.FunctionComponent = (props) => { - const osm_url = "https://www.openstreetmap.org/way/"+props.building.ref_osm_id; + const osm_url = "www.openstreetmap.org/way/"+props.building.ref_osm_id; return ( @@ -26,8 +28,9 @@ const LocationView: React.FunctionComponent = (props) => { copy={props.copy} onChange={props.onChange} tooltip={dataFields.location_name.tooltip} - placeholder="https://..." - isUrl={true} + placeholder="" + isUrl={false} + disabled={true} /> = (props) => { mode='view' tooltip="Not yet activated.

For security reasons, we do not allow the use of free text boxes and are currently looking into alternative ways to collect this data." /> +
= (props) => { copy={props.copy} onChange={props.onChange} tooltip={dataFields.location_number.tooltip} + maxLength={5} /> = (props) => { copy={props.copy} onChange={props.onChange} maxLength={30} + disabled={true} /> = (props) => { copy={props.copy} onChange={props.onChange} maxLength={30} + disabled={true} /> = (props) => { mode={props.mode} copy={props.copy} onChange={props.onChange} + disabled={true} /> = (props) => { user_verified_as={props.user_verified.location_town} verified_count={props.building.verified.location_town} /> - = (props) => { onChange={props.onChange} disabled={true} /> + { + (props.building.ref_toid == null) ? <> : + + } +
- : + + } +
+ = (props) => { tooltip={dataFields.ref_osm_id.tooltip} maxLength={20} onChange={props.onChange} + pattern={osmIdentifierPattern} /> - { - (props.building.ref_osm_id == null) ? <> : -
- Source: {osm_url} -
- } = (props) => { user_verified_as={props.user_verified.ref_osm_id} verified_count={props.building.verified.ref_osm_id} /> + { + (props.building.ref_osm_id == null) ? <> : +
+ Source: {osm_url} +
+ }
= (props) => { /> } +
+
); diff --git a/app/src/frontend/building/sidebar.css b/app/src/frontend/building/sidebar.css index 5f915241..74bfe22f 100644 --- a/app/src/frontend/building/sidebar.css +++ b/app/src/frontend/building/sidebar.css @@ -183,4 +183,17 @@ .source-url { padding-top: 0px; padding-bottom: 5px; +} + +dd { + margin-bottom: 15px; +} + +.uprn-list { + margin-top: 10px; + margin-bottom: 0px; +} + +.uprn-list li { + margin-bottom: 10px; } \ No newline at end of file diff --git a/app/src/frontend/config/data-fields-config.ts b/app/src/frontend/config/data-fields-config.ts index 8738bccd..60e6e17d 100644 --- a/app/src/frontend/config/data-fields-config.ts +++ b/app/src/frontend/config/data-fields-config.ts @@ -194,7 +194,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ ref_toid: { category: Category.Location, title: "Building footprint ID", - tooltip: "Ordnance Survey Topography Layer ID (TOID) [link]", + tooltip: "Ordnance Survey Topography Layer ID (TOID)", example: "", }, @@ -205,7 +205,7 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ uprns: { category: Category.Location, title: "Unique Property Reference Number(s) (UPRN)", - tooltip: "Unique Property Reference Numbers (to be filled automatically) [LINK]", + tooltip: "Unique Property Reference Number(s) (UPRN) (derived automatically)", example: [{ uprn: "", parent_uprn: "" }, { uprn: "", parent_uprn: "" }], }, @@ -218,11 +218,10 @@ export const dataFields = { /* eslint-disable @typescript-eslint/camelcase */ ], }, - ref_osm_id: { category: Category.Location, title: "OpenStreetMap ID", - tooltip: "OpenStreetMap feature ID", + tooltip: "OpenStreetMap building ('way') ID - Numerical string of up to 9 characters", example: "", }, location_latitude: {