disable edits while pending

This commit is contained in:
zeppi 2021-06-23 11:04:53 -04:00
parent 6d8fce6011
commit 7667c98cf0
3 changed files with 8 additions and 3 deletions

View file

@ -15,6 +15,7 @@ import {
doCollectionEdit, doCollectionEdit,
makeSelectUrlsForCollectionId, makeSelectUrlsForCollectionId,
makeSelectIndexForUrlInCollection, makeSelectIndexForUrlInCollection,
makeSelectClaimIdIsPending,
} from 'lbry-redux'; } from 'lbry-redux';
import { selectMutedChannels, makeSelectChannelIsMuted } from 'redux/selectors/blocked'; import { selectMutedChannels, makeSelectChannelIsMuted } from 'redux/selectors/blocked';
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc'; import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
@ -47,6 +48,7 @@ const select = (state, props) => ({
isCollectionMine: makeSelectCollectionIsMine(props.collectionId)(state), isCollectionMine: makeSelectCollectionIsMine(props.collectionId)(state),
collectionUris: makeSelectUrlsForCollectionId(props.collectionId)(state), collectionUris: makeSelectUrlsForCollectionId(props.collectionId)(state),
collectionIndex: makeSelectIndexForUrlInCollection(props.uri, props.collectionId)(state), collectionIndex: makeSelectIndexForUrlInCollection(props.uri, props.collectionId)(state),
collectionIsPending: makeSelectClaimIdIsPending(props.collectionId)(state),
}); });
const perform = (dispatch) => ({ const perform = (dispatch) => ({

View file

@ -79,6 +79,7 @@ type Props = {
collectionUris: Array<Collection>, collectionUris: Array<Collection>,
collectionIndex?: number, collectionIndex?: number,
disableNavigation?: boolean, disableNavigation?: boolean,
collectionIsPending?: boolean,
}; };
const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => { const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
@ -135,6 +136,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
editCollection, editCollection,
isCollectionMine, isCollectionMine,
collectionUris, collectionUris,
collectionIsPending,
disableNavigation, disableNavigation,
} = props; } = props;
const isRepost = claim && claim.repost_channel_url; const isRepost = claim && claim.repost_channel_url;
@ -346,7 +348,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
<Button <Button
button="alt" button="alt"
className={'button-collection-order'} className={'button-collection-order'}
disabled={collectionIndex === 0} disabled={collectionIndex === 0 || collectionIsPending}
icon={ICONS.UP} icon={ICONS.UP}
onClick={(e) => { onClick={(e) => {
e.preventDefault(); e.preventDefault();
@ -363,7 +365,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
button="alt" button="alt"
className={'button-collection-order'} className={'button-collection-order'}
icon={ICONS.DOWN} icon={ICONS.DOWN}
disabled={collectionIndex === lastCollectionIndex} disabled={collectionIndex === lastCollectionIndex || collectionIsPending}
onClick={(e) => { onClick={(e) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
@ -379,6 +381,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
<div className="collection-preview__edit-group"> <div className="collection-preview__edit-group">
<Button <Button
button="alt" button="alt"
disabled={collectionIsPending}
icon={ICONS.DELETE} icon={ICONS.DELETE}
onClick={(e) => { onClick={(e) => {
e.preventDefault(); e.preventDefault();

View file

@ -81,7 +81,7 @@ export default function CollectionPage(props: Props) {
const pending = ( const pending = (
<div className="help card__title--help"> <div className="help card__title--help">
<Spinner type={'small'} /> <Spinner type={'small'} />
{__('Your publish is being confirmed and will be live soon')} {__('Please wait for confirmation before making further changes')}
</div> </div>
); );