fix: 🐛 Minor issues measurement panel related to description (#1142)

This commit is contained in:
ladeirarodolfo 2019-11-04 00:53:24 -03:00 committed by Danny Brown
parent 54e07c281f
commit 681384b742
5 changed files with 17 additions and 4 deletions

View File

@ -30,6 +30,11 @@
.measurementLocation .measurementLocation
margin-left: 9px; margin-left: 9px;
margin-top: 9px; margin-top: 9px;
overflow: hidden;
max-width: calc(100% - 50px);
text-overflow: ellipsis;
overflow-wrap: normal;
white-space: nowrap;
.measurementDisplayText .measurementDisplayText
display: inline-block; display: inline-block;

View File

@ -38,6 +38,7 @@
.itemContent .itemContent
flex: 1 flex: 1
color: var(--text-secondary-color) color: var(--text-secondary-color)
width: calc(100% - 30px);
font-weight: 400 font-weight: 400
margin-left: 9px; margin-left: 9px;
margin-top: 9px; margin-top: 9px;

View File

@ -31,7 +31,7 @@ function getAllTools() {
function getMeasurementText(measurementData = {}) { function getMeasurementText(measurementData = {}) {
const defaultText = '...'; const defaultText = '...';
const { location = '', description = '' } = measurementData; const { location = '', description = '' } = measurementData;
const result = location + (description ? `(${description})` : ''); const result = location + (description ? ` (${description})` : '');
return result || defaultText; return result || defaultText;
} }

View File

@ -105,9 +105,9 @@ function getToolLabellingFlowCallback(store) {
if (location) { if (location) {
measurementData.location = location; measurementData.location = location;
} }
if (description) {
measurementData.description = description; measurementData.description = description || '';
}
if (response) { if (response) {
measurementData.response = response; measurementData.response = response;
} }

View File

@ -152,6 +152,7 @@ export default class LabellingFlow extends Component {
ref={this.descriptionInput} ref={this.descriptionInput}
defaultValue={description || ''} defaultValue={description || ''}
autoComplete="off" autoComplete="off"
onKeyPress={this.handleKeyPress}
/> />
</div> </div>
</div> </div>
@ -223,6 +224,12 @@ export default class LabellingFlow extends Component {
}); });
}; };
handleKeyPress = e => {
if (e.key === 'Enter') {
this.descriptionSave();
}
};
descriptionSave = () => { descriptionSave = () => {
const description = this.descriptionInput.current.value; const description = this.descriptionInput.current.value;
this.props.updateLabelling({ description }); this.props.updateLabelling({ description });