Removes block show and fixes download search selector #139
3 changed files with 112 additions and 123 deletions
67
dist/bundle.es.js
vendored
67
dist/bundle.es.js
vendored
|
@ -50,7 +50,6 @@ const CHECK_ADDRESS_IS_MINE_COMPLETED = 'CHECK_ADDRESS_IS_MINE_COMPLETED';
|
||||||
const SEND_TRANSACTION_STARTED = 'SEND_TRANSACTION_STARTED';
|
const SEND_TRANSACTION_STARTED = 'SEND_TRANSACTION_STARTED';
|
||||||
const SEND_TRANSACTION_COMPLETED = 'SEND_TRANSACTION_COMPLETED';
|
const SEND_TRANSACTION_COMPLETED = 'SEND_TRANSACTION_COMPLETED';
|
||||||
const SEND_TRANSACTION_FAILED = 'SEND_TRANSACTION_FAILED';
|
const SEND_TRANSACTION_FAILED = 'SEND_TRANSACTION_FAILED';
|
||||||
const FETCH_BLOCK_SUCCESS = 'FETCH_BLOCK_SUCCESS';
|
|
||||||
const SUPPORT_TRANSACTION_STARTED = 'SUPPORT_TRANSACTION_STARTED';
|
const SUPPORT_TRANSACTION_STARTED = 'SUPPORT_TRANSACTION_STARTED';
|
||||||
const SUPPORT_TRANSACTION_COMPLETED = 'SUPPORT_TRANSACTION_COMPLETED';
|
const SUPPORT_TRANSACTION_COMPLETED = 'SUPPORT_TRANSACTION_COMPLETED';
|
||||||
const SUPPORT_TRANSACTION_FAILED = 'SUPPORT_TRANSACTION_FAILED';
|
const SUPPORT_TRANSACTION_FAILED = 'SUPPORT_TRANSACTION_FAILED';
|
||||||
|
@ -262,7 +261,6 @@ var action_types = /*#__PURE__*/Object.freeze({
|
||||||
SEND_TRANSACTION_STARTED: SEND_TRANSACTION_STARTED,
|
SEND_TRANSACTION_STARTED: SEND_TRANSACTION_STARTED,
|
||||||
SEND_TRANSACTION_COMPLETED: SEND_TRANSACTION_COMPLETED,
|
SEND_TRANSACTION_COMPLETED: SEND_TRANSACTION_COMPLETED,
|
||||||
SEND_TRANSACTION_FAILED: SEND_TRANSACTION_FAILED,
|
SEND_TRANSACTION_FAILED: SEND_TRANSACTION_FAILED,
|
||||||
FETCH_BLOCK_SUCCESS: FETCH_BLOCK_SUCCESS,
|
|
||||||
SUPPORT_TRANSACTION_STARTED: SUPPORT_TRANSACTION_STARTED,
|
SUPPORT_TRANSACTION_STARTED: SUPPORT_TRANSACTION_STARTED,
|
||||||
SUPPORT_TRANSACTION_COMPLETED: SUPPORT_TRANSACTION_COMPLETED,
|
SUPPORT_TRANSACTION_COMPLETED: SUPPORT_TRANSACTION_COMPLETED,
|
||||||
SUPPORT_TRANSACTION_FAILED: SUPPORT_TRANSACTION_FAILED,
|
SUPPORT_TRANSACTION_FAILED: SUPPORT_TRANSACTION_FAILED,
|
||||||
|
@ -1233,6 +1231,15 @@ const makeSelectMetadataForUri = uri => reselect.createSelector(makeSelectClaimF
|
||||||
|
|
||||||
const makeSelectTitleForUri = uri => reselect.createSelector(makeSelectMetadataForUri(uri), metadata => metadata && metadata.title);
|
const makeSelectTitleForUri = uri => reselect.createSelector(makeSelectMetadataForUri(uri), metadata => metadata && metadata.title);
|
||||||
|
|
||||||
|
const makeSelectDateForUri = uri => reselect.createSelector(makeSelectClaimForUri(uri), claim => {
|
||||||
|
const timestamp = claim && claim.timestamp ? claim.timestamp * 1000 : undefined;
|
||||||
|
if (!timestamp) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
const dateObj = new Date(timestamp);
|
||||||
|
return dateObj;
|
||||||
|
});
|
||||||
|
|
||||||
const makeSelectContentTypeForUri = uri => reselect.createSelector(makeSelectClaimForUri(uri), claim => {
|
const makeSelectContentTypeForUri = uri => reselect.createSelector(makeSelectClaimForUri(uri), claim => {
|
||||||
const source = claim && claim.value && claim.value.source;
|
const source = claim && claim.value && claim.value.source;
|
||||||
return source ? source.media_type : undefined;
|
return source ? source.media_type : undefined;
|
||||||
|
@ -1510,26 +1517,6 @@ const selectBlocks = reselect.createSelector(selectState$2, state => state.block
|
||||||
|
|
||||||
const selectCurrentHeight = reselect.createSelector(selectState$2, state => state.latestBlock);
|
const selectCurrentHeight = reselect.createSelector(selectState$2, state => state.latestBlock);
|
||||||
|
|
||||||
const makeSelectBlockDate = block => reselect.createSelector(selectBlocks, selectCurrentHeight, (blocks, latestBlock) => {
|
|
||||||
// If we have the block data, look at the actual date,
|
|
||||||
// If not, try to simulate it based on 2.5 minute blocks
|
|
||||||
// Adding this on 11/7/2018 because caling block_show for every claim is causing
|
|
||||||
// performance issues.
|
|
||||||
if (blocks && blocks[block]) {
|
|
||||||
return new Date(blocks[block].time * 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pending claim
|
|
||||||
if (block < 1) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const difference = latestBlock - block;
|
|
||||||
const msSincePublish = difference * 2.5 * 60 * 1000; // Number of blocks * 2.5 minutes in ms
|
|
||||||
const publishDate = Date.now() - msSincePublish;
|
|
||||||
return new Date(publishDate);
|
|
||||||
});
|
|
||||||
|
|
||||||
const selectTransactionListFilter = reselect.createSelector(selectState$2, state => state.transactionListFilter || '');
|
const selectTransactionListFilter = reselect.createSelector(selectState$2, state => state.transactionListFilter || '');
|
||||||
|
|
||||||
function formatCredits(amount, precision) {
|
function formatCredits(amount, precision) {
|
||||||
|
@ -1631,17 +1618,6 @@ function doFetchTransactions() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function doFetchBlock(height) {
|
|
||||||
return dispatch => {
|
|
||||||
lbryProxy.block_show({ height }).then(block => {
|
|
||||||
dispatch({
|
|
||||||
type: FETCH_BLOCK_SUCCESS,
|
|
||||||
data: { block }
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function doGetNewAddress() {
|
function doGetNewAddress() {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch({
|
dispatch({
|
||||||
|
@ -2235,14 +2211,18 @@ const selectSearchDownloadUris = query => reselect.createSelector(selectFileInfo
|
||||||
});
|
});
|
||||||
|
|
||||||
return downloadResultsFromQuery.length ? downloadResultsFromQuery.map(fileInfo => {
|
return downloadResultsFromQuery.length ? downloadResultsFromQuery.map(fileInfo => {
|
||||||
const { channel_name: channelName, claim_id: claimId, claim_name: claimName } = fileInfo;
|
const {
|
||||||
|
channel_name: channelName,
|
||||||
|
claim_id: claimId,
|
||||||
|
claim_name: claimName
|
||||||
|
} = fileInfo;
|
||||||
|
|
||||||
const uriParams = {};
|
const uriParams = {};
|
||||||
|
|
||||||
if (channelName) {
|
if (channelName) {
|
||||||
const claim = claimsById[claimId];
|
const claim = claimsById[claimId];
|
||||||
if (claim && claim.value) {
|
if (claim && claim.signing_channel) {
|
||||||
uriParams.claimId = claim.value.publisherSignature.certificateId;
|
uriParams.claimId = claim.signing_channel.claim_id;
|
||||||
} else {
|
} else {
|
||||||
uriParams.claimId = claimId;
|
uriParams.claimId = claimId;
|
||||||
}
|
}
|
||||||
|
@ -3256,18 +3236,6 @@ reducers$2[SUPPORT_TRANSACTION_FAILED] = (state, action) => Object.assign({}, st
|
||||||
sendingSupport: false
|
sendingSupport: false
|
||||||
});
|
});
|
||||||
|
|
||||||
reducers$2[FETCH_BLOCK_SUCCESS] = (state, action) => {
|
|
||||||
const {
|
|
||||||
block,
|
|
||||||
block: { height }
|
|
||||||
} = action.data;
|
|
||||||
const blocks = Object.assign({}, state.blocks);
|
|
||||||
|
|
||||||
blocks[height] = block;
|
|
||||||
|
|
||||||
return Object.assign({}, state, { blocks });
|
|
||||||
};
|
|
||||||
|
|
||||||
reducers$2[WALLET_STATUS_COMPLETED] = (state, action) => Object.assign({}, state, {
|
reducers$2[WALLET_STATUS_COMPLETED] = (state, action) => Object.assign({}, state, {
|
||||||
walletIsEncrypted: action.result
|
walletIsEncrypted: action.result
|
||||||
});
|
});
|
||||||
|
@ -3442,7 +3410,6 @@ exports.doCreateChannel = doCreateChannel;
|
||||||
exports.doDismissError = doDismissError;
|
exports.doDismissError = doDismissError;
|
||||||
exports.doDismissToast = doDismissToast;
|
exports.doDismissToast = doDismissToast;
|
||||||
exports.doError = doError;
|
exports.doError = doError;
|
||||||
exports.doFetchBlock = doFetchBlock;
|
|
||||||
exports.doFetchChannelListMine = doFetchChannelListMine;
|
exports.doFetchChannelListMine = doFetchChannelListMine;
|
||||||
exports.doFetchClaimListMine = doFetchClaimListMine;
|
exports.doFetchClaimListMine = doFetchClaimListMine;
|
||||||
exports.doFetchClaimsByChannel = doFetchClaimsByChannel;
|
exports.doFetchClaimsByChannel = doFetchClaimsByChannel;
|
||||||
|
@ -3478,7 +3445,6 @@ exports.formatFullPrice = formatFullPrice;
|
||||||
exports.isNameValid = isNameValid;
|
exports.isNameValid = isNameValid;
|
||||||
exports.isURIClaimable = isURIClaimable;
|
exports.isURIClaimable = isURIClaimable;
|
||||||
exports.isURIValid = isURIValid;
|
exports.isURIValid = isURIValid;
|
||||||
exports.makeSelectBlockDate = makeSelectBlockDate;
|
|
||||||
exports.makeSelectChannelForClaimUri = makeSelectChannelForClaimUri;
|
exports.makeSelectChannelForClaimUri = makeSelectChannelForClaimUri;
|
||||||
exports.makeSelectClaimForUri = makeSelectClaimForUri;
|
exports.makeSelectClaimForUri = makeSelectClaimForUri;
|
||||||
exports.makeSelectClaimIsMine = makeSelectClaimIsMine;
|
exports.makeSelectClaimIsMine = makeSelectClaimIsMine;
|
||||||
|
@ -3489,6 +3455,7 @@ exports.makeSelectClaimsInChannelForPage = makeSelectClaimsInChannelForPage;
|
||||||
exports.makeSelectContentPositionForUri = makeSelectContentPositionForUri;
|
exports.makeSelectContentPositionForUri = makeSelectContentPositionForUri;
|
||||||
exports.makeSelectContentTypeForUri = makeSelectContentTypeForUri;
|
exports.makeSelectContentTypeForUri = makeSelectContentTypeForUri;
|
||||||
exports.makeSelectCoverForUri = makeSelectCoverForUri;
|
exports.makeSelectCoverForUri = makeSelectCoverForUri;
|
||||||
|
exports.makeSelectDateForUri = makeSelectDateForUri;
|
||||||
exports.makeSelectDownloadingForUri = makeSelectDownloadingForUri;
|
exports.makeSelectDownloadingForUri = makeSelectDownloadingForUri;
|
||||||
exports.makeSelectFetchingChannelClaims = makeSelectFetchingChannelClaims;
|
exports.makeSelectFetchingChannelClaims = makeSelectFetchingChannelClaims;
|
||||||
exports.makeSelectFileInfoForUri = makeSelectFileInfoForUri;
|
exports.makeSelectFileInfoForUri = makeSelectFileInfoForUri;
|
||||||
|
|
1
dist/flow-typed/Claim.js
vendored
1
dist/flow-typed/Claim.js
vendored
|
@ -31,6 +31,7 @@ declare type GenericClaim = {
|
||||||
decoded_claim: boolean, // claim made in accordance with sdk protobuf types
|
decoded_claim: boolean, // claim made in accordance with sdk protobuf types
|
||||||
depth: number, // confirmations since tx
|
depth: number, // confirmations since tx
|
||||||
effective_amount: number, // bid amount + supports
|
effective_amount: number, // bid amount + supports
|
||||||
|
timestamp?: number, // date of transaction
|
||||||
has_signature: boolean,
|
has_signature: boolean,
|
||||||
height: number, // block height the tx was confirmed
|
height: number, // block height the tx was confirmed
|
||||||
hex: string, // `value` hex encoded
|
hex: string, // `value` hex encoded
|
||||||
|
|
|
@ -26,11 +26,15 @@ export const selectIsFetchingFileListDownloadedOrPublished = createSelector(
|
||||||
);
|
);
|
||||||
|
|
||||||
export const makeSelectFileInfoForUri = uri =>
|
export const makeSelectFileInfoForUri = uri =>
|
||||||
createSelector(selectClaimsByUri, selectFileInfosByOutpoint, (claims, byOutpoint) => {
|
createSelector(
|
||||||
|
selectClaimsByUri,
|
||||||
|
selectFileInfosByOutpoint,
|
||||||
|
(claims, byOutpoint) => {
|
||||||
const claim = claims[uri];
|
const claim = claims[uri];
|
||||||
const outpoint = claim ? `${claim.txid}:${claim.nout}` : undefined;
|
const outpoint = claim ? `${claim.txid}:${claim.nout}` : undefined;
|
||||||
return outpoint ? byOutpoint[outpoint] : undefined;
|
return outpoint ? byOutpoint[outpoint] : undefined;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
export const selectDownloadingByOutpoint = createSelector(
|
export const selectDownloadingByOutpoint = createSelector(
|
||||||
selectState,
|
selectState,
|
||||||
|
@ -47,10 +51,16 @@ export const makeSelectDownloadingForUri = uri =>
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export const selectUrisLoading = createSelector(selectState, state => state.urisLoading || {});
|
export const selectUrisLoading = createSelector(
|
||||||
|
selectState,
|
||||||
|
state => state.urisLoading || {}
|
||||||
|
);
|
||||||
|
|
||||||
export const makeSelectLoadingForUri = uri =>
|
export const makeSelectLoadingForUri = uri =>
|
||||||
createSelector(selectUrisLoading, byUri => byUri && byUri[uri]);
|
createSelector(
|
||||||
|
selectUrisLoading,
|
||||||
|
byUri => byUri && byUri[uri]
|
||||||
|
);
|
||||||
|
|
||||||
export const selectFileInfosDownloaded = createSelector(
|
export const selectFileInfosDownloaded = createSelector(
|
||||||
selectFileInfosByOutpoint,
|
selectFileInfosByOutpoint,
|
||||||
|
@ -93,7 +103,9 @@ export const selectDownloadingFileInfos = createSelector(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export const selectTotalDownloadProgress = createSelector(selectDownloadingFileInfos, fileInfos => {
|
export const selectTotalDownloadProgress = createSelector(
|
||||||
|
selectDownloadingFileInfos,
|
||||||
|
fileInfos => {
|
||||||
const progress = [];
|
const progress = [];
|
||||||
|
|
||||||
fileInfos.forEach(fileInfo => {
|
fileInfos.forEach(fileInfo => {
|
||||||
|
@ -104,10 +116,14 @@ export const selectTotalDownloadProgress = createSelector(selectDownloadingFileI
|
||||||
|
|
||||||
if (fileInfos.length > 0) return totalProgress / fileInfos.length / 100.0;
|
if (fileInfos.length > 0) return totalProgress / fileInfos.length / 100.0;
|
||||||
return -1;
|
return -1;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
export const selectSearchDownloadUris = query =>
|
export const selectSearchDownloadUris = query =>
|
||||||
createSelector(selectFileInfosDownloaded, selectClaimsById, (fileInfos, claimsById) => {
|
createSelector(
|
||||||
|
selectFileInfosDownloaded,
|
||||||
|
selectClaimsById,
|
||||||
|
(fileInfos, claimsById) => {
|
||||||
if (!query || !fileInfos.length) {
|
if (!query || !fileInfos.length) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -172,14 +188,18 @@ export const selectSearchDownloadUris = query =>
|
||||||
|
|
||||||
return downloadResultsFromQuery.length
|
return downloadResultsFromQuery.length
|
||||||
? downloadResultsFromQuery.map(fileInfo => {
|
? downloadResultsFromQuery.map(fileInfo => {
|
||||||
const { channel_name: channelName, claim_id: claimId, claim_name: claimName } = fileInfo;
|
const {
|
||||||
|
channel_name: channelName,
|
||||||
|
claim_id: claimId,
|
||||||
|
claim_name: claimName,
|
||||||
|
} = fileInfo;
|
||||||
|
|
||||||
const uriParams = {};
|
const uriParams = {};
|
||||||
|
|
||||||
if (channelName) {
|
if (channelName) {
|
||||||
const claim = claimsById[claimId];
|
const claim = claimsById[claimId];
|
||||||
if (claim && claim.value) {
|
if (claim && claim.signing_channel) {
|
||||||
uriParams.claimId = claim.value.publisherSignature.certificateId;
|
uriParams.claimId = claim.signing_channel.claim_id;
|
||||||
} else {
|
} else {
|
||||||
uriParams.claimId = claimId;
|
uriParams.claimId = claimId;
|
||||||
}
|
}
|
||||||
|
@ -194,7 +214,8 @@ export const selectSearchDownloadUris = query =>
|
||||||
return uri;
|
return uri;
|
||||||
})
|
})
|
||||||
: null;
|
: null;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
export const selectFileListPublishedSort = createSelector(
|
export const selectFileListPublishedSort = createSelector(
|
||||||
selectState,
|
selectState,
|
||||||
|
|
Loading…
Reference in a new issue