From f1de3b193e87f39b83294cef907b7fe535617267 Mon Sep 17 00:00:00 2001 From: zeppi Date: Thu, 2 Dec 2021 01:00:55 -0500 Subject: [PATCH] collection reordering changes --- static/app-strings.json | 1 + ui/component/claimList/view.jsx | 2 - .../claimPreview/collection-buttons.jsx | 121 ++++++++++++++++++ ui/component/claimPreview/view.jsx | 55 +++++++- ui/component/common/icon-custom.jsx | 16 ++- ui/component/fileDescription/view.jsx | 2 +- ui/constants/icons.js | 2 + ui/page/collection/view.jsx | 2 +- ui/scss/component/_button.scss | 45 +++++-- ui/scss/component/_claim-list.scss | 5 + ui/scss/component/_collection.scss | 31 +++-- 11 files changed, 247 insertions(+), 35 deletions(-) create mode 100644 ui/component/claimPreview/collection-buttons.jsx diff --git a/static/app-strings.json b/static/app-strings.json index b36842566..4c6fb6ac3 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -2220,5 +2220,6 @@ "filtered": "filtered", "View All Playlists": "View All Playlists", "Your wallet is not currently using a cloud sync service. You are in control of backing up your wallet.": "Your wallet is not currently using a cloud sync service. You are in control of backing up your wallet.", + "%action% %collection%": "%action% %collection%", "--end--": "--end--" } diff --git a/ui/component/claimList/view.jsx b/ui/component/claimList/view.jsx index 456c23e0f..3531e4d59 100644 --- a/ui/component/claimList/view.jsx +++ b/ui/component/claimList/view.jsx @@ -78,8 +78,6 @@ export default function ClaimList(props: Props) { noEmpty, } = props; - console.log('noempty', noEmpty); - const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW); // Exclude prefix uris in these results variables. We don't want to show diff --git a/ui/component/claimPreview/collection-buttons.jsx b/ui/component/claimPreview/collection-buttons.jsx new file mode 100644 index 000000000..c9b2e40e4 --- /dev/null +++ b/ui/component/claimPreview/collection-buttons.jsx @@ -0,0 +1,121 @@ +// @flow +import React from 'react'; +import Button from 'component/button'; +import * as ICONS from 'constants/icons'; +type Props = { + collectionIndex?: number, + editCollection: (string, CollectionEditParams) => void, + listId?: string, + lastCollectionIndex?: number, + claim: ?Claim, +}; + +function CollectionButtons(props: Props) { + const { collectionIndex, editCollection, listId, lastCollectionIndex, claim } = props; + const [confirmDelete, setConfirmDelete] = React.useState(false); + return ( +
+
+
+
+
+ {!confirmDelete && ( +
+
+ )} + {confirmDelete && ( +
+
+ )} +
+ ); +} + +export default CollectionButtons; diff --git a/ui/component/claimPreview/view.jsx b/ui/component/claimPreview/view.jsx index f5735efcd..37cdbf044 100644 --- a/ui/component/claimPreview/view.jsx +++ b/ui/component/claimPreview/view.jsx @@ -25,6 +25,7 @@ import ClaimMenuList from 'component/claimMenuList'; import ClaimPreviewLoading from './claim-preview-loading'; import ClaimPreviewHidden from './claim-preview-no-mature'; import ClaimPreviewNoContent from './claim-preview-no-content'; +import CollectionEditButtons from './collection-buttons'; import Button from 'component/button'; import * as ICONS from 'constants/icons'; @@ -151,7 +152,7 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { } = props; const isCollection = claim && claim.value_type === 'collection'; const collectionClaimId = isCollection && claim && claim.claim_id; - const listId = collectionId || collectionClaimId; + const listId = collectionId || collectionClaimId || null; const WrapperElement = wrapperElement || 'li'; const shouldFetch = claim === undefined || (claim !== null && claim.value_type === 'channel' && isEmpty(claim.meta) && !pending); @@ -160,6 +161,7 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { const shouldHideActions = hideActions || isMyCollection || type === 'small' || type === 'tooltip'; const canonicalUrl = claim && claim.canonical_url; const lastCollectionIndex = collectionUris ? collectionUris.length - 1 : 0; + console.log('type', type); const channelSubscribers = React.useMemo(() => { if (channelSubCount === undefined) { return ; @@ -347,8 +349,18 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { 'claim-preview--channel': isChannelUri, 'claim-preview--visited': !isChannelUri && !claimIsMine && hasVisitedUri, 'claim-preview--pending': pending, + 'claim-preview--collection-mine': isMyCollection && listId && type === 'listview', })} > + {isMyCollection && listId && type === 'listview' && ( + + )} {isChannelUri && claim ? ( @@ -396,13 +408,27 @@ const ClaimPreview = forwardRef((props: Props, ref: any) => { {!pending && ( <> {renderActions && claim && renderActions(claim)} - {Boolean(isMyCollection && listId) && ( + {false && Boolean(isMyCollection && listId) && ( <>