enable clear edits

This commit is contained in:
zeppi 2021-06-10 16:06:44 -04:00 committed by Thomas Zarebczan
parent f258de54b0
commit d5f199be66
2 changed files with 13 additions and 5 deletions

View file

@ -13,7 +13,7 @@ import {
makeSelectClaimIsPending, makeSelectClaimIsPending,
makeSelectClaimForClaimId, makeSelectClaimForClaimId,
makeSelectCollectionIsMine, makeSelectCollectionIsMine,
doLocalCollectionDelete, doCollectionDelete,
doCollectionEdit, doCollectionEdit,
makeSelectChannelForClaimUri, makeSelectChannelForClaimUri,
makeSelectCountForCollectionId, makeSelectCountForCollectionId,
@ -50,7 +50,7 @@ const select = (state, props) => {
const perform = (dispatch) => ({ const perform = (dispatch) => ({
fetchCollectionItems: (claimId, cb) => dispatch(doFetchItemsInCollection({ collectionId: claimId }, cb)), // if this collection is not resolved, resolve it fetchCollectionItems: (claimId, cb) => dispatch(doFetchItemsInCollection({ collectionId: claimId }, cb)), // if this collection is not resolved, resolve it
deleteCollection: (id) => dispatch(doLocalCollectionDelete(id)), deleteCollection: (id, colKey) => dispatch(doCollectionDelete(id, colKey)),
editCollection: (id, params) => dispatch(doCollectionEdit(id, params)), editCollection: (id, params) => dispatch(doCollectionEdit(id, params)),
}); });

View file

@ -6,6 +6,7 @@ import * as PAGES from 'constants/pages';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import CollectionEdit from 'component/collectionEdit'; import CollectionEdit from 'component/collectionEdit';
import Card from 'component/common/card'; import Card from 'component/common/card';
import Button from 'component/button';
import CollectionActions from 'component/collectionActions'; import CollectionActions from 'component/collectionActions';
import classnames from 'classnames'; import classnames from 'classnames';
import ClaimAuthor from 'component/claimAuthor'; import ClaimAuthor from 'component/claimAuthor';
@ -32,7 +33,7 @@ type Props = {
isMyCollection: boolean, isMyCollection: boolean,
claimIsPending: boolean, claimIsPending: boolean,
collectionHasEdits: boolean, collectionHasEdits: boolean,
deleteCollection: (string) => void, deleteCollection: (string, string) => void,
editCollection: (string, CollectionEditParams) => void, editCollection: (string, CollectionEditParams) => void,
fetchCollectionItems: (string, () => void) => void, fetchCollectionItems: (string, () => void) => void,
resolveUris: (string) => void, resolveUris: (string) => void,
@ -51,6 +52,7 @@ export default function CollectionPage(props: Props) {
claimIsPending, claimIsPending,
isResolvingCollection, isResolvingCollection,
fetchCollectionItems, fetchCollectionItems,
deleteCollection,
} = props; } = props;
const { const {
@ -83,7 +85,14 @@ export default function CollectionPage(props: Props) {
</div> </div>
); );
const unpublished = <span className="help">{__('Unpublished Edit')}</span>; const unpublished = (
<Button
button="close"
icon={ICONS.REFRESH}
label={__('Clear Edits')}
onClick={() => deleteCollection(collectionId, COLLECTIONS_CONSTS.COL_KEY_EDITED)}
/>
);
let titleActions; let titleActions;
if (collectionHasEdits) { if (collectionHasEdits) {
@ -104,7 +113,6 @@ export default function CollectionPage(props: Props) {
<span> <span>
<Icon icon={ICONS.STACK} className="icon--margin-right" /> <Icon icon={ICONS.STACK} className="icon--margin-right" />
{claim ? claim.value.title || claim.name : collection && collection.name} {claim ? claim.value.title || claim.name : collection && collection.name}
{collectionHasEdits && <span className={'collection-title__hasEdits'}>(*)</span>}
</span> </span>
} }
titleActions={titleActions} titleActions={titleActions}