mainly more bug fixes
This commit is contained in:
parent
3c325b2f0a
commit
c1161fc10b
16 changed files with 101 additions and 132 deletions
|
@ -9,9 +9,6 @@ import {
|
||||||
import {
|
import {
|
||||||
selectBalance,
|
selectBalance,
|
||||||
} from 'selectors/wallet'
|
} from 'selectors/wallet'
|
||||||
import {
|
|
||||||
selectSearchTerm,
|
|
||||||
} from 'selectors/content'
|
|
||||||
import {
|
import {
|
||||||
selectCurrentUriFileInfo,
|
selectCurrentUriFileInfo,
|
||||||
selectDownloadingByUri,
|
selectDownloadingByUri,
|
||||||
|
@ -19,9 +16,6 @@ import {
|
||||||
import {
|
import {
|
||||||
selectCurrentUriCostInfo,
|
selectCurrentUriCostInfo,
|
||||||
} from 'selectors/cost_info'
|
} from 'selectors/cost_info'
|
||||||
import {
|
|
||||||
selectCurrentResolvedUriClaimOutpoint,
|
|
||||||
} from 'selectors/content'
|
|
||||||
import {
|
import {
|
||||||
selectClaimsByUri,
|
selectClaimsByUri,
|
||||||
} from 'selectors/claims'
|
} from 'selectors/claims'
|
||||||
|
@ -31,7 +25,6 @@ import {
|
||||||
import {
|
import {
|
||||||
doFetchCostInfoForUri,
|
doFetchCostInfoForUri,
|
||||||
} from 'actions/cost_info'
|
} from 'actions/cost_info'
|
||||||
import batchActions from 'util/batchActions'
|
|
||||||
|
|
||||||
export function doResolveUri(uri) {
|
export function doResolveUri(uri) {
|
||||||
return function(dispatch, getState) {
|
return function(dispatch, getState) {
|
||||||
|
@ -40,7 +33,7 @@ export function doResolveUri(uri) {
|
||||||
data: { uri }
|
data: { uri }
|
||||||
})
|
})
|
||||||
|
|
||||||
return lbry.resolve({ uri }).then((resolutionInfo) => {
|
lbry.resolve({ uri }).then((resolutionInfo) => {
|
||||||
const {
|
const {
|
||||||
claim,
|
claim,
|
||||||
certificate,
|
certificate,
|
||||||
|
|
|
@ -21,7 +21,15 @@ export function doFetchCostInfoForUri(uri) {
|
||||||
costInfo,
|
costInfo,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}).catch(() => {})
|
}).catch(() => {
|
||||||
|
dispatch({
|
||||||
|
type: types.FETCH_COST_INFO_COMPLETED,
|
||||||
|
data: {
|
||||||
|
uri,
|
||||||
|
costInfo: {}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import * as types from 'constants/action_types'
|
import * as types from 'constants/action_types'
|
||||||
import lbry from 'lbry'
|
|
||||||
import lbryio from 'lbryio'
|
|
||||||
import lbryuri from 'lbryuri'
|
import lbryuri from 'lbryuri'
|
||||||
import lighthouse from 'lighthouse'
|
import lighthouse from 'lighthouse'
|
||||||
import {
|
import {
|
||||||
|
@ -12,9 +10,6 @@ import {
|
||||||
import {
|
import {
|
||||||
selectCurrentPage,
|
selectCurrentPage,
|
||||||
} from 'selectors/app'
|
} from 'selectors/app'
|
||||||
import {
|
|
||||||
selectSearchQuery,
|
|
||||||
} from 'selectors/search'
|
|
||||||
|
|
||||||
export function doSearch(query) {
|
export function doSearch(query) {
|
||||||
return function(dispatch, getState) {
|
return function(dispatch, getState) {
|
||||||
|
@ -27,16 +22,15 @@ export function doSearch(query) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if(page != 'search' && query != undefined) {
|
|
||||||
return dispatch(doNavigate('search', { query: query }))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: types.SEARCH_STARTED,
|
type: types.SEARCH_STARTED,
|
||||||
data: { query }
|
data: { query }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if(page != 'search') {
|
||||||
|
dispatch(doNavigate('search', { query: query }))
|
||||||
|
}
|
||||||
|
|
||||||
lighthouse.search(query).then(results => {
|
lighthouse.search(query).then(results => {
|
||||||
results.forEach(result => {
|
results.forEach(result => {
|
||||||
const uri = lbryuri.build({
|
const uri = lbryuri.build({
|
||||||
|
|
|
@ -5,6 +5,9 @@ import {
|
||||||
import {
|
import {
|
||||||
doNavigate,
|
doNavigate,
|
||||||
} from 'actions/app'
|
} from 'actions/app'
|
||||||
|
import {
|
||||||
|
doResolveUri,
|
||||||
|
} from 'actions/content'
|
||||||
import {
|
import {
|
||||||
makeSelectClaimForUri,
|
makeSelectClaimForUri,
|
||||||
makeSelectSourceForUri,
|
makeSelectSourceForUri,
|
||||||
|
@ -49,7 +52,8 @@ const makeSelect = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const perform = (dispatch) => ({
|
const perform = (dispatch) => ({
|
||||||
navigate: (path, params) => dispatch(doNavigate(path, params))
|
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
||||||
|
resolveUri: (uri) => dispatch(doResolveUri(uri)),
|
||||||
})
|
})
|
||||||
|
|
||||||
export default connect(makeSelect, perform)(FileTile)
|
export default connect(makeSelect, perform)(FileTile)
|
|
@ -22,10 +22,22 @@ class FileTile extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
const {
|
||||||
|
isResolvingUri,
|
||||||
|
resolveUri,
|
||||||
|
claim,
|
||||||
|
uri,
|
||||||
|
} = this.props
|
||||||
|
|
||||||
this._isMounted = true;
|
this._isMounted = true;
|
||||||
|
|
||||||
if (this.props.hideOnRemove) {
|
if (this.props.hideOnRemove) {
|
||||||
this._fileInfoSubscribeId = lbry.fileInfoSubscribe(this.props.outpoint, this.onFileInfoUpdate);
|
this._fileInfoSubscribeId = lbry.fileInfoSubscribe(this.props.outpoint, this.onFileInfoUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!isResolvingUri && !claim && uri) {
|
||||||
|
resolveUri(uri)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
@ -85,14 +97,14 @@ class FileTile extends React.Component {
|
||||||
description = "Loading..."
|
description = "Loading..."
|
||||||
} else if (showEmpty === FileTile.SHOW_EMPTY_PUBLISH) {
|
} else if (showEmpty === FileTile.SHOW_EMPTY_PUBLISH) {
|
||||||
onClick = () => navigate('/publish')
|
onClick = () => navigate('/publish')
|
||||||
description = <span className="empty">This location is unclaimed - <Link label="put something here" />!</span>
|
description = <span className="empty">This location is unclaimed - <span className="button-text">put something here</span>!</span>
|
||||||
} else if (showEmpty === FileTile.SHOW_EMPTY_PENDING) {
|
} else if (showEmpty === FileTile.SHOW_EMPTY_PENDING) {
|
||||||
description = <span className="empty">This file is pending confirmation.</span>
|
description = <span className="empty">This file is pending confirmation.</span>
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className={ 'file-tile card ' + (obscureNsfw ? 'card--obscured ' : '') } onMouseEnter={this.handleMouseOver.bind(this)} onMouseLeave={this.handleMouseOut.bind(this)}>
|
<section className={ 'file-tile card ' + (obscureNsfw ? 'card--obscured ' : '') } onMouseEnter={this.handleMouseOver.bind(this)} onMouseLeave={this.handleMouseOut.bind(this)}>
|
||||||
<Link onClick={onClick} className="card__link" className="card__link">
|
<Link onClick={onClick} className="card__link">
|
||||||
<div className={"card__inner file-tile__row"}>
|
<div className={"card__inner file-tile__row"}>
|
||||||
<div className="card__media"
|
<div className="card__media"
|
||||||
style={{ backgroundImage: "url('" + (metadata && metadata.thumbnail ? metadata.thumbnail : lbry.imagePath('default-thumb.svg')) + "')" }}>
|
style={{ backgroundImage: "url('" + (metadata && metadata.thumbnail ? metadata.thumbnail : lbry.imagePath('default-thumb.svg')) + "')" }}>
|
||||||
|
|
|
@ -64,43 +64,7 @@ const plyr = require('plyr')
|
||||||
class Video extends React.Component {
|
class Video extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
|
this.state = { isPlaying: false }
|
||||||
// TODO none of this mouse handling stuff seems to actually do anything?
|
|
||||||
this._controlsHideDelay = 3000 // Note: this needs to be shorter than the built-in delay in Electron, or Electron will hide the controls before us
|
|
||||||
this._controlsHideTimeout = null
|
|
||||||
this.state = {}
|
|
||||||
}
|
|
||||||
handleMouseMove() {
|
|
||||||
if (this._controlsTimeout) {
|
|
||||||
clearTimeout(this._controlsTimeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.state.controlsShown) {
|
|
||||||
this.setState({
|
|
||||||
controlsShown: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this._controlsTimeout = setTimeout(() => {
|
|
||||||
if (!this.isMounted) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.setState({
|
|
||||||
controlsShown: false,
|
|
||||||
});
|
|
||||||
}, this._controlsHideDelay);
|
|
||||||
}
|
|
||||||
|
|
||||||
handleMouseLeave() {
|
|
||||||
if (this._controlsTimeout) {
|
|
||||||
clearTimeout(this._controlsTimeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.state.controlsShown) {
|
|
||||||
this.setState({
|
|
||||||
controlsShown: false,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onWatchClick() {
|
onWatchClick() {
|
||||||
|
@ -141,7 +105,7 @@ class Video extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div onMouseMove={this.handleMouseMove.bind(this)} onMouseLeave={this.handleMouseLeave.bind(this)} className={"video " + this.props.className + (isPlaying && readyToPlay ? " video--active" : " video--hidden")}>{
|
<div className={"video " + this.props.className + (isPlaying && readyToPlay ? " video--active" : " video--hidden")}>{
|
||||||
isPlaying ?
|
isPlaying ?
|
||||||
!readyToPlay ?
|
!readyToPlay ?
|
||||||
<span>this is the world's worst loading screen and we shipped our software with it anyway... <br /><br />{loadStatusMessage}</span> :
|
<span>this is the world's worst loading screen and we shipped our software with it anyway... <br /><br />{loadStatusMessage}</span> :
|
||||||
|
|
|
@ -3,6 +3,8 @@ import lbryuri from 'lbryuri.js';
|
||||||
import {Icon} from 'component/common.js';
|
import {Icon} from 'component/common.js';
|
||||||
|
|
||||||
class WunderBar extends React.PureComponent {
|
class WunderBar extends React.PureComponent {
|
||||||
|
static TYPING_TIMEOUT = 800
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
onSearch: React.PropTypes.func.isRequired,
|
onSearch: React.PropTypes.func.isRequired,
|
||||||
onSubmit: React.PropTypes.func.isRequired
|
onSubmit: React.PropTypes.func.isRequired
|
||||||
|
@ -11,6 +13,7 @@ class WunderBar extends React.PureComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this._userTypingTimer = null;
|
this._userTypingTimer = null;
|
||||||
|
this._isSearchDispatchPending = false;
|
||||||
this._input = null;
|
this._input = null;
|
||||||
this._stateBeforeSearch = null;
|
this._stateBeforeSearch = null;
|
||||||
this._resetOnNextBlur = true;
|
this._resetOnNextBlur = true;
|
||||||
|
@ -40,15 +43,18 @@ class WunderBar extends React.PureComponent {
|
||||||
|
|
||||||
this.setState({ address: event.target.value })
|
this.setState({ address: event.target.value })
|
||||||
|
|
||||||
|
this._isSearchDispatchPending = true;
|
||||||
|
|
||||||
let searchQuery = event.target.value;
|
let searchQuery = event.target.value;
|
||||||
|
|
||||||
this._userTypingTimer = setTimeout(() => {
|
this._userTypingTimer = setTimeout(() => {
|
||||||
const hasQuery = searchQuery.length === 0;
|
const hasQuery = searchQuery.length === 0;
|
||||||
this._resetOnNextBlur = hasQuery;
|
this._resetOnNextBlur = hasQuery;
|
||||||
|
this._isSearchDispatchPending = false;
|
||||||
if (searchQuery) {
|
if (searchQuery) {
|
||||||
this.props.onSearch(searchQuery);
|
this.props.onSearch(searchQuery);
|
||||||
}
|
}
|
||||||
}, 800); // 800ms delay, tweak for faster/slower
|
}, WunderBar.TYPING_TIMEOUT); // 800ms delay, tweak for faster/slower
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
|
@ -74,14 +80,21 @@ class WunderBar extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
onBlur() {
|
onBlur() {
|
||||||
let commonState = {isActive: false};
|
if (this._isSearchDispatchPending) {
|
||||||
if (this._resetOnNextBlur) {
|
setTimeout(() => {
|
||||||
this.setState(Object.assign({}, this._stateBeforeSearch, commonState));
|
this.onBlur();
|
||||||
this._input.value = this.state.address;
|
}, WunderBar.TYPING_TIMEOUT + 1)
|
||||||
} else {
|
} else {
|
||||||
this._resetOnNextBlur = true;
|
let commonState = {isActive: false};
|
||||||
this._stateBeforeSearch = this.state;
|
if (this._resetOnNextBlur) {
|
||||||
this.setState(commonState);
|
this.setState(Object.assign({}, this._stateBeforeSearch, commonState));
|
||||||
|
this._input.value = this.state.address;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this._resetOnNextBlur = true;
|
||||||
|
this._stateBeforeSearch = this.state;
|
||||||
|
this.setState(commonState);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,12 @@ import {
|
||||||
selectCurrentUri,
|
selectCurrentUri,
|
||||||
} from 'selectors/app'
|
} from 'selectors/app'
|
||||||
import {
|
import {
|
||||||
|
selectCurrentUriFileInfo,
|
||||||
selectCurrentUriIsDownloaded,
|
selectCurrentUriIsDownloaded,
|
||||||
} from 'selectors/file_info'
|
} from 'selectors/file_info'
|
||||||
import {
|
import {
|
||||||
selectCurrentUriClaim,
|
selectCurrentUriClaim,
|
||||||
} from 'selectors/claims'
|
} from 'selectors/claims'
|
||||||
import {
|
|
||||||
selectCurrentUriFileInfo,
|
|
||||||
} from 'selectors/file_info'
|
|
||||||
import {
|
import {
|
||||||
selectCurrentUriCostInfo,
|
selectCurrentUriCostInfo,
|
||||||
} from 'selectors/cost_info'
|
} from 'selectors/cost_info'
|
||||||
|
|
|
@ -88,6 +88,8 @@ const FilePage = (props) => {
|
||||||
const channelUri = signatureIsValid && hasSignature && channelUriObj.isChannel ? lbryuri.build(channelUriObj, false) : null;
|
const channelUri = signatureIsValid && hasSignature && channelUriObj.isChannel ? lbryuri.build(channelUriObj, false) : null;
|
||||||
const uriIndicator = <UriIndicator uri={uri} />
|
const uriIndicator = <UriIndicator uri={uri} />
|
||||||
|
|
||||||
|
// <p>This location is not yet in use. { ' ' }<Link onClick={() => navigate('/publish')} label="Put something here" />.</p>
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="main--single-column">
|
<main className="main--single-column">
|
||||||
<section className="show-page-media">
|
<section className="show-page-media">
|
||||||
|
|
|
@ -14,8 +14,7 @@ import SearchPage from './view'
|
||||||
|
|
||||||
const select = (state) => ({
|
const select = (state) => ({
|
||||||
isSearching: selectIsSearching(state),
|
isSearching: selectIsSearching(state),
|
||||||
query: selectSearchQuery(state),
|
query: selectSearchQuery(state)
|
||||||
results: selectCurrentSearchResults(state),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const perform = (dispatch) => ({
|
const perform = (dispatch) => ({
|
||||||
|
|
|
@ -8,9 +8,6 @@ import {BusyMessage} from 'component/common.js';
|
||||||
|
|
||||||
class SearchPage extends React.Component{
|
class SearchPage extends React.Component{
|
||||||
render() {
|
render() {
|
||||||
console.log('searhc page render');
|
|
||||||
console.log(this.props);
|
|
||||||
|
|
||||||
const isValidUri = (query) => true //FIXME
|
const isValidUri = (query) => true //FIXME
|
||||||
const {
|
const {
|
||||||
query,
|
query,
|
||||||
|
|
|
@ -8,39 +8,22 @@ import {
|
||||||
import {
|
import {
|
||||||
selectCurrentUri,
|
selectCurrentUri,
|
||||||
} from 'selectors/app'
|
} from 'selectors/app'
|
||||||
import {
|
|
||||||
selectCurrentUriIsDownloaded,
|
|
||||||
} from 'selectors/file_info'
|
|
||||||
import {
|
import {
|
||||||
selectCurrentUriClaim,
|
selectCurrentUriClaim,
|
||||||
} from 'selectors/claims'
|
} from 'selectors/claims'
|
||||||
import {
|
import {
|
||||||
selectCurrentUriFileInfo,
|
selectCurrentUriIsResolving,
|
||||||
} from 'selectors/file_info'
|
|
||||||
import {
|
|
||||||
selectCurrentUriCostInfo,
|
|
||||||
} from 'selectors/cost_info'
|
|
||||||
import {
|
|
||||||
makeSelectResolvingUri,
|
|
||||||
} from 'selectors/content'
|
} from 'selectors/content'
|
||||||
import ShowPage from './view'
|
import ShowPage from './view'
|
||||||
|
|
||||||
const makeSelect = () => {
|
const select = (state, props) => ({
|
||||||
const selectResolvingUri = makeSelectResolvingUri()
|
claim: selectCurrentUriClaim(state),
|
||||||
|
uri: selectCurrentUri(state),
|
||||||
const select = (state, props) => ({
|
isResolvingUri: selectCurrentUriIsResolving(state)
|
||||||
claim: selectCurrentUriClaim(state),
|
})
|
||||||
uri: selectCurrentUri(state),
|
|
||||||
isResolvingUri: selectResolvingUri(state, props),
|
|
||||||
claimType: 'file',
|
|
||||||
})
|
|
||||||
|
|
||||||
return select
|
|
||||||
}
|
|
||||||
|
|
||||||
const perform = (dispatch) => ({
|
const perform = (dispatch) => ({
|
||||||
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
|
||||||
resolveUri: (uri) => dispatch(doResolveUri(uri))
|
resolveUri: (uri) => dispatch(doResolveUri(uri))
|
||||||
})
|
})
|
||||||
|
|
||||||
export default connect(makeSelect, perform)(ShowPage)
|
export default connect(select, perform)(ShowPage)
|
||||||
|
|
|
@ -6,12 +6,20 @@ import FilePage from 'page/filePage'
|
||||||
|
|
||||||
class ShowPage extends React.Component{
|
class ShowPage extends React.Component{
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
|
this.resolve(this.props)
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
this.resolve(nextProps)
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(props) {
|
||||||
const {
|
const {
|
||||||
isResolvingUri,
|
isResolvingUri,
|
||||||
resolveUri,
|
resolveUri,
|
||||||
claim,
|
claim,
|
||||||
uri,
|
uri,
|
||||||
} = this.props
|
} = props
|
||||||
|
|
||||||
if(!isResolvingUri && !claim && uri) {
|
if(!isResolvingUri && !claim && uri) {
|
||||||
resolveUri(uri)
|
resolveUri(uri)
|
||||||
|
@ -20,41 +28,29 @@ class ShowPage extends React.Component{
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
claim: {
|
claim,
|
||||||
value: {
|
|
||||||
stream: {
|
|
||||||
metadata
|
|
||||||
} = {},
|
|
||||||
} = {},
|
|
||||||
} = {},
|
|
||||||
navigate,
|
|
||||||
uri,
|
uri,
|
||||||
isResolvingUri,
|
isResolvingUri,
|
||||||
claimType,
|
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
const pageTitle = metadata ? metadata.title : uri;
|
|
||||||
|
|
||||||
let innerContent = "";
|
let innerContent = "";
|
||||||
|
|
||||||
if (isResolvingUri) {
|
if (isResolvingUri) {
|
||||||
innerContent = <section className="card">
|
innerContent = <section className="card">
|
||||||
<div className="card__inner">
|
<div className="card__inner">
|
||||||
<div className="card__title-identity"><h1>{pageTitle}</h1></div>
|
<div className="card__title-identity"><h1>{uri}</h1></div>
|
||||||
</div>
|
</div>
|
||||||
<div className="card__content">
|
<div className="card__content">
|
||||||
{ isResolvingUri ?
|
<BusyMessage message="Loading magic decentralized data..." /> :
|
||||||
<BusyMessage message="Loading magic decentralized data..." /> :
|
|
||||||
<p>This location is not yet in use. { ' ' }<Link onClick={() => navigate('/publish')} label="Put something here" />.</p>
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
</section>;
|
</section>;
|
||||||
}
|
}
|
||||||
else if (claimType == "channel") {
|
else if (claim && claim.whatever) {
|
||||||
innerContent = <ChannelPage title={uri} />
|
innerContent = "channel"
|
||||||
|
// innerContent = <ChannelPage title={uri} />
|
||||||
}
|
}
|
||||||
else {
|
else if (claim) {
|
||||||
innerContent = <FilePage uri={uri} />
|
innerContent = <FilePage />
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -53,6 +53,13 @@ export const selectResolvingUris = createSelector(
|
||||||
(state) => state.resolvingUris || []
|
(state) => state.resolvingUris || []
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
export const selectCurrentUriIsResolving = createSelector(
|
||||||
|
selectCurrentUri,
|
||||||
|
selectResolvingUris,
|
||||||
|
(uri, resolvingUris) => resolvingUris.indexOf(uri) != -1
|
||||||
|
)
|
||||||
|
|
||||||
const selectResolvingUri = (state, props) => {
|
const selectResolvingUri = (state, props) => {
|
||||||
return selectResolvingUris(state).indexOf(props.uri) != -1
|
return selectResolvingUris(state).indexOf(props.uri) != -1
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import { createSelector } from 'reselect'
|
import { createSelector } from 'reselect'
|
||||||
import {
|
import {
|
||||||
selectCurrentParams,
|
|
||||||
selectDaemonReady,
|
|
||||||
selectPageTitle,
|
selectPageTitle,
|
||||||
selectCurrentPage,
|
selectCurrentPage,
|
||||||
selectCurrentUri
|
selectCurrentUri
|
||||||
|
@ -10,8 +8,8 @@ import {
|
||||||
export const _selectState = state => state.search || {}
|
export const _selectState = state => state.search || {}
|
||||||
|
|
||||||
export const selectSearchQuery = createSelector(
|
export const selectSearchQuery = createSelector(
|
||||||
selectCurrentParams,
|
_selectState,
|
||||||
(params) => params.query
|
(state) => state.query
|
||||||
)
|
)
|
||||||
|
|
||||||
export const selectIsSearching = createSelector(
|
export const selectIsSearching = createSelector(
|
||||||
|
@ -37,9 +35,10 @@ export const selectCurrentSearchResults = createSelector(
|
||||||
|
|
||||||
|
|
||||||
export const selectWunderBarAddress = createSelector(
|
export const selectWunderBarAddress = createSelector(
|
||||||
|
selectCurrentPage,
|
||||||
selectPageTitle,
|
selectPageTitle,
|
||||||
selectSearchQuery,
|
selectSearchQuery,
|
||||||
(title, query) => query || title
|
(page, title, query) => page != "search" ? title : (query ? query : title)
|
||||||
)
|
)
|
||||||
|
|
||||||
export const selectWunderBarIcon = createSelector(
|
export const selectWunderBarIcon = createSelector(
|
||||||
|
|
|
@ -62,12 +62,12 @@ const reducers = redux.combineReducers({
|
||||||
const bulkThunk = createBulkThunkMiddleware()
|
const bulkThunk = createBulkThunkMiddleware()
|
||||||
const middleware = [thunk, bulkThunk]
|
const middleware = [thunk, bulkThunk]
|
||||||
|
|
||||||
// if (env === 'development') {
|
if (env === 'development') {
|
||||||
// const logger = createLogger({
|
const logger = createLogger({
|
||||||
// collapsed: true
|
collapsed: true
|
||||||
// });
|
});
|
||||||
// middleware.push(logger)
|
middleware.push(logger)
|
||||||
// }
|
}
|
||||||
|
|
||||||
const createStoreWithMiddleware = redux.compose(
|
const createStoreWithMiddleware = redux.compose(
|
||||||
redux.applyMiddleware(...middleware)
|
redux.applyMiddleware(...middleware)
|
||||||
|
|
Loading…
Add table
Reference in a new issue