Improve label picking (#1179)

* add simple error message helper

* port all label name pickers to use the new LabelInput component

* use pure components where possible

* cleanup

* more cleanup

* lint

* change new label prompt
This commit is contained in:
Bruce Martin
2020-02-28 15:46:40 -07:00
committed by GitHub
parent 1e4381ab7f
commit bf7d7342d5
27 changed files with 418 additions and 576 deletions
+16 -18
View File
@@ -55,46 +55,40 @@ const Annotations = (
}
/* CATEGORY */
case "annotation: activate add new label mode":
case "annotation: activate add new label mode": {
return {
...state,
isAddingNewLabel: true,
categoryAddingNewLabel: action.data
};
case "annotation: activate add new ontology label mode":
return {
...state,
isAddingNewLabelFromOntology: true,
categoryAddingNewLabelFromOntology: action.data
};
case "annotation: disable add new ontology label mode":
return {
...state,
isAddingNewLabelFromOntology: false,
categoryAddingNewLabelFromOntology: null
};
}
case "annotation: disable add new label mode":
case "annotation: disable add new label mode": {
return {
...state,
isAddingNewLabel: false,
categoryAddingNewLabel: null
};
case "annotation: activate category edit mode":
}
case "annotation: activate category edit mode": {
return {
...state,
isEditingCategoryName: true,
categoryBeingEdited: action.data
};
case "annotation: disable category edit mode":
}
case "annotation: disable category edit mode": {
return {
...state,
isEditingCategoryName: false,
categoryBeingEdited: null
};
}
/* LABEL */
case "annotation: activate edit label mode":
case "annotation: activate edit label mode": {
return {
...state,
isEditingLabelName: true,
@@ -103,12 +97,16 @@ const Annotations = (
label: action.categoryIndex
}
};
case "annotation: cancel edit label mode":
}
case "annotation: cancel edit label mode": {
return {
...state,
isEditingLabelName: false,
labelEditable: { category: null, label: null }
};
}
default:
return state;
}