diff --git a/ui/constants/action_types.js b/ui/constants/action_types.js
index d9050aac7..8cc077d48 100644
--- a/ui/constants/action_types.js
+++ b/ui/constants/action_types.js
@@ -195,7 +195,6 @@ export const COLLECTION_ITEMS_RESOLVE_STARTED = 'COLLECTION_ITEMS_RESOLVE_STARTE
export const COLLECTION_ITEMS_RESOLVE_COMPLETED = 'COLLECTION_ITEMS_RESOLVE_COMPLETED';
export const COLLECTION_ITEMS_RESOLVE_FAILED = 'COLLECTION_ITEMS_RESOLVE_FAILED';
export const COLLECTION_NEW = 'COLLECTION_NEW';
-export const COLLECTION_RENAME = 'COLLECTION_RENAME';
export const COLLECTION_DELETE = 'COLLECTION_DELETE';
export const COLLECTION_PENDING = 'COLLECTION_PENDING';
export const COLLECTION_EDIT = 'COLLECTION_EDIT';
diff --git a/ui/page/collection/index.js b/ui/page/collection/index.js
index 04ef4b8a5..051f9ecef 100644
--- a/ui/page/collection/index.js
+++ b/ui/page/collection/index.js
@@ -54,6 +54,7 @@ const perform = (dispatch) => ({
fetchCollectionItems: (claimId, cb) => dispatch(doFetchItemsInCollection({ collectionId: claimId }, cb)), // if this collection is not resolved, resolve it
deleteCollection: (id, colKey) => dispatch(doCollectionDelete(id, colKey)),
editCollection: (id, params) => dispatch(doCollectionEdit(id, params)),
+ renameCollection: (id, name) => dispatch(doCollectionEdit(id, { name })),
});
export default withRouter(connect(select, perform)(CollectionPage));
diff --git a/ui/page/collection/view.jsx b/ui/page/collection/view.jsx
index a147eb347..6d1310bcd 100644
--- a/ui/page/collection/view.jsx
+++ b/ui/page/collection/view.jsx
@@ -19,6 +19,7 @@ import * as COLLECTIONS_CONSTS from 'constants/collections';
import Icon from 'component/common/icon';
import * as ICONS from 'constants/icons';
import Spinner from 'component/spinner';
+import { FormField } from 'component/common/form';
export const PAGE_VIEW_QUERY = 'view';
export const EDIT_PAGE = 'edit';
@@ -42,6 +43,7 @@ type Props = {
fetchCollectionItems: (string, () => void) => void,
resolveUris: (string) => void,
user: ?User,
+ renameCollection: (string, string) => void,
};
export default function CollectionPage(props: Props) {
@@ -58,6 +60,7 @@ export default function CollectionPage(props: Props) {
editCollection,
fetchCollectionItems,
deleteCollection,
+ renameCollection,
} = props;
const {
@@ -70,6 +73,11 @@ export default function CollectionPage(props: Props) {
const [showEdit, setShowEdit] = React.useState(false);
const [unavailableUris, setUnavailable] = React.useState([]);
+ const collectionName = claim ? claim.value.title || claim.name : collection && collection.name;
+
+ const [isRenamingList, setIsRenamingList] = React.useState(false);
+ const [newName, setNewName] = React.useState(collectionName);
+
const { name, totalItems } = collection || {};
const isBuiltin = COLLECTIONS_CONSTS.BUILTIN_LISTS.includes(collectionId);
@@ -84,6 +92,11 @@ export default function CollectionPage(props: Props) {
editCollection(collectionId, { order: { from, to } });
}
+ function handleRenameCollection() {
+ renameCollection(collectionId, newName);
+ setIsRenamingList(false);
+ }
+
const urlParams = new URLSearchParams(search);
const editing = urlParams.get(PAGE_VIEW_QUERY) === EDIT_PAGE;
@@ -142,17 +155,48 @@ export default function CollectionPage(props: Props) {
const info = (
-
+
+