disable file remove/abandon while abandoning
This commit is contained in:
parent
269852ea3b
commit
4dbfbbee00
2 changed files with 11 additions and 6 deletions
|
@ -1,6 +1,11 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doDeleteFileAndMaybeGoBack } from 'redux/actions/file';
|
||||
import { makeSelectTitleForUri, makeSelectClaimIsMine, makeSelectClaimForUri } from 'lbry-redux';
|
||||
import {
|
||||
makeSelectTitleForUri,
|
||||
makeSelectClaimIsMine,
|
||||
makeSelectClaimForUri,
|
||||
makeSelectIsAbandoningClaimForUri,
|
||||
} from 'lbry-redux';
|
||||
import { doHideModal } from 'redux/actions/app';
|
||||
import ModalRemoveFile from './view';
|
||||
|
||||
|
@ -8,6 +13,7 @@ const select = (state, props) => ({
|
|||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
title: makeSelectTitleForUri(props.uri)(state),
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
isAbandoning: makeSelectIsAbandoningClaimForUri(props.uri)(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
|
@ -17,7 +23,4 @@ const perform = dispatch => ({
|
|||
},
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
)(ModalRemoveFile);
|
||||
export default connect(select, perform)(ModalRemoveFile);
|
||||
|
|
|
@ -17,10 +17,11 @@ type Props = {
|
|||
fileInfo?: {
|
||||
outpoint: ?string,
|
||||
},
|
||||
isAbandoning: boolean,
|
||||
};
|
||||
|
||||
function ModalRemoveFile(props: Props) {
|
||||
const { uri, claimIsMine, closeModal, deleteFile, title, claim } = props;
|
||||
const { uri, claimIsMine, closeModal, deleteFile, title, claim, isAbandoning } = props;
|
||||
const [deleteChecked, setDeleteChecked] = usePersistedState('modal-remove-file:delete', true);
|
||||
const [abandonChecked, setAbandonChecked] = usePersistedState('modal-remove-file:abandon', true);
|
||||
|
||||
|
@ -78,6 +79,7 @@ function ModalRemoveFile(props: Props) {
|
|||
<Button
|
||||
button="primary"
|
||||
label={__('OK')}
|
||||
disabled={isAbandoning}
|
||||
onClick={() => deleteFile(uri, deleteChecked, claimIsMine ? abandonChecked : false)}
|
||||
/>
|
||||
<Button button="link" label={__('Cancel')} onClick={closeModal} />
|
||||
|
|
Loading…
Reference in a new issue