improve abandon callback
This commit is contained in:
parent
fdd20ef350
commit
f880922a25
5 changed files with 17 additions and 28 deletions
|
@ -130,7 +130,7 @@
|
|||
"imagesloaded": "^4.1.4",
|
||||
"json-loader": "^0.5.4",
|
||||
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
||||
"lbry-redux": "lbryio/lbry-redux#c51483f4171f0056da65193f979a483248a68297",
|
||||
"lbry-redux": "lbryio/lbry-redux#cd3fa330663a21e21cb36f29104ab2a408d5412d",
|
||||
"lbryinc": "lbryio/lbryinc#12aefaa14343d2f3eac01f2683701f58e53f1848",
|
||||
"lint-staged": "^7.0.2",
|
||||
"localforage": "^1.7.1",
|
||||
|
|
|
@ -1129,16 +1129,7 @@
|
|||
"How much would you like to unlock?": "How much would you like to unlock?",
|
||||
"A prudent choice": "A prudent choice",
|
||||
"Join": "Join",
|
||||
"File Details": "File Details",
|
||||
"You can unlock all or some of this LBC at any time.": "You can unlock all or some of this LBC at any time.",
|
||||
"Keeping it locked improves the trust and discoverability of your content.": "Keeping it locked improves the trust and discoverability of your content.",
|
||||
"It's usually only worth unlocking what you intend to use immediately. %learn_more%": "It's usually only worth unlocking what you intend to use immediately. %learn_more%",
|
||||
"%amount% available to unlock": "%amount% available to unlock",
|
||||
"%message% hihi": "%message% hihi",
|
||||
"Comrade Yrbl, we have a problem": "Comrade Yrbl, we have a problem",
|
||||
"How much would you like to unlock?": "How much would you like to unlock?",
|
||||
"A prudent choice": "A prudent choice",
|
||||
"Preparing your content": "Preparing your content",
|
||||
"New History": "New History",
|
||||
"Share on LinkedIn": "Share on LinkedIn",
|
||||
"Embed this content": "Embed this content",
|
||||
|
@ -1164,12 +1155,6 @@
|
|||
"Reposts": "Reposts",
|
||||
"lbry": "lbry",
|
||||
"Default": "Default",
|
||||
"chillstep": "chillstep",
|
||||
"economics": "economics",
|
||||
"education": "education",
|
||||
"linux": "linux",
|
||||
"math": "math",
|
||||
"news": "news",
|
||||
"science": "science",
|
||||
"Amount (LBC)": "Amount (LBC)"
|
||||
"Amount (LBC)": "Amount (LBC)",
|
||||
"Register": "Register"
|
||||
}
|
||||
|
|
|
@ -5,11 +5,12 @@ import ButtonTransaction from 'component/common/transaction-link';
|
|||
import CreditAmount from 'component/common/credit-amount';
|
||||
import DateTime from 'component/dateTime';
|
||||
import Button from 'component/button';
|
||||
import { buildURI, parseURI, TXO_LIST as TXO } from 'lbry-redux';
|
||||
import Spinner from 'component/spinner';
|
||||
import { buildURI, parseURI, TXO_LIST as TXO, TXO_ABANDON_STATES as TXO_STATES } from 'lbry-redux';
|
||||
|
||||
type Props = {
|
||||
txo: Txo,
|
||||
revokeClaim: (Txo, () => void) => void,
|
||||
revokeClaim: (Txo, (string) => void) => void,
|
||||
isRevokeable: boolean,
|
||||
reward: ?{
|
||||
reward_title: string,
|
||||
|
@ -17,22 +18,26 @@ type Props = {
|
|||
};
|
||||
|
||||
type State = {
|
||||
disabled: boolean,
|
||||
abandonState: string,
|
||||
};
|
||||
|
||||
class TxoListItem extends React.PureComponent<Props, State> {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = { disabled: false };
|
||||
this.state = { abandonState: TXO_STATES.READY };
|
||||
(this: any).abandonClaim = this.abandonClaim.bind(this);
|
||||
(this: any).getLink = this.getLink.bind(this);
|
||||
}
|
||||
|
||||
getLink(type: string) {
|
||||
const { abandonState } = this.state;
|
||||
if (this.state.abandonState === TXO_STATES.PENDING) {
|
||||
return <Spinner type={'small'} />;
|
||||
}
|
||||
if (type === TXO.SUPPORT) {
|
||||
return (
|
||||
<Button
|
||||
disabled={this.state.disabled}
|
||||
disabled={abandonState === TXO_STATES.DONE || abandonState === TXO_STATES.ERROR}
|
||||
button="secondary"
|
||||
icon={ICONS.UNLOCK}
|
||||
onClick={this.abandonClaim}
|
||||
|
@ -43,7 +48,7 @@ class TxoListItem extends React.PureComponent<Props, State> {
|
|||
const abandonTitle = type === TXO.SUPPORT ? 'Abandon Support' : 'Abandon Claim';
|
||||
return (
|
||||
<Button
|
||||
disabled={this.state.disabled}
|
||||
disabled={abandonState === TXO_STATES.DONE || abandonState === TXO_STATES.ERROR}
|
||||
button="secondary"
|
||||
icon={ICONS.DELETE}
|
||||
onClick={this.abandonClaim}
|
||||
|
@ -53,7 +58,7 @@ class TxoListItem extends React.PureComponent<Props, State> {
|
|||
}
|
||||
|
||||
abandonClaim() {
|
||||
this.props.revokeClaim(this.props.txo, () => this.setState({ disabled: true }));
|
||||
this.props.revokeClaim(this.props.txo, st => this.setState({ abandonState: st }));
|
||||
// this.setState({ disabled: true }); // just flag the item disabled
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import Spinner from 'component/spinner';
|
|||
type Props = {
|
||||
emptyMessage: ?string,
|
||||
loading: boolean,
|
||||
openModal: (id: string, { tx: Txo }) => void,
|
||||
openModal: (id: string, { tx: Txo, cb: string => void }) => void,
|
||||
rewards: {},
|
||||
txos: Array<Txo>,
|
||||
};
|
||||
|
@ -14,7 +14,7 @@ type Props = {
|
|||
function TransactionListTable(props: Props) {
|
||||
const { emptyMessage, rewards, loading, txos } = props;
|
||||
const REVOCABLE_TYPES = ['channel', 'stream', 'repost', 'support', 'claim'];
|
||||
function revokeClaim(tx: any, cb: () => void) {
|
||||
function revokeClaim(tx: any, cb: string => void) {
|
||||
props.openModal(MODALS.CONFIRM_CLAIM_REVOKE, { tx, cb });
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ type Delta = {
|
|||
function TxoList(props: Props) {
|
||||
const { search, txoPage, txoItemCount, fetchTxoPage, updateTxoPageParams, history } = props;
|
||||
|
||||
console.log('txoPage', txoPage);
|
||||
// parse urlParams
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const page = urlParams.get(TXO.PAGE) || String(1);
|
||||
|
|
Loading…
Reference in a new issue