Make FileTile resolve URIs (fixes exact search matching)
This commit is contained in:
parent
c0053363ff
commit
84b86ff8e4
4 changed files with 28 additions and 17 deletions
|
@ -146,12 +146,6 @@ export function doFetchFeaturedUris() {
|
||||||
uris: featuredUris,
|
uris: featuredUris,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
Object.keys(Uris).forEach((category) => {
|
|
||||||
Uris[category].forEach((uri) => {
|
|
||||||
dispatch(doResolveUri(lbryuri.normalize(uri)))
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const failure = () => {
|
const failure = () => {
|
||||||
|
|
|
@ -8,20 +8,30 @@ import {
|
||||||
import {
|
import {
|
||||||
makeSelectFileInfoForUri,
|
makeSelectFileInfoForUri,
|
||||||
} from 'selectors/file_info'
|
} from 'selectors/file_info'
|
||||||
|
import {
|
||||||
|
makeSelectResolvingUri,
|
||||||
|
} from 'selectors/content'
|
||||||
|
import {
|
||||||
|
doResolveUri,
|
||||||
|
} from 'actions/content'
|
||||||
import FileTile from './view'
|
import FileTile from './view'
|
||||||
|
|
||||||
const makeSelect = () => {
|
const makeSelect = () => {
|
||||||
const selectClaimForUri = makeSelectClaimForUri()
|
const selectClaimForUri = makeSelectClaimForUri()
|
||||||
const selectFileInfoForUri = makeSelectFileInfoForUri()
|
const selectFileInfoForUri = makeSelectFileInfoForUri()
|
||||||
|
const selectResolvingUri = makeSelectResolvingUri()
|
||||||
|
|
||||||
const select = (state, props) => ({
|
const select = (state, props) => ({
|
||||||
claim: selectClaimForUri(state, props),
|
claim: selectClaimForUri(state, props),
|
||||||
fileInfo: selectFileInfoForUri(state, props),
|
fileInfo: selectFileInfoForUri(state, props),
|
||||||
|
resolvingUri: selectResolvingUri(state, props),
|
||||||
})
|
})
|
||||||
|
|
||||||
return select
|
return select
|
||||||
}
|
}
|
||||||
|
|
||||||
const perform = (dispatch) => ({
|
const perform = (dispatch) => ({
|
||||||
|
resolveUri: (uri) => dispatch(doResolveUri(uri)),
|
||||||
})
|
})
|
||||||
|
|
||||||
export default connect(makeSelect, perform)(FileTile)
|
export default connect(makeSelect, perform)(FileTile)
|
||||||
|
|
|
@ -7,24 +7,31 @@ import FileTileStream from 'component/fileTileStream'
|
||||||
import FileActions from 'component/fileActions';
|
import FileActions from 'component/fileActions';
|
||||||
|
|
||||||
class FileTile extends React.Component {
|
class FileTile extends React.Component {
|
||||||
|
componentDidMount() {
|
||||||
|
const {
|
||||||
|
resolvingUri,
|
||||||
|
resolveUri,
|
||||||
|
claim,
|
||||||
|
uri,
|
||||||
|
} = this.props
|
||||||
|
|
||||||
|
if(!resolvingUri && !claim) {
|
||||||
|
resolveUri(uri)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
displayStyle,
|
displayStyle,
|
||||||
uri,
|
uri,
|
||||||
claim,
|
claim,
|
||||||
|
resolvingUri,
|
||||||
|
resolveUri,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
if(!claim) {
|
if (displayStyle == 'card') return <FileCardStream uri={uri} />
|
||||||
if (displayStyle == 'card') {
|
|
||||||
return <FileCardStream uri={uri} />
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
return displayStyle == 'card' ?
|
return <FileTileStream uri={uri} />
|
||||||
<FileCardStream uri={uri} />
|
|
||||||
:
|
|
||||||
<FileTileStream uri={uri} key={uri} />
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ const SearchPage = (props) => {
|
||||||
Exact URL
|
Exact URL
|
||||||
<ToolTip label="?" body="This is the resolution of a LBRY URL and not controlled by LBRY Inc." className="tooltip--header" />
|
<ToolTip label="?" body="This is the resolution of a LBRY URL and not controlled by LBRY Inc." className="tooltip--header" />
|
||||||
</h3>
|
</h3>
|
||||||
<FileTile uri={query} showEmpty={true} />
|
<FileTile uri={lbryuri.normalize(query)} showEmpty={true} />
|
||||||
</section> : '' }
|
</section> : '' }
|
||||||
<section className="section-spaced">
|
<section className="section-spaced">
|
||||||
<h3 className="card-row__header">
|
<h3 className="card-row__header">
|
||||||
|
|
Loading…
Add table
Reference in a new issue