add selector for creatingchannel
This commit is contained in:
parent
123efacf4d
commit
9d78fbb62d
4 changed files with 27 additions and 4 deletions
13
dist/bundle.es.js
vendored
13
dist/bundle.es.js
vendored
|
@ -1461,6 +1461,8 @@ const selectClaimsById = reselect.createSelector(selectState$2, state => state.b
|
|||
|
||||
const selectCurrentChannelPage = reselect.createSelector(selectState$2, state => state.currentChannelPage || 1);
|
||||
|
||||
const selectCreatingChannel = reselect.createSelector(selectState$2, state => state.creatingChannel);
|
||||
|
||||
const selectClaimsByUri = reselect.createSelector(selectState$2, selectClaimsById, (state, byId) => {
|
||||
const byUri = state.claimsByUri || {};
|
||||
const claims = {};
|
||||
|
@ -3564,7 +3566,8 @@ const defaultState = {
|
|||
claimSearchByQueryLastPageReached: {},
|
||||
fetchingClaimSearchByQuery: {},
|
||||
updateChannelError: '',
|
||||
updatingChannel: false
|
||||
updatingChannel: false,
|
||||
creatingChannel: false
|
||||
};
|
||||
|
||||
function handleClaimAction(state, action) {
|
||||
|
@ -3782,6 +3785,10 @@ reducers[ABANDON_CLAIM_SUCCEEDED] = (state, action) => {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[CREATE_CHANNEL_STARTED] = state => _extends$5({}, state, {
|
||||
creatingChannel: true
|
||||
});
|
||||
|
||||
reducers[CREATE_CHANNEL_COMPLETED] = (state, action) => {
|
||||
const channelClaim = action.data.channelClaim;
|
||||
const byId = Object.assign({}, state.byId);
|
||||
|
@ -3792,7 +3799,8 @@ reducers[CREATE_CHANNEL_COMPLETED] = (state, action) => {
|
|||
|
||||
return Object.assign({}, state, {
|
||||
byId,
|
||||
myChannelClaims
|
||||
myChannelClaims,
|
||||
creatingChannel: false
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -5001,6 +5009,7 @@ exports.selectClaimSearchByQuery = selectClaimSearchByQuery;
|
|||
exports.selectClaimSearchByQueryLastPageReached = selectClaimSearchByQueryLastPageReached;
|
||||
exports.selectClaimsById = selectClaimsById;
|
||||
exports.selectClaimsByUri = selectClaimsByUri;
|
||||
exports.selectCreatingChannel = selectCreatingChannel;
|
||||
exports.selectCurrentChannelPage = selectCurrentChannelPage;
|
||||
exports.selectDownloadedUris = selectDownloadedUris;
|
||||
exports.selectDownloadingByOutpoint = selectDownloadingByOutpoint;
|
||||
|
|
|
@ -202,6 +202,7 @@ export {
|
|||
selectClaimSearchByQueryLastPageReached,
|
||||
selectUpdatingChannel,
|
||||
selectUpdateChannelError,
|
||||
selectCreatingChannel,
|
||||
} from 'redux/selectors/claims';
|
||||
|
||||
export { makeSelectCommentsForUri } from 'redux/selectors/comments';
|
||||
|
|
|
@ -24,6 +24,7 @@ type State = {
|
|||
fetchingClaimSearchByQuery: { [string]: boolean },
|
||||
claimSearchByQuery: { [string]: Array<string> },
|
||||
claimSearchByQueryLastPageReached: { [string]: Array<boolean> },
|
||||
creatingChannel: boolean,
|
||||
claimsByChannel: {
|
||||
[string]: {
|
||||
all: Array<string>,
|
||||
|
@ -54,6 +55,7 @@ const defaultState = {
|
|||
fetchingClaimSearchByQuery: {},
|
||||
updateChannelError: '',
|
||||
updatingChannel: false,
|
||||
creatingChannel: false,
|
||||
};
|
||||
|
||||
function handleClaimAction(state: State, action: any): State {
|
||||
|
@ -282,6 +284,11 @@ reducers[ACTIONS.ABANDON_CLAIM_SUCCEEDED] = (state: State, action: any): State =
|
|||
});
|
||||
};
|
||||
|
||||
reducers[ACTIONS.CREATE_CHANNEL_STARTED] = (state: State): State => ({
|
||||
...state,
|
||||
creatingChannel: true,
|
||||
});
|
||||
|
||||
reducers[ACTIONS.CREATE_CHANNEL_COMPLETED] = (state: State, action: any): State => {
|
||||
const channelClaim: ChannelClaim = action.data.channelClaim;
|
||||
const byId = Object.assign({}, state.byId);
|
||||
|
@ -293,6 +300,7 @@ reducers[ACTIONS.CREATE_CHANNEL_COMPLETED] = (state: State, action: any): State
|
|||
return Object.assign({}, state, {
|
||||
byId,
|
||||
myChannelClaims,
|
||||
creatingChannel: false,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -18,6 +18,11 @@ export const selectCurrentChannelPage = createSelector(
|
|||
state => state.currentChannelPage || 1
|
||||
);
|
||||
|
||||
export const selectCreatingChannel = createSelector(
|
||||
selectState,
|
||||
state => state.creatingChannel
|
||||
);
|
||||
|
||||
export const selectClaimsByUri = createSelector(
|
||||
selectState,
|
||||
selectClaimsById,
|
||||
|
@ -230,8 +235,8 @@ export const makeSelectDateForUri = (uri: string) =>
|
|||
(claim.value.release_time
|
||||
? claim.value.release_time * 1000
|
||||
: claim.meta && claim.meta.creation_timestamp
|
||||
? claim.meta.creation_timestamp * 1000
|
||||
: null);
|
||||
? claim.meta.creation_timestamp * 1000
|
||||
: null);
|
||||
if (!timestamp) {
|
||||
return undefined;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue