Merge pull request #523 from mz8i/fix/lat-lon-errors
Fix/lat lon errors
This commit is contained in:
commit
572de62944
@ -27,10 +27,10 @@ const NumericDataEntry: React.FunctionComponent<NumericDataEntryProps> = (props)
|
||||
type="number"
|
||||
id={props.slug}
|
||||
name={props.slug}
|
||||
value={props.value || ''}
|
||||
step={props.step || 1}
|
||||
value={props.value == undefined ? '' : props.value}
|
||||
step={props.step == undefined ? 1 : props.step}
|
||||
max={props.max}
|
||||
min={props.min || 0}
|
||||
min={props.min}
|
||||
disabled={props.mode === 'view' || props.disabled}
|
||||
placeholder={props.placeholder}
|
||||
onChange={e =>
|
||||
|
@ -30,6 +30,8 @@ class YearDataEntry extends Component<YearDataEntryProps, any> {
|
||||
// TODO handle changes internally, reporting out date_year, date_upper, date_lower
|
||||
render() {
|
||||
const props = this.props;
|
||||
|
||||
const currentYear = new Date().getFullYear();
|
||||
return (
|
||||
<Fragment>
|
||||
<NumericDataEntry
|
||||
@ -39,6 +41,8 @@ class YearDataEntry extends Component<YearDataEntryProps, any> {
|
||||
mode={props.mode}
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
min={1}
|
||||
max={currentYear}
|
||||
// "type": "year_estimator"
|
||||
/>
|
||||
<NumericDataEntry
|
||||
@ -49,6 +53,8 @@ class YearDataEntry extends Component<YearDataEntryProps, any> {
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
step={1}
|
||||
min={1}
|
||||
max={currentYear}
|
||||
tooltip={dataFields.date_upper.tooltip}
|
||||
/>
|
||||
<NumericDataEntry
|
||||
@ -59,6 +65,8 @@ class YearDataEntry extends Component<YearDataEntryProps, any> {
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
step={1}
|
||||
min={1}
|
||||
max={currentYear}
|
||||
tooltip={dataFields.date_lower.tooltip}
|
||||
/>
|
||||
</Fragment>
|
||||
|
@ -13,7 +13,10 @@ import { CategoryViewProps } from './category-view-props';
|
||||
/**
|
||||
* Age view/edit section
|
||||
*/
|
||||
const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {
|
||||
const currentYear = new Date().getFullYear();
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<YearDataEntry
|
||||
year={props.building.date_year}
|
||||
@ -31,6 +34,8 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
step={1}
|
||||
min={1}
|
||||
max={currentYear}
|
||||
tooltip={dataFields.facade_year.tooltip}
|
||||
/>
|
||||
<SelectDataEntry
|
||||
@ -76,6 +81,7 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
};
|
||||
const AgeContainer = withCopyEdit(AgeView);
|
||||
|
||||
export default AgeContainer;
|
||||
|
@ -31,6 +31,7 @@ const LocationView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
step={1}
|
||||
min={1}
|
||||
/>
|
||||
<DataEntry
|
||||
title={dataFields.location_street.title}
|
||||
@ -99,8 +100,10 @@ const LocationView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
value={props.building.location_latitude}
|
||||
mode={props.mode}
|
||||
copy={props.copy}
|
||||
step={0.0001}
|
||||
placeholder="51"
|
||||
step={0.00001}
|
||||
min={-90}
|
||||
max={90}
|
||||
placeholder="Latitude, e.g. 51.5467"
|
||||
onChange={props.onChange}
|
||||
/>
|
||||
<NumericDataEntry
|
||||
@ -109,8 +112,10 @@ const LocationView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
value={props.building.location_longitude}
|
||||
mode={props.mode}
|
||||
copy={props.copy}
|
||||
step={0.0001}
|
||||
placeholder="0"
|
||||
step={0.00001}
|
||||
min={-180}
|
||||
max={180}
|
||||
placeholder="Longitude, e.g. -0.0586"
|
||||
onChange={props.onChange}
|
||||
/>
|
||||
</Fragment>
|
||||
|
@ -24,6 +24,7 @@ const SizeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
tooltip={dataFields.size_storeys_core.tooltip}
|
||||
onChange={props.onChange}
|
||||
step={1}
|
||||
min={0}
|
||||
/>
|
||||
<NumericDataEntry
|
||||
title={dataFields.size_storeys_attic.title}
|
||||
@ -34,6 +35,7 @@ const SizeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
tooltip={dataFields.size_storeys_attic.tooltip}
|
||||
onChange={props.onChange}
|
||||
step={1}
|
||||
min={0}
|
||||
/>
|
||||
<NumericDataEntry
|
||||
title={dataFields.size_storeys_basement.title}
|
||||
@ -44,6 +46,7 @@ const SizeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
tooltip={dataFields.size_storeys_basement.tooltip}
|
||||
onChange={props.onChange}
|
||||
step={1}
|
||||
min={0}
|
||||
/>
|
||||
</DataEntryGroup>
|
||||
<DataEntryGroup name="Height">
|
||||
@ -55,6 +58,7 @@ const SizeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
step={0.1}
|
||||
min={0}
|
||||
/>
|
||||
<NumericDataEntry
|
||||
title={dataFields.size_height_eaves.title}
|
||||
@ -65,6 +69,7 @@ const SizeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
step={0.1}
|
||||
min={0}
|
||||
/>
|
||||
</DataEntryGroup>
|
||||
<DataEntryGroup name="Floor area">
|
||||
@ -76,6 +81,7 @@ const SizeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
step={0.1}
|
||||
min={0}
|
||||
/>
|
||||
<NumericDataEntry
|
||||
title={dataFields.size_floor_area_total.title}
|
||||
@ -85,6 +91,7 @@ const SizeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
step={0.1}
|
||||
min={0}
|
||||
/>
|
||||
</DataEntryGroup>
|
||||
<NumericDataEntry
|
||||
@ -95,6 +102,7 @@ const SizeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
step={0.1}
|
||||
min={0}
|
||||
/>
|
||||
<NumericDataEntry
|
||||
title={dataFields.size_plot_area_total.title}
|
||||
@ -104,6 +112,7 @@ const SizeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
step={0.1}
|
||||
min={0}
|
||||
disabled={true}
|
||||
/>
|
||||
<NumericDataEntry
|
||||
@ -114,6 +123,7 @@ const SizeView: React.FunctionComponent<CategoryViewProps> = (props) => (
|
||||
copy={props.copy}
|
||||
onChange={props.onChange}
|
||||
step={0.1}
|
||||
min={0}
|
||||
disabled={true}
|
||||
/>
|
||||
<SelectDataEntry
|
||||
|
Loading…
Reference in New Issue
Block a user