remove tags from redux (to desktop)

This commit is contained in:
jessop 2020-10-12 09:26:31 -04:00 committed by Sean Yesmunt
parent 1fc5afa0c4
commit 04789190b0
6 changed files with 53 additions and 358 deletions

239
dist/bundle.es.js vendored
View file

@ -287,11 +287,6 @@ const FETCH_COST_INFO_STARTED = 'FETCH_COST_INFO_STARTED';
const FETCH_COST_INFO_COMPLETED = 'FETCH_COST_INFO_COMPLETED'; const FETCH_COST_INFO_COMPLETED = 'FETCH_COST_INFO_COMPLETED';
const FETCH_COST_INFO_FAILED = 'FETCH_COST_INFO_FAILED'; const FETCH_COST_INFO_FAILED = 'FETCH_COST_INFO_FAILED';
// Tags
const TOGGLE_TAG_FOLLOW = 'TOGGLE_TAG_FOLLOW';
const TAG_ADD = 'TAG_ADD';
const TAG_DELETE = 'TAG_DELETE';
// Sync // Sync
const USER_STATE_POPULATE = 'USER_STATE_POPULATE'; const USER_STATE_POPULATE = 'USER_STATE_POPULATE';
@ -534,9 +529,6 @@ var action_types = /*#__PURE__*/Object.freeze({
FETCH_COST_INFO_STARTED: FETCH_COST_INFO_STARTED, FETCH_COST_INFO_STARTED: FETCH_COST_INFO_STARTED,
FETCH_COST_INFO_COMPLETED: FETCH_COST_INFO_COMPLETED, FETCH_COST_INFO_COMPLETED: FETCH_COST_INFO_COMPLETED,
FETCH_COST_INFO_FAILED: FETCH_COST_INFO_FAILED, FETCH_COST_INFO_FAILED: FETCH_COST_INFO_FAILED,
TOGGLE_TAG_FOLLOW: TOGGLE_TAG_FOLLOW,
TAG_ADD: TAG_ADD,
TAG_DELETE: TAG_DELETE,
USER_STATE_POPULATE: USER_STATE_POPULATE USER_STATE_POPULATE: USER_STATE_POPULATE
}); });
@ -4634,29 +4626,6 @@ function savePosition(claimId, outpoint, position) {
// //
const doToggleTagFollow = name => ({
type: TOGGLE_TAG_FOLLOW,
data: {
name
}
});
const doAddTag = name => ({
type: TAG_ADD,
data: {
name
}
});
const doDeleteTag = name => ({
type: TAG_DELETE,
data: {
name
}
});
//
function parseQueryParams(queryString) { function parseQueryParams(queryString) {
if (queryString === '') return {}; if (queryString === '') return {};
const parts = queryString.split('?').pop().split('&').map(p => p.split('=')); const parts = queryString.split('?').pop().split('&').map(p => p.split('='));
@ -5707,73 +5676,6 @@ const publishReducer = handleActions({
var _extends$d = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _extends$d = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function getDefaultKnownTags() {
return DEFAULT_FOLLOWED_TAGS.concat(DEFAULT_KNOWN_TAGS).reduce((tagsMap, tag) => _extends$d({}, tagsMap, {
[tag]: { name: tag }
}), {});
}
const defaultState$5 = {
followedTags: [],
knownTags: getDefaultKnownTags()
};
const tagsReducer = handleActions({
[TOGGLE_TAG_FOLLOW]: (state, action) => {
const { followedTags } = state;
const { name } = action.data;
let newFollowedTags = followedTags.slice();
if (newFollowedTags.includes(name)) {
newFollowedTags = newFollowedTags.filter(tag => tag !== name);
} else {
newFollowedTags.push(name);
}
return _extends$d({}, state, {
followedTags: newFollowedTags
});
},
[TAG_ADD]: (state, action) => {
const { knownTags } = state;
const { name } = action.data;
let newKnownTags = _extends$d({}, knownTags);
newKnownTags[name] = { name };
return _extends$d({}, state, {
knownTags: newKnownTags
});
},
[TAG_DELETE]: (state, action) => {
const { knownTags, followedTags } = state;
const { name } = action.data;
let newKnownTags = _extends$d({}, knownTags);
delete newKnownTags[name];
const newFollowedTags = followedTags.filter(tag => tag !== name);
return _extends$d({}, state, {
knownTags: newKnownTags,
followedTags: newFollowedTags
});
},
[USER_STATE_POPULATE]: (state, action) => {
const { tags } = action.data;
if (Array.isArray(tags)) {
return _extends$d({}, state, {
followedTags: tags
});
}
return _extends$d({}, state);
}
}, defaultState$5);
var _extends$e = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const buildDraftTransaction = () => ({ const buildDraftTransaction = () => ({
amount: undefined, amount: undefined,
address: undefined address: undefined
@ -5783,7 +5685,7 @@ const buildDraftTransaction = () => ({
// See details in https://github.com/lbryio/lbry/issues/1307 // See details in https://github.com/lbryio/lbry/issues/1307
const defaultState$6 = { const defaultState$5 = {
balance: undefined, balance: undefined,
totalBalance: undefined, totalBalance: undefined,
reservedBalance: undefined, reservedBalance: undefined,
@ -5824,40 +5726,40 @@ const defaultState$6 = {
}; };
const walletReducer = handleActions({ const walletReducer = handleActions({
[FETCH_TRANSACTIONS_STARTED]: state => _extends$e({}, state, { [FETCH_TRANSACTIONS_STARTED]: state => _extends$d({}, state, {
fetchingTransactions: true fetchingTransactions: true
}), }),
[FETCH_TRANSACTIONS_COMPLETED]: (state, action) => { [FETCH_TRANSACTIONS_COMPLETED]: (state, action) => {
const byId = _extends$e({}, state.transactions); const byId = _extends$d({}, state.transactions);
const { transactions } = action.data; const { transactions } = action.data;
transactions.forEach(transaction => { transactions.forEach(transaction => {
byId[transaction.txid] = transaction; byId[transaction.txid] = transaction;
}); });
return _extends$e({}, state, { return _extends$d({}, state, {
transactions: byId, transactions: byId,
fetchingTransactions: false fetchingTransactions: false
}); });
}, },
[FETCH_TXO_PAGE_STARTED]: state => { [FETCH_TXO_PAGE_STARTED]: state => {
return _extends$e({}, state, { return _extends$d({}, state, {
fetchingTxos: true, fetchingTxos: true,
fetchingTxosError: undefined fetchingTxosError: undefined
}); });
}, },
[FETCH_TXO_PAGE_COMPLETED]: (state, action) => { [FETCH_TXO_PAGE_COMPLETED]: (state, action) => {
return _extends$e({}, state, { return _extends$d({}, state, {
txoPage: action.data, txoPage: action.data,
fetchingTxos: false fetchingTxos: false
}); });
}, },
[FETCH_TXO_PAGE_FAILED]: (state, action) => { [FETCH_TXO_PAGE_FAILED]: (state, action) => {
return _extends$e({}, state, { return _extends$d({}, state, {
txoPage: {}, txoPage: {},
fetchingTxos: false, fetchingTxos: false,
fetchingTxosError: action.data fetchingTxosError: action.data
@ -5865,12 +5767,12 @@ const walletReducer = handleActions({
}, },
[UPDATE_TXO_FETCH_PARAMS]: (state, action) => { [UPDATE_TXO_FETCH_PARAMS]: (state, action) => {
return _extends$e({}, state, { return _extends$d({}, state, {
txoFetchParams: action.data txoFetchParams: action.data
}); });
}, },
[FETCH_SUPPORTS_STARTED]: state => _extends$e({}, state, { [FETCH_SUPPORTS_STARTED]: state => _extends$d({}, state, {
fetchingSupports: true fetchingSupports: true
}), }),
@ -5883,7 +5785,7 @@ const walletReducer = handleActions({
byOutpoint[`${txid}:${nout}`] = transaction; byOutpoint[`${txid}:${nout}`] = transaction;
}); });
return _extends$e({}, state, { supports: byOutpoint, fetchingSupports: false }); return _extends$d({}, state, { supports: byOutpoint, fetchingSupports: false });
}, },
[ABANDON_SUPPORT_STARTED]: (state, action) => { [ABANDON_SUPPORT_STARTED]: (state, action) => {
@ -5892,7 +5794,7 @@ const walletReducer = handleActions({
currentlyAbandoning[outpoint] = true; currentlyAbandoning[outpoint] = true;
return _extends$e({}, state, { return _extends$d({}, state, {
abandoningSupportsByOutpoint: currentlyAbandoning abandoningSupportsByOutpoint: currentlyAbandoning
}); });
}, },
@ -5905,20 +5807,20 @@ const walletReducer = handleActions({
delete currentlyAbandoning[outpoint]; delete currentlyAbandoning[outpoint];
delete byOutpoint[outpoint]; delete byOutpoint[outpoint];
return _extends$e({}, state, { return _extends$d({}, state, {
supports: byOutpoint, supports: byOutpoint,
abandoningSupportsById: currentlyAbandoning abandoningSupportsById: currentlyAbandoning
}); });
}, },
[ABANDON_CLAIM_SUPPORT_STARTED]: (state, action) => { [ABANDON_CLAIM_SUPPORT_STARTED]: (state, action) => {
return _extends$e({}, state, { return _extends$d({}, state, {
abandonClaimSupportError: undefined abandonClaimSupportError: undefined
}); });
}, },
[ABANDON_CLAIM_SUPPORT_PREVIEW]: (state, action) => { [ABANDON_CLAIM_SUPPORT_PREVIEW]: (state, action) => {
return _extends$e({}, state, { return _extends$d({}, state, {
abandonClaimSupportError: undefined abandonClaimSupportError: undefined
}); });
}, },
@ -5929,36 +5831,36 @@ const walletReducer = handleActions({
pendingtxs[claimId] = { txid, type, effective }; pendingtxs[claimId] = { txid, type, effective };
return _extends$e({}, state, { return _extends$d({}, state, {
pendingSupportTransactions: pendingtxs, pendingSupportTransactions: pendingtxs,
abandonClaimSupportError: undefined abandonClaimSupportError: undefined
}); });
}, },
[ABANDON_CLAIM_SUPPORT_FAILED]: (state, action) => { [ABANDON_CLAIM_SUPPORT_FAILED]: (state, action) => {
return _extends$e({}, state, { return _extends$d({}, state, {
abandonClaimSupportError: action.data abandonClaimSupportError: action.data
}); });
}, },
[PENDING_SUPPORTS_UPDATED]: (state, action) => { [PENDING_SUPPORTS_UPDATED]: (state, action) => {
return _extends$e({}, state, { return _extends$d({}, state, {
pendingSupportTransactions: action.data pendingSupportTransactions: action.data
}); });
}, },
[GET_NEW_ADDRESS_STARTED]: state => _extends$e({}, state, { [GET_NEW_ADDRESS_STARTED]: state => _extends$d({}, state, {
gettingNewAddress: true gettingNewAddress: true
}), }),
[GET_NEW_ADDRESS_COMPLETED]: (state, action) => { [GET_NEW_ADDRESS_COMPLETED]: (state, action) => {
const { address } = action.data; const { address } = action.data;
return _extends$e({}, state, { gettingNewAddress: false, receiveAddress: address }); return _extends$d({}, state, { gettingNewAddress: false, receiveAddress: address });
}, },
[UPDATE_BALANCE]: (state, action) => _extends$e({}, state, { [UPDATE_BALANCE]: (state, action) => _extends$d({}, state, {
totalBalance: action.data.totalBalance, totalBalance: action.data.totalBalance,
balance: action.data.balance, balance: action.data.balance,
reservedBalance: action.data.reservedBalance, reservedBalance: action.data.reservedBalance,
@ -5967,32 +5869,32 @@ const walletReducer = handleActions({
tipsBalance: action.data.tipsBalance tipsBalance: action.data.tipsBalance
}), }),
[CHECK_ADDRESS_IS_MINE_STARTED]: state => _extends$e({}, state, { [CHECK_ADDRESS_IS_MINE_STARTED]: state => _extends$d({}, state, {
checkingAddressOwnership: true checkingAddressOwnership: true
}), }),
[CHECK_ADDRESS_IS_MINE_COMPLETED]: state => _extends$e({}, state, { [CHECK_ADDRESS_IS_MINE_COMPLETED]: state => _extends$d({}, state, {
checkingAddressOwnership: false checkingAddressOwnership: false
}), }),
[SET_DRAFT_TRANSACTION_AMOUNT]: (state, action) => { [SET_DRAFT_TRANSACTION_AMOUNT]: (state, action) => {
const oldDraft = state.draftTransaction; const oldDraft = state.draftTransaction;
const newDraft = _extends$e({}, oldDraft, { amount: parseFloat(action.data.amount) }); const newDraft = _extends$d({}, oldDraft, { amount: parseFloat(action.data.amount) });
return _extends$e({}, state, { draftTransaction: newDraft }); return _extends$d({}, state, { draftTransaction: newDraft });
}, },
[SET_DRAFT_TRANSACTION_ADDRESS]: (state, action) => { [SET_DRAFT_TRANSACTION_ADDRESS]: (state, action) => {
const oldDraft = state.draftTransaction; const oldDraft = state.draftTransaction;
const newDraft = _extends$e({}, oldDraft, { address: action.data.address }); const newDraft = _extends$d({}, oldDraft, { address: action.data.address });
return _extends$e({}, state, { draftTransaction: newDraft }); return _extends$d({}, state, { draftTransaction: newDraft });
}, },
[SEND_TRANSACTION_STARTED]: state => { [SEND_TRANSACTION_STARTED]: state => {
const newDraftTransaction = _extends$e({}, state.draftTransaction, { sending: true }); const newDraftTransaction = _extends$d({}, state.draftTransaction, { sending: true });
return _extends$e({}, state, { draftTransaction: newDraftTransaction }); return _extends$d({}, state, { draftTransaction: newDraftTransaction });
}, },
[SEND_TRANSACTION_COMPLETED]: state => Object.assign({}, state, { [SEND_TRANSACTION_COMPLETED]: state => Object.assign({}, state, {
@ -6005,117 +5907,117 @@ const walletReducer = handleActions({
error: action.data.error error: action.data.error
}); });
return _extends$e({}, state, { draftTransaction: newDraftTransaction }); return _extends$d({}, state, { draftTransaction: newDraftTransaction });
}, },
[SUPPORT_TRANSACTION_STARTED]: state => _extends$e({}, state, { [SUPPORT_TRANSACTION_STARTED]: state => _extends$d({}, state, {
sendingSupport: true sendingSupport: true
}), }),
[SUPPORT_TRANSACTION_COMPLETED]: state => _extends$e({}, state, { [SUPPORT_TRANSACTION_COMPLETED]: state => _extends$d({}, state, {
sendingSupport: false sendingSupport: false
}), }),
[SUPPORT_TRANSACTION_FAILED]: (state, action) => _extends$e({}, state, { [SUPPORT_TRANSACTION_FAILED]: (state, action) => _extends$d({}, state, {
error: action.data.error, error: action.data.error,
sendingSupport: false sendingSupport: false
}), }),
[CLEAR_SUPPORT_TRANSACTION]: state => _extends$e({}, state, { [CLEAR_SUPPORT_TRANSACTION]: state => _extends$d({}, state, {
sendingSupport: false sendingSupport: false
}), }),
[WALLET_STATUS_COMPLETED]: (state, action) => _extends$e({}, state, { [WALLET_STATUS_COMPLETED]: (state, action) => _extends$d({}, state, {
walletIsEncrypted: action.result walletIsEncrypted: action.result
}), }),
[WALLET_ENCRYPT_START]: state => _extends$e({}, state, { [WALLET_ENCRYPT_START]: state => _extends$d({}, state, {
walletEncryptPending: true, walletEncryptPending: true,
walletEncryptSucceded: null, walletEncryptSucceded: null,
walletEncryptResult: null walletEncryptResult: null
}), }),
[WALLET_ENCRYPT_COMPLETED]: (state, action) => _extends$e({}, state, { [WALLET_ENCRYPT_COMPLETED]: (state, action) => _extends$d({}, state, {
walletEncryptPending: false, walletEncryptPending: false,
walletEncryptSucceded: true, walletEncryptSucceded: true,
walletEncryptResult: action.result walletEncryptResult: action.result
}), }),
[WALLET_ENCRYPT_FAILED]: (state, action) => _extends$e({}, state, { [WALLET_ENCRYPT_FAILED]: (state, action) => _extends$d({}, state, {
walletEncryptPending: false, walletEncryptPending: false,
walletEncryptSucceded: false, walletEncryptSucceded: false,
walletEncryptResult: action.result walletEncryptResult: action.result
}), }),
[WALLET_DECRYPT_START]: state => _extends$e({}, state, { [WALLET_DECRYPT_START]: state => _extends$d({}, state, {
walletDecryptPending: true, walletDecryptPending: true,
walletDecryptSucceded: null, walletDecryptSucceded: null,
walletDecryptResult: null walletDecryptResult: null
}), }),
[WALLET_DECRYPT_COMPLETED]: (state, action) => _extends$e({}, state, { [WALLET_DECRYPT_COMPLETED]: (state, action) => _extends$d({}, state, {
walletDecryptPending: false, walletDecryptPending: false,
walletDecryptSucceded: true, walletDecryptSucceded: true,
walletDecryptResult: action.result walletDecryptResult: action.result
}), }),
[WALLET_DECRYPT_FAILED]: (state, action) => _extends$e({}, state, { [WALLET_DECRYPT_FAILED]: (state, action) => _extends$d({}, state, {
walletDecryptPending: false, walletDecryptPending: false,
walletDecryptSucceded: false, walletDecryptSucceded: false,
walletDecryptResult: action.result walletDecryptResult: action.result
}), }),
[WALLET_UNLOCK_START]: state => _extends$e({}, state, { [WALLET_UNLOCK_START]: state => _extends$d({}, state, {
walletUnlockPending: true, walletUnlockPending: true,
walletUnlockSucceded: null, walletUnlockSucceded: null,
walletUnlockResult: null walletUnlockResult: null
}), }),
[WALLET_UNLOCK_COMPLETED]: (state, action) => _extends$e({}, state, { [WALLET_UNLOCK_COMPLETED]: (state, action) => _extends$d({}, state, {
walletUnlockPending: false, walletUnlockPending: false,
walletUnlockSucceded: true, walletUnlockSucceded: true,
walletUnlockResult: action.result walletUnlockResult: action.result
}), }),
[WALLET_UNLOCK_FAILED]: (state, action) => _extends$e({}, state, { [WALLET_UNLOCK_FAILED]: (state, action) => _extends$d({}, state, {
walletUnlockPending: false, walletUnlockPending: false,
walletUnlockSucceded: false, walletUnlockSucceded: false,
walletUnlockResult: action.result walletUnlockResult: action.result
}), }),
[WALLET_LOCK_START]: state => _extends$e({}, state, { [WALLET_LOCK_START]: state => _extends$d({}, state, {
walletLockPending: false, walletLockPending: false,
walletLockSucceded: null, walletLockSucceded: null,
walletLockResult: null walletLockResult: null
}), }),
[WALLET_LOCK_COMPLETED]: (state, action) => _extends$e({}, state, { [WALLET_LOCK_COMPLETED]: (state, action) => _extends$d({}, state, {
walletLockPending: false, walletLockPending: false,
walletLockSucceded: true, walletLockSucceded: true,
walletLockResult: action.result walletLockResult: action.result
}), }),
[WALLET_LOCK_FAILED]: (state, action) => _extends$e({}, state, { [WALLET_LOCK_FAILED]: (state, action) => _extends$d({}, state, {
walletLockPending: false, walletLockPending: false,
walletLockSucceded: false, walletLockSucceded: false,
walletLockResult: action.result walletLockResult: action.result
}), }),
[SET_TRANSACTION_LIST_FILTER]: (state, action) => _extends$e({}, state, { [SET_TRANSACTION_LIST_FILTER]: (state, action) => _extends$d({}, state, {
transactionListFilter: action.data transactionListFilter: action.data
}), }),
[UPDATE_CURRENT_HEIGHT]: (state, action) => _extends$e({}, state, { [UPDATE_CURRENT_HEIGHT]: (state, action) => _extends$d({}, state, {
latestBlock: action.data latestBlock: action.data
}), }),
[WALLET_RESTART]: state => _extends$e({}, state, { [WALLET_RESTART]: state => _extends$d({}, state, {
walletReconnecting: true walletReconnecting: true
}), }),
[WALLET_RESTART_COMPLETED]: state => _extends$e({}, state, { [WALLET_RESTART_COMPLETED]: state => _extends$d({}, state, {
walletReconnecting: false walletReconnecting: false
}) })
}, defaultState$6); }, defaultState$5);
// //
@ -6130,14 +6032,14 @@ const makeSelectContentPositionForUri = uri => reselect.createSelector(selectSta
return state.positions[id] ? state.positions[id][outpoint] : null; return state.positions[id] ? state.positions[id][outpoint] : null;
}); });
var _extends$f = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _extends$e = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
const selectState$5 = state => state.notifications || {}; const selectState$5 = state => state.notifications || {};
const selectToast = reselect.createSelector(selectState$5, state => { const selectToast = reselect.createSelector(selectState$5, state => {
if (state.toasts.length) { if (state.toasts.length) {
const { id, params } = state.toasts[0]; const { id, params } = state.toasts[0];
return _extends$f({ return _extends$e({
id id
}, params); }, params);
} }
@ -6156,33 +6058,6 @@ const selectError = reselect.createSelector(selectState$5, state => {
return null; return null;
}); });
//
const selectState$6 = state => state.tags || {};
const selectKnownTagsByName = reselect.createSelector(selectState$6, state => state.knownTags);
const selectFollowedTagsList = reselect.createSelector(selectState$6, state => state.followedTags.filter(tag => typeof tag === 'string'));
const selectFollowedTags = reselect.createSelector(selectFollowedTagsList, followedTags => followedTags.map(tag => ({ name: tag.toLowerCase() })).sort((a, b) => a.name.localeCompare(b.name)));
const selectUnfollowedTags = reselect.createSelector(selectKnownTagsByName, selectFollowedTagsList, (tagsByName, followedTags) => {
const followedTagsSet = new Set(followedTags);
let tagsToReturn = [];
Object.keys(tagsByName).forEach(key => {
if (!followedTagsSet.has(key)) {
const { name } = tagsByName[key];
tagsToReturn.push({ name: name.toLowerCase() });
}
});
return tagsToReturn;
});
const makeSelectIsFollowingTag = tag => reselect.createSelector(selectFollowedTags, followedTags => {
return followedTags.some(followedTag => followedTag.name === tag.toLowerCase());
});
exports.ABANDON_STATES = abandon_states; exports.ABANDON_STATES = abandon_states;
exports.ACTIONS = action_types; exports.ACTIONS = action_types;
exports.CLAIM_VALUES = claim; exports.CLAIM_VALUES = claim;
@ -6213,7 +6088,6 @@ exports.createNormalizedClaimSearchKey = createNormalizedClaimSearchKey;
exports.creditsToString = creditsToString; exports.creditsToString = creditsToString;
exports.doAbandonClaim = doAbandonClaim; exports.doAbandonClaim = doAbandonClaim;
exports.doAbandonTxo = doAbandonTxo; exports.doAbandonTxo = doAbandonTxo;
exports.doAddTag = doAddTag;
exports.doBalanceSubscribe = doBalanceSubscribe; exports.doBalanceSubscribe = doBalanceSubscribe;
exports.doCheckAddressIsMine = doCheckAddressIsMine; exports.doCheckAddressIsMine = doCheckAddressIsMine;
exports.doCheckPendingClaims = doCheckPendingClaims; exports.doCheckPendingClaims = doCheckPendingClaims;
@ -6226,7 +6100,6 @@ exports.doClearPurchasedUriSuccess = doClearPurchasedUriSuccess;
exports.doClearRepostError = doClearRepostError; exports.doClearRepostError = doClearRepostError;
exports.doClearSupport = doClearSupport; exports.doClearSupport = doClearSupport;
exports.doCreateChannel = doCreateChannel; exports.doCreateChannel = doCreateChannel;
exports.doDeleteTag = doDeleteTag;
exports.doDismissError = doDismissError; exports.doDismissError = doDismissError;
exports.doDismissToast = doDismissToast; exports.doDismissToast = doDismissToast;
exports.doError = doError; exports.doError = doError;
@ -6260,7 +6133,6 @@ exports.doSetFileListSort = doSetFileListSort;
exports.doSetTransactionListFilter = doSetTransactionListFilter; exports.doSetTransactionListFilter = doSetTransactionListFilter;
exports.doSupportAbandonForClaim = doSupportAbandonForClaim; exports.doSupportAbandonForClaim = doSupportAbandonForClaim;
exports.doToast = doToast; exports.doToast = doToast;
exports.doToggleTagFollow = doToggleTagFollow;
exports.doUpdateBalance = doUpdateBalance; exports.doUpdateBalance = doUpdateBalance;
exports.doUpdateBlockHeight = doUpdateBlockHeight; exports.doUpdateBlockHeight = doUpdateBlockHeight;
exports.doUpdateChannel = doUpdateChannel; exports.doUpdateChannel = doUpdateChannel;
@ -6303,7 +6175,6 @@ exports.makeSelectFileNameForUri = makeSelectFileNameForUri;
exports.makeSelectFilePartlyDownloaded = makeSelectFilePartlyDownloaded; exports.makeSelectFilePartlyDownloaded = makeSelectFilePartlyDownloaded;
exports.makeSelectFilteredTransactionsForPage = makeSelectFilteredTransactionsForPage; exports.makeSelectFilteredTransactionsForPage = makeSelectFilteredTransactionsForPage;
exports.makeSelectIsAbandoningClaimForUri = makeSelectIsAbandoningClaimForUri; exports.makeSelectIsAbandoningClaimForUri = makeSelectIsAbandoningClaimForUri;
exports.makeSelectIsFollowingTag = makeSelectIsFollowingTag;
exports.makeSelectIsUriResolving = makeSelectIsUriResolving; exports.makeSelectIsUriResolving = makeSelectIsUriResolving;
exports.makeSelectLatestTransactions = makeSelectLatestTransactions; exports.makeSelectLatestTransactions = makeSelectLatestTransactions;
exports.makeSelectLoadingForUri = makeSelectLoadingForUri; exports.makeSelectLoadingForUri = makeSelectLoadingForUri;
@ -6381,8 +6252,6 @@ exports.selectFileListDownloadedSort = selectFileListDownloadedSort;
exports.selectFileListPublishedSort = selectFileListPublishedSort; exports.selectFileListPublishedSort = selectFileListPublishedSort;
exports.selectFilteredTransactionCount = selectFilteredTransactionCount; exports.selectFilteredTransactionCount = selectFilteredTransactionCount;
exports.selectFilteredTransactions = selectFilteredTransactions; exports.selectFilteredTransactions = selectFilteredTransactions;
exports.selectFollowedTags = selectFollowedTags;
exports.selectFollowedTagsList = selectFollowedTagsList;
exports.selectGettingNewAddress = selectGettingNewAddress; exports.selectGettingNewAddress = selectGettingNewAddress;
exports.selectHasTransactions = selectHasTransactions; exports.selectHasTransactions = selectHasTransactions;
exports.selectIsFetchingClaimListMine = selectIsFetchingClaimListMine; exports.selectIsFetchingClaimListMine = selectIsFetchingClaimListMine;
@ -6436,7 +6305,6 @@ exports.selectTxoItemCount = selectTxoItemCount;
exports.selectTxoPage = selectTxoPage; exports.selectTxoPage = selectTxoPage;
exports.selectTxoPageNumber = selectTxoPageNumber; exports.selectTxoPageNumber = selectTxoPageNumber;
exports.selectTxoPageParams = selectTxoPageParams; exports.selectTxoPageParams = selectTxoPageParams;
exports.selectUnfollowedTags = selectUnfollowedTags;
exports.selectUpdateChannelError = selectUpdateChannelError; exports.selectUpdateChannelError = selectUpdateChannelError;
exports.selectUpdatingChannel = selectUpdatingChannel; exports.selectUpdatingChannel = selectUpdatingChannel;
exports.selectUrisLoading = selectUrisLoading; exports.selectUrisLoading = selectUrisLoading;
@ -6451,6 +6319,5 @@ exports.selectWalletState = selectWalletState;
exports.selectWalletUnlockPending = selectWalletUnlockPending; exports.selectWalletUnlockPending = selectWalletUnlockPending;
exports.selectWalletUnlockResult = selectWalletUnlockResult; exports.selectWalletUnlockResult = selectWalletUnlockResult;
exports.selectWalletUnlockSucceeded = selectWalletUnlockSucceeded; exports.selectWalletUnlockSucceeded = selectWalletUnlockSucceeded;
exports.tagsReducer = tagsReducer;
exports.toQueryString = toQueryString; exports.toQueryString = toQueryString;
exports.walletReducer = walletReducer; exports.walletReducer = walletReducer;

View file

@ -266,10 +266,5 @@ export const FETCH_COST_INFO_STARTED = 'FETCH_COST_INFO_STARTED';
export const FETCH_COST_INFO_COMPLETED = 'FETCH_COST_INFO_COMPLETED'; export const FETCH_COST_INFO_COMPLETED = 'FETCH_COST_INFO_COMPLETED';
export const FETCH_COST_INFO_FAILED = 'FETCH_COST_INFO_FAILED'; export const FETCH_COST_INFO_FAILED = 'FETCH_COST_INFO_FAILED';
// Tags
export const TOGGLE_TAG_FOLLOW = 'TOGGLE_TAG_FOLLOW';
export const TAG_ADD = 'TAG_ADD';
export const TAG_DELETE = 'TAG_DELETE';
// Sync // Sync
export const USER_STATE_POPULATE = 'USER_STATE_POPULATE'; export const USER_STATE_POPULATE = 'USER_STATE_POPULATE';

View file

@ -122,8 +122,6 @@ export {
doSupportAbandonForClaim, doSupportAbandonForClaim,
} from 'redux/actions/wallet'; } from 'redux/actions/wallet';
export { doToggleTagFollow, doAddTag, doDeleteTag } from 'redux/actions/tags';
export { doPopulateSharedUserState, doPreferenceGet, doPreferenceSet } from 'redux/actions/sync'; export { doPopulateSharedUserState, doPreferenceGet, doPreferenceSet } from 'redux/actions/sync';
// utils // utils
@ -138,7 +136,6 @@ export { contentReducer } from 'redux/reducers/content';
export { fileInfoReducer } from 'redux/reducers/file_info'; export { fileInfoReducer } from 'redux/reducers/file_info';
export { notificationsReducer } from 'redux/reducers/notifications'; export { notificationsReducer } from 'redux/reducers/notifications';
export { publishReducer } from 'redux/reducers/publish'; export { publishReducer } from 'redux/reducers/publish';
export { tagsReducer } from 'redux/reducers/tags';
export { walletReducer } from 'redux/reducers/wallet'; export { walletReducer } from 'redux/reducers/wallet';
// selectors // selectors
@ -314,10 +311,3 @@ export {
selectAbandonClaimSupportError, selectAbandonClaimSupportError,
makeSelectPendingAmountByUri, makeSelectPendingAmountByUri,
} from 'redux/selectors/wallet'; } from 'redux/selectors/wallet';
export {
selectFollowedTags,
selectFollowedTagsList,
selectUnfollowedTags,
makeSelectIsFollowingTag,
} from 'redux/selectors/tags';

View file

@ -1,24 +0,0 @@
// @flow
import * as ACTIONS from 'constants/action_types';
import Lbry from 'lbry';
export const doToggleTagFollow = (name: string) => ({
type: ACTIONS.TOGGLE_TAG_FOLLOW,
data: {
name,
},
});
export const doAddTag = (name: string) => ({
type: ACTIONS.TAG_ADD,
data: {
name,
},
});
export const doDeleteTag = (name: string) => ({
type: ACTIONS.TAG_DELETE,
data: {
name,
},
});

View file

@ -1,86 +0,0 @@
// @flow
import * as ACTIONS from 'constants/action_types';
import { handleActions } from 'util/redux-utils';
import { DEFAULT_KNOWN_TAGS, DEFAULT_FOLLOWED_TAGS } from 'constants/tags';
function getDefaultKnownTags() {
return DEFAULT_FOLLOWED_TAGS.concat(DEFAULT_KNOWN_TAGS).reduce(
(tagsMap, tag) => ({
...tagsMap,
[tag]: { name: tag },
}),
{}
);
}
const defaultState: TagState = {
followedTags: [],
knownTags: getDefaultKnownTags(),
};
export const tagsReducer = handleActions(
{
[ACTIONS.TOGGLE_TAG_FOLLOW]: (state: TagState, action: TagAction): TagState => {
const { followedTags } = state;
const { name } = action.data;
let newFollowedTags = followedTags.slice();
if (newFollowedTags.includes(name)) {
newFollowedTags = newFollowedTags.filter(tag => tag !== name);
} else {
newFollowedTags.push(name);
}
return {
...state,
followedTags: newFollowedTags,
};
},
[ACTIONS.TAG_ADD]: (state: TagState, action: TagAction) => {
const { knownTags } = state;
const { name } = action.data;
let newKnownTags = { ...knownTags };
newKnownTags[name] = { name };
return {
...state,
knownTags: newKnownTags,
};
},
[ACTIONS.TAG_DELETE]: (state: TagState, action: TagAction) => {
const { knownTags, followedTags } = state;
const { name } = action.data;
let newKnownTags = { ...knownTags };
delete newKnownTags[name];
const newFollowedTags = followedTags.filter(tag => tag !== name);
return {
...state,
knownTags: newKnownTags,
followedTags: newFollowedTags,
};
},
[ACTIONS.USER_STATE_POPULATE]: (
state: TagState,
action: { data: { tags: ?Array<string> } }
) => {
const { tags } = action.data;
if (Array.isArray(tags)) {
return {
...state,
followedTags: tags,
};
}
return {
...state,
};
},
},
defaultState
);

View file

@ -1,47 +0,0 @@
// @flow
import { createSelector } from 'reselect';
const selectState = (state: { tags: TagState }) => state.tags || {};
export const selectKnownTagsByName = createSelector(
selectState,
(state: TagState): KnownTags => state.knownTags
);
export const selectFollowedTagsList = createSelector(
selectState,
(state: TagState): Array<string> => state.followedTags.filter(tag => typeof tag === 'string')
);
export const selectFollowedTags = createSelector(
selectFollowedTagsList,
(followedTags: Array<string>): Array<Tag> =>
followedTags
.map(tag => ({ name: tag.toLowerCase() }))
.sort((a, b) => a.name.localeCompare(b.name))
);
export const selectUnfollowedTags = createSelector(
selectKnownTagsByName,
selectFollowedTagsList,
(tagsByName: KnownTags, followedTags: Array<string>): Array<Tag> => {
const followedTagsSet = new Set(followedTags);
let tagsToReturn = [];
Object.keys(tagsByName).forEach(key => {
if (!followedTagsSet.has(key)) {
const { name } = tagsByName[key];
tagsToReturn.push({ name: name.toLowerCase() });
}
});
return tagsToReturn;
}
);
export const makeSelectIsFollowingTag = (tag: string) =>
createSelector(
selectFollowedTags,
followedTags => {
return followedTags.some(followedTag => followedTag.name === tag.toLowerCase());
}
);