diff --git a/dist/bundle.es.js b/dist/bundle.es.js index bf9deee..7145892 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -669,7 +669,9 @@ const Lbry = { isConnected: false, connectPromise: null, daemonConnectionString: 'http://localhost:5279', - apiRequestHeaders: { 'Content-Type': 'application/json-rpc' }, + apiRequestHeaders: { + 'Content-Type': 'application/json-rpc' + }, // Allow overriding daemon connection string (e.g. to `/api/proxy` for lbryweb) setDaemonConnectionString: value => { @@ -3803,6 +3805,11 @@ reducers[CREATE_CHANNEL_COMPLETED] = (state, action) => { creatingChannel: false }); }; +// reducers[ACTIONS.failedifeiowejiowfeiowef] = (state: State, action: any): State => { +// return Object.assign({}, state, { +// creatingChannel: false, +// }); +// }; reducers[UPDATE_CHANNEL_STARTED] = (state, action) => { return Object.assign({}, state, { @@ -4430,7 +4437,7 @@ function getDefaultKnownTags() { } const defaultState$8 = { - followedTags: DEFAULT_FOLLOWED_TAGS, + followedTags: [], knownTags: getDefaultKnownTags() }; @@ -4476,6 +4483,11 @@ const tagsReducer = handleActions({ knownTags: newKnownTags, followedTags: newFollowedTags }); + }, + USER_SETTINGS_POPULATE: (state, action) => { + return _extends$c({}, state, { + followedTags: action.data && action.data.app && action.data.app.tags || [] + }); } }, defaultState$8); @@ -4845,6 +4857,10 @@ const selectUnfollowedTags = reselect.createSelector(selectKnownTagsByName, sele return tagsToReturn; }); +const makeSelectIsFollowingTag = tag => reselect.createSelector(selectFollowedTags, followedTags => { + return followedTags.some(followedTag => followedTag.name === tag.toLowerCase()); +}); + // const selectState$a = state => state.blocked || {}; @@ -4964,6 +4980,7 @@ exports.makeSelectFileInfoForUri = makeSelectFileInfoForUri; exports.makeSelectFileNameForUri = makeSelectFileNameForUri; exports.makeSelectFilePartlyDownloaded = makeSelectFilePartlyDownloaded; exports.makeSelectFirstRecommendedFileForUri = makeSelectFirstRecommendedFileForUri; +exports.makeSelectIsFollowingTag = makeSelectIsFollowingTag; exports.makeSelectIsUriResolving = makeSelectIsUriResolving; exports.makeSelectLoadingForUri = makeSelectLoadingForUri; exports.makeSelectMediaTypeForUri = makeSelectMediaTypeForUri; diff --git a/src/index.js b/src/index.js index 83d11b3..d2d98e5 100644 --- a/src/index.js +++ b/src/index.js @@ -282,7 +282,11 @@ export { selectTransactionListFilter, } from 'redux/selectors/wallet'; -export { selectFollowedTags, selectUnfollowedTags } from 'redux/selectors/tags'; +export { + selectFollowedTags, + selectUnfollowedTags, + makeSelectIsFollowingTag, +} from 'redux/selectors/tags'; export { selectBlockedChannels, diff --git a/src/lbry.js b/src/lbry.js index ba47709..4c96ed7 100644 --- a/src/lbry.js +++ b/src/lbry.js @@ -11,7 +11,9 @@ const Lbry: LbryTypes = { isConnected: false, connectPromise: null, daemonConnectionString: 'http://localhost:5279', - apiRequestHeaders: { 'Content-Type': 'application/json-rpc' }, + apiRequestHeaders: { + 'Content-Type': 'application/json-rpc', + }, // Allow overriding daemon connection string (e.g. to `/api/proxy` for lbryweb) setDaemonConnectionString: (value: string) => { diff --git a/src/redux/reducers/claims.js b/src/redux/reducers/claims.js index ffb8573..70dc1d9 100644 --- a/src/redux/reducers/claims.js +++ b/src/redux/reducers/claims.js @@ -303,6 +303,11 @@ reducers[ACTIONS.CREATE_CHANNEL_COMPLETED] = (state: State, action: any): State creatingChannel: false, }); }; +// reducers[ACTIONS.failedifeiowejiowfeiowef] = (state: State, action: any): State => { +// return Object.assign({}, state, { +// creatingChannel: false, +// }); +// }; reducers[ACTIONS.UPDATE_CHANNEL_STARTED] = (state: State, action: any): State => { return Object.assign({}, state, { diff --git a/src/redux/reducers/tags.js b/src/redux/reducers/tags.js index 79692ba..f0e04fc 100644 --- a/src/redux/reducers/tags.js +++ b/src/redux/reducers/tags.js @@ -14,7 +14,7 @@ function getDefaultKnownTags() { } const defaultState: TagState = { - followedTags: DEFAULT_FOLLOWED_TAGS, + followedTags: [], knownTags: getDefaultKnownTags(), }; @@ -65,6 +65,15 @@ export const tagsReducer = handleActions( followedTags: newFollowedTags, }; }, + USER_SETTINGS_POPULATE: ( + state: TagState, + action: { data: { app: { tags: Array } } } + ) => { + return { + ...state, + followedTags: (action.data && action.data.app && action.data.app.tags) || [], + }; + }, }, defaultState ); diff --git a/src/redux/selectors/tags.js b/src/redux/selectors/tags.js index ec805a0..ff202b3 100644 --- a/src/redux/selectors/tags.js +++ b/src/redux/selectors/tags.js @@ -16,7 +16,9 @@ export const selectFollowedTagsList = createSelector( export const selectFollowedTags = createSelector( selectFollowedTagsList, (followedTags: Array): Array => - followedTags.map(tag => ({ name: tag.toLowerCase() })).sort((a, b) => a.name.localeCompare(b.name)) + followedTags + .map(tag => ({ name: tag.toLowerCase() })) + .sort((a, b) => a.name.localeCompare(b.name)) ); export const selectUnfollowedTags = createSelector( @@ -36,3 +38,11 @@ export const selectUnfollowedTags = createSelector( return tagsToReturn; } ); + +export const makeSelectIsFollowingTag = (tag: string) => + createSelector( + selectFollowedTags, + followedTags => { + return followedTags.some(followedTag => followedTag.name === tag.toLowerCase()); + } + );