Skip to content

Commit

Permalink
Merge pull request #1292 from colouring-cities/interface/ui-tweaks
Browse files Browse the repository at this point in the history
Interface/UI tweaks
  • Loading branch information
mdsimpson42 authored Jan 4, 2024
2 parents f22ea93 + bb97305 commit dd7007c
Show file tree
Hide file tree
Showing 14 changed files with 305 additions and 121 deletions.
90 changes: 76 additions & 14 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"pg-format": "^1.0.4",
"pg-promise": "^10.11.1",
"query-string": "^6.13.1",
"rc-slider": "^10.4.0",
"react": "^17.0.2",
"react-datepicker": "^4.11.0",
"react-dom": "^17.0.2",
Expand Down
17 changes: 16 additions & 1 deletion app/src/api/config/dataFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,22 @@ export const buildingUserAttributesConfig = valueType<DataFieldConfig>()({
perUser: true,
edit: true,
verify: false
}
},
community_building_hominess: {
perUser: true,
edit: true,
verify: false
},
community_building_coherence: {
perUser: true,
edit: true,
verify: false
},
community_building_fascination: {
perUser: true,
edit: true,
verify: false
},
});

export const allAttributesConfig = Object.assign({}, buildingAttributesConfig, buildingUserAttributesConfig);
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const AutofillDropdown: React.FC<AutofillDropdownProps> = props => {
props.onClose();
}}
>
{option.value} ({option.id})
{option.value}
</div>)
}
</div>
Expand Down
54 changes: 54 additions & 0 deletions app/src/frontend/building/data-components/slider-data-entry.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import React, { Fragment } from 'react';

import { BaseDataEntryProps } from './data-entry';
import { DataTitleCopyable } from './data-title';
import Slider from 'rc-slider';
import 'rc-slider/assets/index.css';

interface SliderDataEntryProps extends BaseDataEntryProps {
value?: number;
placeholder?: string;
dots?: boolean;
max?: number;
min?: number;
onChange: (key: string, value: number) => void;
}

const SliderDataEntry: React.FunctionComponent<SliderDataEntryProps> = (props) => {

const marks = {
[props.min]: <strong>{props.min}</strong>,
[props.max]: <strong>{props.max}</strong>
};

return (
<Fragment>
<DataTitleCopyable
slug={props.slug}
slugModifier={props.slugModifier}
title={props.title}
tooltip={props.tooltip}
copy={props.copy}
/>
<div className="slider-container">
<Slider
value={props.value || props.min}
max={props.max}
min={props.min}
dots={props.dots}
marks={marks}
disabled={props.mode === 'view' || props.disabled}
onChange={
e => props.onChange(
props.slug,
typeof(e)=="number" ? e : e[0]
)
}
/>
</div>
<p>Your score: {props.value} - Average: 2.41 (15 votes)</p>
</Fragment>
);
};

export default SliderDataEntry;
6 changes: 5 additions & 1 deletion app/src/frontend/building/data-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,11 @@ const withCopyEdit: (wc: React.ComponentType<CategoryViewProps>) => DataContaine
<div className="section-body">
<InfoBox>
{this.props.intro}&nbsp;
Can you help us capture and verify this information?
{(this.props.title !== "Community") ?
"Can you help us capture and verify this information?"
:
""
}
</InfoBox>
<EditHistoryLatest
building={this.props.building}
Expand Down
2 changes: 1 addition & 1 deletion app/src/frontend/building/data-containers/age-history.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const AgeView: React.FunctionComponent<CategoryViewProps> = (props) => {

return (
<Fragment>
<DataEntryGroup name="Architectural style" collapsed={subcat==null || subcat!="2"}>
<DataEntryGroup name="Architectural style/historial period" collapsed={subcat==null || subcat!="2"}>
{(props.mapColourScale != "typology_style_period") ?
<button className={`map-switcher-inline enabled-state btn btn-outline btn-outline-dark key-button`} onClick={switchToStylePeriodMapStyle}>
Click to show architectural style.
Expand Down
Loading

0 comments on commit dd7007c

Please sign in to comment.