add current page value to the state for channel pages (#116)
This commit is contained in:
parent
e07ab27b13
commit
76d8bbef96
5 changed files with 86 additions and 31 deletions
43
dist/bundle.js
vendored
43
dist/bundle.js
vendored
|
@ -89,8 +89,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.selectTransactionListFilter = exports.selectWalletUnlockResult = exports.selectWalletUnlockSucceeded = exports.selectWalletUnlockPending = exports.selectWalletDecryptResult = exports.selectWalletDecryptSucceeded = exports.selectWalletDecryptPending = exports.selectWalletEncryptResult = exports.selectWalletEncryptSucceeded = exports.selectWalletEncryptPending = exports.selectWalletState = exports.selectWalletIsEncrypted = exports.selectBlocks = exports.selectDraftTransactionError = exports.selectDraftTransactionAddress = exports.selectDraftTransactionAmount = exports.selectDraftTransaction = exports.selectGettingNewAddress = exports.selectReceiveAddress = exports.selectIsSendingSupport = exports.selectIsFetchingTransactions = exports.selectHasTransactions = exports.selectRecentTransactions = exports.selectTransactionItems = exports.selectTransactionsById = exports.selectBalance = exports.makeSelectBlockDate = exports.makeSelectQueryWithOptions = exports.selectSearchSuggestions = exports.selectSearchBarFocused = exports.selectWunderBarAddress = exports.selectSearchUrisByQuery = exports.selectIsSearching = exports.selectSearchOptions = exports.selectSearchValue = exports.selectSearchQuery = exports.makeSelectSearchUris = exports.selectSearchState = exports.selectActiveHistoryEntry = exports.selectHistoryStack = exports.selectHistoryIndex = exports.selectIsForwardDisabled = exports.selectIsBackDisabled = exports.selectPathAfterAuth = exports.selectPageTitle = exports.selectHeaderLinks = exports.selectCurrentParams = exports.selectCurrentPage = exports.selectCurrentPath = exports.makeSelectCurrentParam = exports.computePageFromPath = exports.selectFileListPublishedSort = exports.selectFileListDownloadedSort = exports.selectSearchDownloadUris = exports.selectTotalDownloadProgress = exports.selectDownloadingFileInfos = exports.selectFileInfosDownloaded = exports.selectUrisLoading = exports.selectDownloadingByOutpoint = exports.selectIsFetchingFileListDownloadedOrPublished = exports.selectIsFetchingFileList = exports.selectFileInfosByOutpoint = exports.makeSelectLoadingForUri = exports.makeSelectDownloadingForUri = exports.makeSelectFileInfoForUri = exports.selectFetchingCostInfo = exports.selectCostForCurrentPageUri = exports.selectAllCostInfoByUri = exports.makeSelectCostInfoForUri = exports.makeSelectFetchingCostInfoForUri = exports.selectChannelClaimCounts = exports.selectPlayingUri = exports.selectFetchingTrendingUris = exports.selectTrendingUris = exports.selectFetchingFeaturedUris = exports.selectFeaturedUris = exports.selectResolvingUris = exports.selectMyChannelClaims = exports.selectFetchingMyChannels = exports.selectMyClaimsOutpoints = exports.selectAllMyClaimsByOutpoint = exports.selectMyClaimsWithoutChannels = exports.selectMyClaims = exports.selectPendingClaims = exports.selectIsFetchingClaimListMine = exports.selectAllFetchingChannelClaims = exports.selectMyActiveClaims = undefined;
|
||||
exports.selectAbandoningIds = exports.selectMyClaimsRaw = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = exports.selectPendingById = exports.makeSelectPendingByUri = exports.makeSelectClaimIsPending = exports.makeSelectChannelForClaimUri = exports.makeSelectFirstRecommendedFileForUri = exports.makeSelectRecommendedContentForUri = exports.makeSelectNsfwCountForChannel = exports.makeSelectNsfwCountFromUris = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.makeSelectIsUriResolving = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForPage = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.makeSelectClaimForUri = exports.selectError = exports.selectToast = exports.selectBlackListedOutpoints = exports.blacklistReducer = exports.walletReducer = exports.searchReducer = exports.notificationsReducer = exports.fileInfoReducer = exports.costInfoReducer = exports.claimsReducer = exports.creditsToString = exports.formatFullPrice = exports.formatCredits = exports.toQueryString = exports.parseQueryParams = exports.batchActions = exports.doUpdateBlockHeight = exports.doSetTransactionListFilter = exports.doWalletStatus = exports.doWalletUnlock = exports.doWalletDecrypt = exports.doWalletEncrypt = exports.doSendTip = exports.doSetDraftTransactionAddress = exports.doSetDraftTransactionAmount = exports.doSendDraftTransaction = exports.doCheckAddressIsMine = exports.doGetNewAddress = exports.doFetchBlock = exports.doFetchTransactions = exports.doBalanceSubscribe = exports.doUpdateBalance = exports.doBlackListedOutpointsSubscribe = exports.doUpdateSearchOptions = exports.setSearchApi = exports.doBlurSearchInput = exports.doFocusSearchInput = exports.doUpdateSearchQuery = exports.doSearch = exports.doSetFileListSort = exports.doFetchFileInfosAndPublishedClaims = exports.doFileList = exports.doFetchFileInfo = exports.doFetchCostInfoForUri = exports.doFetchTrendingUris = exports.doFetchFeaturedUris = exports.doResolveUri = exports.doResolveUris = exports.doAbandonClaim = exports.doFetchClaimListMine = exports.doFetchClaimCountByChannel = exports.doFetchClaimsByChannel = exports.doDismissError = exports.doError = exports.doDismissToast = exports.doToast = exports.convertToShareLink = exports.isNameValid = exports.isURIClaimable = exports.isURIValid = exports.normalizeURI = exports.buildURI = exports.parseURI = exports.regexAddress = exports.regexInvalidURI = exports.Lbryapi = exports.Lbry = exports.PAGES = exports.SORT_OPTIONS = exports.TRANSACTIONS = exports.SETTINGS = exports.SEARCH_OPTIONS = exports.SEARCH_TYPES = exports.THUMBNAIL_STATUSES = exports.ACTIONS = exports.Toast = undefined;
|
||||
exports.selectTransactionListFilter = exports.selectWalletUnlockResult = exports.selectWalletUnlockSucceeded = exports.selectWalletUnlockPending = exports.selectWalletDecryptResult = exports.selectWalletDecryptSucceeded = exports.selectWalletDecryptPending = exports.selectWalletEncryptResult = exports.selectWalletEncryptSucceeded = exports.selectWalletEncryptPending = exports.selectWalletState = exports.selectWalletIsEncrypted = exports.selectBlocks = exports.selectDraftTransactionError = exports.selectDraftTransactionAddress = exports.selectDraftTransactionAmount = exports.selectDraftTransaction = exports.selectGettingNewAddress = exports.selectReceiveAddress = exports.selectIsSendingSupport = exports.selectIsFetchingTransactions = exports.selectHasTransactions = exports.selectRecentTransactions = exports.selectTransactionItems = exports.selectTransactionsById = exports.selectBalance = exports.makeSelectBlockDate = exports.makeSelectQueryWithOptions = exports.selectSearchSuggestions = exports.selectSearchBarFocused = exports.selectWunderBarAddress = exports.selectSearchUrisByQuery = exports.selectIsSearching = exports.selectSearchOptions = exports.selectSearchValue = exports.selectSearchQuery = exports.makeSelectSearchUris = exports.selectSearchState = exports.selectActiveHistoryEntry = exports.selectHistoryStack = exports.selectHistoryIndex = exports.selectIsForwardDisabled = exports.selectIsBackDisabled = exports.selectPathAfterAuth = exports.selectPageTitle = exports.selectHeaderLinks = exports.selectCurrentParams = exports.selectCurrentPage = exports.selectCurrentPath = exports.makeSelectCurrentParam = exports.computePageFromPath = exports.selectFileListPublishedSort = exports.selectFileListDownloadedSort = exports.selectSearchDownloadUris = exports.selectTotalDownloadProgress = exports.selectDownloadingFileInfos = exports.selectFileInfosDownloaded = exports.selectUrisLoading = exports.selectDownloadingByOutpoint = exports.selectIsFetchingFileListDownloadedOrPublished = exports.selectIsFetchingFileList = exports.selectFileInfosByOutpoint = exports.makeSelectLoadingForUri = exports.makeSelectDownloadingForUri = exports.makeSelectFileInfoForUri = exports.selectFetchingCostInfo = exports.selectCostForCurrentPageUri = exports.selectAllCostInfoByUri = exports.makeSelectCostInfoForUri = exports.makeSelectFetchingCostInfoForUri = exports.selectCurrentChannelPage = exports.selectChannelClaimCounts = exports.selectPlayingUri = exports.selectFetchingTrendingUris = exports.selectTrendingUris = exports.selectFetchingFeaturedUris = exports.selectFeaturedUris = exports.selectResolvingUris = exports.selectMyChannelClaims = exports.selectFetchingMyChannels = exports.selectMyClaimsOutpoints = exports.selectAllMyClaimsByOutpoint = exports.selectMyClaimsWithoutChannels = exports.selectMyClaims = exports.selectPendingClaims = exports.selectIsFetchingClaimListMine = exports.selectAllFetchingChannelClaims = exports.selectMyActiveClaims = exports.selectAbandoningIds = undefined;
|
||||
exports.selectMyClaimsRaw = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = exports.selectPendingById = exports.makeSelectClaimsInChannelForCurrentPageState = exports.makeSelectPendingByUri = exports.makeSelectClaimIsPending = exports.makeSelectChannelForClaimUri = exports.makeSelectFirstRecommendedFileForUri = exports.makeSelectRecommendedContentForUri = exports.makeSelectNsfwCountForChannel = exports.makeSelectNsfwCountFromUris = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.makeSelectIsUriResolving = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForPage = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.makeSelectClaimForUri = exports.selectError = exports.selectToast = exports.selectBlackListedOutpoints = exports.blacklistReducer = exports.walletReducer = exports.searchReducer = exports.notificationsReducer = exports.fileInfoReducer = exports.costInfoReducer = exports.claimsReducer = exports.creditsToString = exports.formatFullPrice = exports.formatCredits = exports.toQueryString = exports.parseQueryParams = exports.batchActions = exports.doUpdateBlockHeight = exports.doSetTransactionListFilter = exports.doWalletStatus = exports.doWalletUnlock = exports.doWalletDecrypt = exports.doWalletEncrypt = exports.doSendTip = exports.doSetDraftTransactionAddress = exports.doSetDraftTransactionAmount = exports.doSendDraftTransaction = exports.doCheckAddressIsMine = exports.doGetNewAddress = exports.doFetchBlock = exports.doFetchTransactions = exports.doBalanceSubscribe = exports.doUpdateBalance = exports.doBlackListedOutpointsSubscribe = exports.doUpdateSearchOptions = exports.setSearchApi = exports.doBlurSearchInput = exports.doFocusSearchInput = exports.doUpdateSearchQuery = exports.doSearch = exports.doSetFileListSort = exports.doFetchFileInfosAndPublishedClaims = exports.doFileList = exports.doFetchFileInfo = exports.doFetchCostInfoForUri = exports.doFetchTrendingUris = exports.doFetchFeaturedUris = exports.doResolveUri = exports.doResolveUris = exports.doAbandonClaim = exports.doFetchClaimListMine = exports.doFetchClaimCountByChannel = exports.doFetchClaimsByChannel = exports.doDismissError = exports.doError = exports.doDismissToast = exports.doToast = exports.convertToShareLink = exports.isNameValid = exports.isURIClaimable = exports.isURIValid = exports.normalizeURI = exports.buildURI = exports.parseURI = exports.regexAddress = exports.regexInvalidURI = exports.Lbryapi = exports.Lbry = exports.PAGES = exports.SORT_OPTIONS = exports.TRANSACTIONS = exports.SETTINGS = exports.SEARCH_OPTIONS = exports.SEARCH_TYPES = exports.THUMBNAIL_STATUSES = exports.ACTIONS = exports.Toast = undefined;
|
||||
|
||||
var _Notification = __webpack_require__(1);
|
||||
|
||||
|
@ -661,6 +661,12 @@ Object.defineProperty(exports, 'makeSelectPendingByUri', {
|
|||
return _claims3.makeSelectPendingByUri;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'makeSelectClaimsInChannelForCurrentPageState', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _claims3.makeSelectClaimsInChannelForCurrentPageState;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'selectPendingById', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
|
@ -799,6 +805,12 @@ Object.defineProperty(exports, 'selectChannelClaimCounts', {
|
|||
return _claims3.selectChannelClaimCounts;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'selectCurrentChannelPage', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _claims3.selectCurrentChannelPage;
|
||||
}
|
||||
});
|
||||
|
||||
var _cost_info3 = __webpack_require__(48);
|
||||
|
||||
|
@ -3305,7 +3317,7 @@ var objectKeys = Object.keys || function (obj) {
|
|||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.makeSelectChannelForClaimUri = exports.makeSelectFirstRecommendedFileForUri = exports.makeSelectRecommendedContentForUri = exports.makeSelectNsfwCountForChannel = exports.makeSelectNsfwCountFromUris = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.selectChannelClaimCounts = exports.selectPlayingUri = exports.selectFetchingTrendingUris = exports.selectTrendingUris = exports.selectFetchingFeaturedUris = exports.selectFeaturedUris = exports.makeSelectIsUriResolving = exports.selectResolvingUris = exports.selectMyChannelClaims = exports.selectFetchingMyChannels = exports.selectMyClaimsOutpoints = exports.selectAllMyClaimsByOutpoint = exports.selectMyClaimsWithoutChannels = exports.selectMyClaims = exports.selectIsFetchingClaimListMine = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectClaimsInChannelForPage = exports.makeSelectFetchingChannelClaims = exports.selectAllFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.selectMyActiveClaims = exports.selectAbandoningIds = exports.selectMyClaimsRaw = exports.makeSelectClaimForUri = exports.makeSelectPendingByUri = exports.makeSelectClaimIsPending = exports.selectPendingClaims = exports.selectPendingById = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = undefined;
|
||||
exports.makeSelectChannelForClaimUri = exports.makeSelectFirstRecommendedFileForUri = exports.makeSelectRecommendedContentForUri = exports.makeSelectNsfwCountForChannel = exports.makeSelectNsfwCountFromUris = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.selectChannelClaimCounts = exports.selectPlayingUri = exports.selectFetchingTrendingUris = exports.selectTrendingUris = exports.selectFetchingFeaturedUris = exports.selectFeaturedUris = exports.makeSelectIsUriResolving = exports.selectResolvingUris = exports.selectMyChannelClaims = exports.selectFetchingMyChannels = exports.selectMyClaimsOutpoints = exports.selectAllMyClaimsByOutpoint = exports.selectMyClaimsWithoutChannels = exports.selectMyClaims = exports.selectIsFetchingClaimListMine = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForCurrentPageState = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectClaimsInChannelForPage = exports.makeSelectFetchingChannelClaims = exports.selectAllFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.selectMyActiveClaims = exports.selectAbandoningIds = exports.selectMyClaimsRaw = exports.makeSelectClaimForUri = exports.makeSelectPendingByUri = exports.makeSelectClaimIsPending = exports.selectPendingClaims = exports.selectPendingById = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectCurrentChannelPage = exports.selectClaimsById = undefined;
|
||||
|
||||
var _lbryURI = __webpack_require__(3);
|
||||
|
||||
|
@ -3329,6 +3341,10 @@ var selectClaimsById = exports.selectClaimsById = (0, _reselect.createSelector)(
|
|||
return state.byId || {};
|
||||
});
|
||||
|
||||
var selectCurrentChannelPage = exports.selectCurrentChannelPage = (0, _reselect.createSelector)(selectState, function (state) {
|
||||
return state.currentChannelPage || 1;
|
||||
});
|
||||
|
||||
var selectClaimsByUri = exports.selectClaimsByUri = (0, _reselect.createSelector)(selectState, selectClaimsById, function (state, byId) {
|
||||
var byUri = state.claimsByUri || {};
|
||||
var claims = {};
|
||||
|
@ -3456,6 +3472,19 @@ var makeSelectClaimsInChannelForCurrentPage = exports.makeSelectClaimsInChannelF
|
|||
});
|
||||
};
|
||||
|
||||
var makeSelectClaimsInChannelForCurrentPageState = exports.makeSelectClaimsInChannelForCurrentPageState = function makeSelectClaimsInChannelForCurrentPageState(uri) {
|
||||
return (0, _reselect.createSelector)(selectClaimsById, selectAllClaimsByChannel, selectCurrentChannelPage, function (byId, allClaims, page) {
|
||||
var byChannel = allClaims[uri] || {};
|
||||
var claimIds = byChannel[page || 1];
|
||||
|
||||
if (!claimIds) return claimIds;
|
||||
|
||||
return claimIds.map(function (claimId) {
|
||||
return byId[claimId];
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
var makeSelectMetadataForUri = exports.makeSelectMetadataForUri = function makeSelectMetadataForUri(uri) {
|
||||
return (0, _reselect.createSelector)(makeSelectClaimForUri(uri), function (claim) {
|
||||
var metadata = claim && claim.value && claim.value.stream && claim.value.stream.metadata;
|
||||
|
@ -3686,7 +3715,7 @@ var selectCurrentPath = exports.selectCurrentPath = (0, _reselect.createSelector
|
|||
});
|
||||
|
||||
var computePageFromPath = exports.computePageFromPath = function computePageFromPath(path) {
|
||||
return path ? path.replace(/^\//, '').split('?')[0] : 1;
|
||||
return path ? path.replace(/^\//, '').split('?')[0] : '';
|
||||
};
|
||||
|
||||
var selectCurrentPage = exports.selectCurrentPage = (0, _reselect.createSelector)(selectCurrentPath, function (path) {
|
||||
|
@ -5745,7 +5774,8 @@ reducers[ACTIONS.FETCH_CHANNEL_CLAIMS_STARTED] = function (state, action) {
|
|||
fetchingChannelClaims[uri] = page;
|
||||
|
||||
return Object.assign({}, state, {
|
||||
fetchingChannelClaims: fetchingChannelClaims
|
||||
fetchingChannelClaims: fetchingChannelClaims,
|
||||
currentChannelPage: page
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -5782,7 +5812,8 @@ reducers[ACTIONS.FETCH_CHANNEL_CLAIMS_COMPLETED] = function (state, action) {
|
|||
claimsByChannel: claimsByChannel,
|
||||
byId: byId,
|
||||
fetchingChannelClaims: fetchingChannelClaims,
|
||||
claimsByUri: claimsByUri
|
||||
claimsByUri: claimsByUri,
|
||||
currentChannelPage: page
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -130,6 +130,7 @@ export {
|
|||
makeSelectChannelForClaimUri,
|
||||
makeSelectClaimIsPending,
|
||||
makeSelectPendingByUri,
|
||||
makeSelectClaimsInChannelForCurrentPageState,
|
||||
selectPendingById,
|
||||
selectClaimsById,
|
||||
selectClaimsByUri,
|
||||
|
@ -153,6 +154,7 @@ export {
|
|||
selectFetchingTrendingUris,
|
||||
selectPlayingUri,
|
||||
selectChannelClaimCounts,
|
||||
selectCurrentChannelPage,
|
||||
} from 'redux/selectors/claims';
|
||||
|
||||
export {
|
||||
|
|
|
@ -9,7 +9,7 @@ export function doUpdateBalance() {
|
|||
const {
|
||||
wallet: { balance: balanceInStore },
|
||||
} = getState();
|
||||
Lbry.account_balance().then((balanceAsString) => {
|
||||
Lbry.account_balance().then(balanceAsString => {
|
||||
const balance = parseFloat(balanceAsString);
|
||||
|
||||
if (balanceInStore !== balance) {
|
||||
|
@ -25,21 +25,21 @@ export function doUpdateBalance() {
|
|||
}
|
||||
|
||||
export function doBalanceSubscribe() {
|
||||
return (dispatch) => {
|
||||
return dispatch => {
|
||||
dispatch(doUpdateBalance());
|
||||
setInterval(() => dispatch(doUpdateBalance()), 5000);
|
||||
};
|
||||
}
|
||||
|
||||
export function doFetchTransactions() {
|
||||
return (dispatch) => {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_TRANSACTIONS_STARTED,
|
||||
});
|
||||
|
||||
Lbry.utxo_release()
|
||||
.then(() => Lbry.transaction_list())
|
||||
.then((results) => {
|
||||
.then(results => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_TRANSACTIONS_COMPLETED,
|
||||
data: {
|
||||
|
@ -51,8 +51,8 @@ export function doFetchTransactions() {
|
|||
}
|
||||
|
||||
export function doFetchBlock(height) {
|
||||
return (dispatch) => {
|
||||
Lbry.block_show({ height }).then((block) => {
|
||||
return dispatch => {
|
||||
Lbry.block_show({ height }).then(block => {
|
||||
dispatch({
|
||||
type: ACTIONS.FETCH_BLOCK_SUCCESS,
|
||||
data: { block },
|
||||
|
@ -62,13 +62,13 @@ export function doFetchBlock(height) {
|
|||
}
|
||||
|
||||
export function doGetNewAddress() {
|
||||
return (dispatch) => {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.GET_NEW_ADDRESS_STARTED,
|
||||
});
|
||||
|
||||
// Removed localStorage use, since address is expected to be stored in redux store
|
||||
Lbry.address_unused().then((address) => {
|
||||
Lbry.address_unused().then(address => {
|
||||
dispatch({
|
||||
type: ACTIONS.GET_NEW_ADDRESS_COMPLETED,
|
||||
data: { address },
|
||||
|
@ -78,12 +78,12 @@ export function doGetNewAddress() {
|
|||
}
|
||||
|
||||
export function doCheckAddressIsMine(address) {
|
||||
return (dispatch) => {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.CHECK_ADDRESS_IS_MINE_STARTED,
|
||||
});
|
||||
|
||||
Lbry.address_is_mine({ address }).then((isMine) => {
|
||||
Lbry.address_is_mine({ address }).then(isMine => {
|
||||
if (!isMine) dispatch(doGetNewAddress());
|
||||
|
||||
dispatch({
|
||||
|
@ -112,7 +112,7 @@ export function doSendDraftTransaction(address, amount) {
|
|||
type: ACTIONS.SEND_TRANSACTION_STARTED,
|
||||
});
|
||||
|
||||
const successCallback = (response) => {
|
||||
const successCallback = response => {
|
||||
if (response.txid) {
|
||||
dispatch({
|
||||
type: ACTIONS.SEND_TRANSACTION_COMPLETED,
|
||||
|
@ -138,7 +138,7 @@ export function doSendDraftTransaction(address, amount) {
|
|||
}
|
||||
};
|
||||
|
||||
const errorCallback = (error) => {
|
||||
const errorCallback = error => {
|
||||
dispatch({
|
||||
type: ACTIONS.SEND_TRANSACTION_FAILED,
|
||||
data: { error: error.message },
|
||||
|
@ -205,7 +205,7 @@ export function doSendTip(amount, claimId, uri, successCallback, errorCallback)
|
|||
}
|
||||
};
|
||||
|
||||
const error = (err) => {
|
||||
const error = err => {
|
||||
dispatch(
|
||||
doToast({
|
||||
message: __(`There was an error sending support funds.`),
|
||||
|
@ -237,12 +237,12 @@ export function doSendTip(amount, claimId, uri, successCallback, errorCallback)
|
|||
}
|
||||
|
||||
export function doWalletEncrypt(newPassword) {
|
||||
return (dispatch) => {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_ENCRYPT_START,
|
||||
});
|
||||
|
||||
Lbry.account_encrypt({ new_password: newPassword }).then((result) => {
|
||||
Lbry.account_encrypt({ new_password: newPassword }).then(result => {
|
||||
if (result === true) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_ENCRYPT_COMPLETED,
|
||||
|
@ -259,12 +259,12 @@ export function doWalletEncrypt(newPassword) {
|
|||
}
|
||||
|
||||
export function doWalletUnlock(password) {
|
||||
return (dispatch) => {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_UNLOCK_START,
|
||||
});
|
||||
|
||||
Lbry.account_unlock({ password }).then((result) => {
|
||||
Lbry.account_unlock({ password }).then(result => {
|
||||
if (result === true) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_UNLOCK_COMPLETED,
|
||||
|
@ -281,12 +281,12 @@ export function doWalletUnlock(password) {
|
|||
}
|
||||
|
||||
export function doWalletLock() {
|
||||
return (dispatch) => {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_LOCK_START,
|
||||
});
|
||||
|
||||
Lbry.wallet_lock().then((result) => {
|
||||
Lbry.wallet_lock().then(result => {
|
||||
if (result === true) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_LOCK_COMPLETED,
|
||||
|
@ -303,12 +303,12 @@ export function doWalletLock() {
|
|||
}
|
||||
|
||||
export function doWalletDecrypt() {
|
||||
return (dispatch) => {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_DECRYPT_START,
|
||||
});
|
||||
|
||||
Lbry.account_decrypt().then((result) => {
|
||||
Lbry.account_decrypt().then(result => {
|
||||
if (result === true) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_DECRYPT_COMPLETED,
|
||||
|
@ -325,12 +325,12 @@ export function doWalletDecrypt() {
|
|||
}
|
||||
|
||||
export function doWalletStatus() {
|
||||
return (dispatch) => {
|
||||
return dispatch => {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_STATUS_START,
|
||||
});
|
||||
|
||||
Lbry.status().then((status) => {
|
||||
Lbry.status().then(status => {
|
||||
if (status && status.wallet) {
|
||||
dispatch({
|
||||
type: ACTIONS.WALLET_STATUS_COMPLETED,
|
||||
|
@ -349,8 +349,8 @@ export function doSetTransactionListFilter(filterOption) {
|
|||
}
|
||||
|
||||
export function doUpdateBlockHeight() {
|
||||
return (dispatch) =>
|
||||
Lbry.status().then((status) => {
|
||||
return dispatch =>
|
||||
Lbry.status().then(status => {
|
||||
if (status.wallet) {
|
||||
dispatch({
|
||||
type: ACTIONS.UPDATE_CURRENT_HEIGHT,
|
||||
|
|
|
@ -115,6 +115,7 @@ reducers[ACTIONS.FETCH_CHANNEL_CLAIMS_STARTED] = (state, action) => {
|
|||
|
||||
return Object.assign({}, state, {
|
||||
fetchingChannelClaims,
|
||||
currentChannelPage: page,
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -148,6 +149,7 @@ reducers[ACTIONS.FETCH_CHANNEL_CLAIMS_COMPLETED] = (state, action) => {
|
|||
byId,
|
||||
fetchingChannelClaims,
|
||||
claimsByUri,
|
||||
currentChannelPage: page,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -9,6 +9,11 @@ const selectState = state => state.claims || {};
|
|||
|
||||
export const selectClaimsById = createSelector(selectState, state => state.byId || {});
|
||||
|
||||
export const selectCurrentChannelPage = createSelector(
|
||||
selectState,
|
||||
state => state.currentChannelPage || 1
|
||||
);
|
||||
|
||||
export const selectClaimsByUri = createSelector(selectState, selectClaimsById, (state, byId) => {
|
||||
const byUri = state.claimsByUri || {};
|
||||
const claims = {};
|
||||
|
@ -129,6 +134,21 @@ export const makeSelectClaimsInChannelForCurrentPage = uri => {
|
|||
);
|
||||
};
|
||||
|
||||
export const makeSelectClaimsInChannelForCurrentPageState = uri =>
|
||||
createSelector(
|
||||
selectClaimsById,
|
||||
selectAllClaimsByChannel,
|
||||
selectCurrentChannelPage,
|
||||
(byId, allClaims, page) => {
|
||||
const byChannel = allClaims[uri] || {};
|
||||
const claimIds = byChannel[page || 1];
|
||||
|
||||
if (!claimIds) return claimIds;
|
||||
|
||||
return claimIds.map(claimId => byId[claimId]);
|
||||
}
|
||||
);
|
||||
|
||||
export const makeSelectMetadataForUri = uri =>
|
||||
createSelector(makeSelectClaimForUri(uri), claim => {
|
||||
const metadata = claim && claim.value && claim.value.stream && claim.value.stream.metadata;
|
||||
|
|
Loading…
Reference in a new issue