Merge pull request #24 from lbryio/search-focused
allow ability to track if search input is in focused
This commit is contained in:
commit
326b5e5e2d
6 changed files with 105 additions and 8 deletions
79
dist/bundle.js
vendored
79
dist/bundle.js
vendored
|
@ -89,8 +89,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
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.selectWunderBarAddress = exports.selectSearchUrisByQuery = exports.selectIsSearching = exports.selectSearchValue = exports.selectSearchQuery = exports.makeSelectSearchUris = exports.selectSearchState = exports.selectNavLinks = 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.selectSearchDownloadUris = exports.selectTotalDownloadProgress = exports.selectDownloadingFileInfos = undefined;
|
||||
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.selectRewardContentClaimIds = exports.selectChannelClaimCounts = exports.selectPlayingUri = 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 = exports.selectMyClaimsRaw = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.makeSelectIsUriResolving = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.makeSelectClaimForUri = exports.selectSnack = exports.selectNotificationProps = exports.selectNotification = exports.selectBlackListedOutpoints = exports.blacklistReducer = exports.walletReducer = exports.searchReducer = exports.notificationsReducer = exports.fileInfoReducer = exports.costInfoReducer = exports.claimsReducer = exports.formatFullPrice = exports.formatCredits = exports.toQueryString = exports.parseQueryParams = exports.batchActions = exports.doSendSupport = exports.doSetDraftTransactionAddress = exports.doSetDraftTransactionAmount = exports.doSendDraftTransaction = exports.doCheckAddressIsMine = exports.doGetNewAddress = exports.doFetchBlock = exports.doFetchTransactions = exports.doBalanceSubscribe = exports.doUpdateBalance = exports.doBlackListedOutpointsSubscribe = exports.doUpdateSearchQuery = exports.doSearch = exports.doFetchFileInfosAndPublishedClaims = exports.doFileList = exports.doFetchFileInfo = exports.doFetchCostInfoForUri = exports.doFetchRewardedContent = exports.doFetchFeaturedUris = exports.doResolveUri = exports.doResolveUris = exports.doAbandonClaim = exports.doFetchClaimListMine = exports.doHideNotification = exports.doNotify = exports.isNameValid = exports.isURIClaimable = exports.isURIValid = exports.normalizeURI = exports.buildURI = exports.parseURI = exports.regexAddress = exports.regexInvalidURI = exports.Lbryapi = exports.Lbry = exports.MODALS = exports.SETTINGS = exports.ACTIONS = exports.Notification = undefined;
|
||||
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.selectSearchBarFocused = exports.selectWunderBarAddress = exports.selectSearchUrisByQuery = exports.selectIsSearching = exports.selectSearchValue = exports.selectSearchQuery = exports.makeSelectSearchUris = exports.selectSearchState = exports.selectNavLinks = 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.selectSearchDownloadUris = exports.selectTotalDownloadProgress = exports.selectDownloadingFileInfos = exports.selectFileInfosDownloaded = exports.selectUrisLoading = undefined;
|
||||
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.selectRewardContentClaimIds = exports.selectChannelClaimCounts = exports.selectPlayingUri = 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 = exports.selectMyClaimsRaw = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.makeSelectIsUriResolving = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.makeSelectClaimForUri = exports.selectSnack = exports.selectNotificationProps = exports.selectNotification = exports.selectBlackListedOutpoints = exports.blacklistReducer = exports.walletReducer = exports.searchReducer = exports.notificationsReducer = exports.fileInfoReducer = exports.costInfoReducer = exports.claimsReducer = exports.formatFullPrice = exports.formatCredits = exports.toQueryString = exports.parseQueryParams = exports.batchActions = exports.doSendSupport = exports.doSetDraftTransactionAddress = exports.doSetDraftTransactionAmount = exports.doSendDraftTransaction = exports.doCheckAddressIsMine = exports.doGetNewAddress = exports.doFetchBlock = exports.doFetchTransactions = exports.doBalanceSubscribe = exports.doUpdateBalance = exports.doBlackListedOutpointsSubscribe = exports.doBlurSearchInput = exports.doFocusSearchInput = exports.doUpdateSearchQuery = exports.doSearch = exports.doFetchFileInfosAndPublishedClaims = exports.doFileList = exports.doFetchFileInfo = exports.doFetchCostInfoForUri = exports.doFetchRewardedContent = exports.doFetchFeaturedUris = exports.doResolveUri = exports.doResolveUris = exports.doAbandonClaim = exports.doFetchClaimListMine = exports.doHideNotification = exports.doNotify = exports.isNameValid = exports.isURIClaimable = exports.isURIValid = exports.normalizeURI = exports.buildURI = exports.parseURI = exports.regexAddress = exports.regexInvalidURI = exports.Lbryapi = exports.Lbry = exports.MODALS = exports.SETTINGS = exports.ACTIONS = exports.Notification = undefined;
|
||||
|
||||
var _Notification = __webpack_require__(1);
|
||||
|
||||
|
@ -250,6 +250,18 @@ Object.defineProperty(exports, 'doUpdateSearchQuery', {
|
|||
return _search.doUpdateSearchQuery;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'doFocusSearchInput', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _search.doFocusSearchInput;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'doBlurSearchInput', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _search.doBlurSearchInput;
|
||||
}
|
||||
});
|
||||
|
||||
var _blacklist = __webpack_require__(26);
|
||||
|
||||
|
@ -877,6 +889,12 @@ Object.defineProperty(exports, 'selectWunderBarAddress', {
|
|||
return _search3.selectWunderBarAddress;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, 'selectSearchBarFocused', {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _search3.selectSearchBarFocused;
|
||||
}
|
||||
});
|
||||
|
||||
var _wallet3 = __webpack_require__(28);
|
||||
|
||||
|
@ -1421,6 +1439,8 @@ var SEARCH_SUCCESS = exports.SEARCH_SUCCESS = 'SEARCH_SUCCESS';
|
|||
var SEARCH_FAIL = exports.SEARCH_FAIL = 'SEARCH_FAIL';
|
||||
var UPDATE_SEARCH_QUERY = exports.UPDATE_SEARCH_QUERY = 'UPDATE_SEARCH_QUERY';
|
||||
var UPDATE_SEARCH_SUGGESTIONS = exports.UPDATE_SEARCH_SUGGESTIONS = 'UPDATE_SEARCH_SUGGESTIONS';
|
||||
var SEARCH_FOCUS = exports.SEARCH_FOCUS = 'SEARCH_FOCUS';
|
||||
var SEARCH_BLUR = exports.SEARCH_BLUR = 'SEARCH_BLUR';
|
||||
|
||||
// Settings
|
||||
var DAEMON_SETTINGS_RECEIVED = exports.DAEMON_SETTINGS_RECEIVED = 'DAEMON_SETTINGS_RECEIVED';
|
||||
|
@ -3686,7 +3706,7 @@ var selectSearchDownloadUris = exports.selectSearchDownloadUris = function selec
|
|||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.doUpdateSearchQuery = exports.getSearchSuggestions = exports.doSearch = undefined;
|
||||
exports.doBlurSearchInput = exports.doFocusSearchInput = exports.doUpdateSearchQuery = exports.getSearchSuggestions = exports.doSearch = undefined;
|
||||
|
||||
var _action_types = __webpack_require__(4);
|
||||
|
||||
|
@ -3878,6 +3898,22 @@ var doUpdateSearchQuery = exports.doUpdateSearchQuery = function doUpdateSearchQ
|
|||
};
|
||||
};
|
||||
|
||||
var doFocusSearchInput = exports.doFocusSearchInput = function doFocusSearchInput() {
|
||||
return function (dispatch) {
|
||||
return dispatch({
|
||||
type: ACTIONS.SEARCH_FOCUS
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var doBlurSearchInput = exports.doBlurSearchInput = function doBlurSearchInput() {
|
||||
return function (dispatch) {
|
||||
return dispatch({
|
||||
type: ACTIONS.SEARCH_BLUR
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
/***/ }),
|
||||
/* 23 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
@ -3902,7 +3938,7 @@ var SEARCH = exports.SEARCH = 'search';
|
|||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.selectWunderBarAddress = exports.makeSelectSearchUris = exports.selectSearchUrisByQuery = exports.selectIsSearching = exports.selectSearchQuery = exports.selectSearchValue = exports.selectState = undefined;
|
||||
exports.selectSearchBarFocused = exports.selectWunderBarAddress = exports.makeSelectSearchUris = exports.selectSearchUrisByQuery = exports.selectIsSearching = exports.selectSearchQuery = exports.selectSearchValue = exports.selectState = undefined;
|
||||
|
||||
var _navigation = __webpack_require__(15);
|
||||
|
||||
|
@ -3946,6 +3982,10 @@ var selectWunderBarAddress = exports.selectWunderBarAddress = (0, _reselect.crea
|
|||
return query;
|
||||
});
|
||||
|
||||
var selectSearchBarFocused = exports.selectSearchBarFocused = (0, _reselect.createSelector)(selectState, function (state) {
|
||||
return state.focused;
|
||||
});
|
||||
|
||||
/***/ }),
|
||||
/* 25 */
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
@ -4280,6 +4320,24 @@ function doSendSupport(amount, claimId, uri, successCallback, errorCallback) {
|
|||
}
|
||||
};
|
||||
|
||||
var error = function error(err) {
|
||||
dispatch((0, _notifications.doNotify)({
|
||||
message: __('There was an error sending support funds.'),
|
||||
displayType: ['snackbar']
|
||||
}));
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.SUPPORT_TRANSACTION_FAILED,
|
||||
data: {
|
||||
error: err
|
||||
}
|
||||
});
|
||||
|
||||
if (errorCallback) {
|
||||
errorCallback();
|
||||
}
|
||||
};
|
||||
|
||||
dispatch({
|
||||
type: ACTIONS.SUPPORT_TRANSACTION_STARTED
|
||||
});
|
||||
|
@ -4287,7 +4345,7 @@ function doSendSupport(amount, claimId, uri, successCallback, errorCallback) {
|
|||
_lbry2.default.wallet_send({
|
||||
claim_id: claimId,
|
||||
amount: amount
|
||||
}).then(success, errorCallback);
|
||||
}).then(success, error);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -5215,7 +5273,8 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|||
|
||||
|
||||
var defaultState = {
|
||||
isActive: false,
|
||||
isActive: false, // does the user have any typed text in the search input
|
||||
focused: false, // is the search input focused
|
||||
searchQuery: '', // needs to be an empty string for input focusing
|
||||
suggestions: [],
|
||||
urisByQuery: {}
|
||||
|
@ -5258,6 +5317,14 @@ var searchReducer = exports.searchReducer = (0, _reduxUtils.handleActions)((_han
|
|||
return _extends({}, state, {
|
||||
isActive: false
|
||||
});
|
||||
}), _defineProperty(_handleActions, ACTIONS.SEARCH_FOCUS, function (state /*: SearchState*/) /*: SearchState*/ {
|
||||
return _extends({}, state, {
|
||||
focused: true
|
||||
});
|
||||
}), _defineProperty(_handleActions, ACTIONS.SEARCH_BLUR, function (state /*: SearchState*/) /*: SearchState*/ {
|
||||
return _extends({}, state, {
|
||||
focused: false
|
||||
});
|
||||
}), _handleActions), defaultState);
|
||||
|
||||
/***/ }),
|
||||
|
|
|
@ -94,6 +94,8 @@ export const SEARCH_SUCCESS = 'SEARCH_SUCCESS';
|
|||
export const SEARCH_FAIL = 'SEARCH_FAIL';
|
||||
export const UPDATE_SEARCH_QUERY = 'UPDATE_SEARCH_QUERY';
|
||||
export const UPDATE_SEARCH_SUGGESTIONS = 'UPDATE_SEARCH_SUGGESTIONS';
|
||||
export const SEARCH_FOCUS = 'SEARCH_FOCUS';
|
||||
export const SEARCH_BLUR = 'SEARCH_BLUR';
|
||||
|
||||
// Settings
|
||||
export const DAEMON_SETTINGS_RECEIVED = 'DAEMON_SETTINGS_RECEIVED';
|
||||
|
|
|
@ -44,7 +44,12 @@ export {
|
|||
doFetchFileInfosAndPublishedClaims,
|
||||
} from 'redux/actions/file_info';
|
||||
|
||||
export { doSearch, doUpdateSearchQuery } from 'redux/actions/search';
|
||||
export {
|
||||
doSearch,
|
||||
doUpdateSearchQuery,
|
||||
doFocusSearchInput,
|
||||
doBlurSearchInput,
|
||||
} from 'redux/actions/search';
|
||||
|
||||
export { doBlackListedOutpointsSubscribe } from 'redux/actions/blacklist';
|
||||
|
||||
|
@ -166,6 +171,7 @@ export {
|
|||
selectIsSearching,
|
||||
selectSearchUrisByQuery,
|
||||
selectWunderBarAddress,
|
||||
selectSearchBarFocused,
|
||||
} from 'redux/selectors/search';
|
||||
|
||||
export {
|
||||
|
|
|
@ -172,3 +172,13 @@ export const doUpdateSearchQuery = (query: string, shouldSkipSuggestions: ?boole
|
|||
dispatch(getSearchSuggestions(query));
|
||||
}
|
||||
};
|
||||
|
||||
export const doFocusSearchInput = () => dispatch =>
|
||||
dispatch({
|
||||
type: ACTIONS.SEARCH_FOCUS,
|
||||
});
|
||||
|
||||
export const doBlurSearchInput = () => dispatch =>
|
||||
dispatch({
|
||||
type: ACTIONS.SEARCH_BLUR,
|
||||
});
|
||||
|
|
|
@ -38,7 +38,8 @@ type SearchState = {
|
|||
};
|
||||
|
||||
const defaultState = {
|
||||
isActive: false,
|
||||
isActive: false, // does the user have any typed text in the search input
|
||||
focused: false, // is the search input focused
|
||||
searchQuery: '', // needs to be an empty string for input focusing
|
||||
suggestions: [],
|
||||
urisByQuery: {},
|
||||
|
@ -98,6 +99,15 @@ export const searchReducer = handleActions(
|
|||
...state,
|
||||
isActive: false,
|
||||
}),
|
||||
|
||||
[ACTIONS.SEARCH_FOCUS]: (state: SearchState): SearchState => ({
|
||||
...state,
|
||||
focused: true,
|
||||
}),
|
||||
[ACTIONS.SEARCH_BLUR]: (state: SearchState): SearchState => ({
|
||||
...state,
|
||||
focused: false,
|
||||
}),
|
||||
},
|
||||
defaultState
|
||||
);
|
||||
|
|
|
@ -35,3 +35,5 @@ export const selectWunderBarAddress = createSelector(
|
|||
return query;
|
||||
}
|
||||
);
|
||||
|
||||
export const selectSearchBarFocused = createSelector(selectState, state => state.focused);
|
||||
|
|
Loading…
Reference in a new issue