From 296352b6209af4451ecd1191568a1f9f18f47dfb Mon Sep 17 00:00:00 2001 From: Colin Megill Date: Fri, 4 Oct 2019 13:41:05 -0400 Subject: [PATCH] remove modal for inline edit category name, and autofocus (#962) * remove modal for inline edit category name, and autofocus * remove comment, rename to categorybeingedited --- client/src/components/categorical/category.js | 88 ++++++++++--------- client/src/components/categorical/value.js | 1 + client/src/reducers/annotations.js | 8 +- 3 files changed, 52 insertions(+), 45 deletions(-) diff --git a/client/src/components/categorical/category.js b/client/src/components/categorical/category.js index f79dc526..7d53cff7 100644 --- a/client/src/components/categorical/category.js +++ b/client/src/components/categorical/category.js @@ -237,45 +237,6 @@ class Category extends React.Component { {""} - {/* Dialog uses portal, can be anywhere/factored out */} - -
-
-

New, unique category name:

- - this.setState({ newCategoryText: e.target.value }) - } - leftIcon="tag" - /> -
-
-
-
- - - - -
-
-
{ - this.setState({ isExpanded: !isExpanded }); + const editingCategory = + annotations.isEditingCategoryName && + annotations.categoryBeingEdited === metadataField; + if (!editingCategory) { + this.setState({ isExpanded: !isExpanded }); + } }} > {isUserAnno ? ( ) : null} - {metadataField} + + {annotations.isEditingCategoryName && + annotations.categoryBeingEdited === metadataField ? ( +
{ + e.preventDefault(); + this.handleEditCategory(); + }} + > + { + this.editableCategoryInput = input; + }} + small + autoFocus + onChange={e => { + this.setState({ + newCategoryText: e.target.value + }); + }} + defaultValue={metadataField} + rightElement={ +