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
margin-left: 9px;
margin-top: 9px;
overflow: hidden;
max-width: calc(100% - 50px);
text-overflow: ellipsis;
overflow-wrap: normal;
white-space: nowrap;
.measurementDisplayText
display: inline-block;

View File

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

View File

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

View File

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

View File

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