more fixes but not all of the fixes :(
This commit is contained in:
parent
60d298b354
commit
1dedb9873c
7 changed files with 36 additions and 37 deletions
|
@ -7,22 +7,15 @@ import FilePrice from 'component/filePrice'
|
|||
import UriIndicator from 'component/uriIndicator';
|
||||
|
||||
class FileCard extends React.Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
showNsfwHelp: false
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const {
|
||||
resolvingUri,
|
||||
isResolvingUri,
|
||||
resolveUri,
|
||||
claim,
|
||||
uri,
|
||||
} = this.props
|
||||
|
||||
if(!resolvingUri && !claim && uri) {
|
||||
if(!isResolvingUri && !claim && uri) {
|
||||
resolveUri(uri)
|
||||
}
|
||||
}
|
||||
|
@ -49,16 +42,14 @@ class FileCard extends React.Component {
|
|||
} = this.props
|
||||
|
||||
const uri = lbryuri.normalize(this.props.uri);
|
||||
const isConfirmed = !!metadata;
|
||||
const title = isConfirmed ? metadata.title : uri;
|
||||
const obscureNsfw = this.props.obscureNsfw && isConfirmed && metadata.nsfw;
|
||||
const title = !isResolvingUri && metadata && metadata.title ? metadata.title : uri;
|
||||
const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw;
|
||||
|
||||
let description = ""
|
||||
if (isConfirmed) {
|
||||
description = metadata.description
|
||||
} else if (isResolvingUri) {
|
||||
if (isResolvingUri) {
|
||||
description = "Loading..."
|
||||
} else {
|
||||
description = <span className="empty">This file is pending confirmation.</span>
|
||||
} else if (metadata && metadata.description) {
|
||||
description = metadata.description
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
@ -71,7 +71,7 @@ class FileList extends React.Component {
|
|||
contentName: fileInfo.name,
|
||||
channelName: fileInfo.channel_name,
|
||||
})
|
||||
content.push(<FileTile key={uri} uri={uri} hidePrice={hidePrices} hideOnRemove={true} />)
|
||||
content.push(<FileTile key={uri} uri={uri} hidePrice={hidePrices} hideOnRemove={true} showEmpty={""} />)
|
||||
})
|
||||
return (
|
||||
<section>
|
||||
|
|
|
@ -7,8 +7,10 @@ import {Thumbnail, TruncatedText,} from 'component/common.js';
|
|||
import FilePrice from 'component/filePrice'
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
|
||||
/*should be merged into FileTile once FileTile is refactored to take a single id*/
|
||||
class FileTile extends React.Component {
|
||||
static SHOW_EMPTY_PUBLISH = "publish"
|
||||
static SHOW_EMPTY_PENDING = "pending"
|
||||
|
||||
constructor(props) {
|
||||
super(props)
|
||||
this._fileInfoSubscribeId = null
|
||||
|
@ -62,46 +64,48 @@ class FileTile extends React.Component {
|
|||
}
|
||||
|
||||
const {
|
||||
claim,
|
||||
metadata,
|
||||
isResolvingUri,
|
||||
showEmpty,
|
||||
navigate,
|
||||
hidePrice,
|
||||
} = this.props
|
||||
|
||||
const uri = lbryuri.normalize(this.props.uri);
|
||||
const isConfirmed = !!metadata;
|
||||
const title = isConfirmed ? metadata.title : uri;
|
||||
const obscureNsfw = this.props.obscureNsfw && isConfirmed && metadata.nsfw;
|
||||
const isClaimed = !!claim;
|
||||
const title = isClaimed && metadata && metadata.title ? metadata.title : uri;
|
||||
const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw;
|
||||
let onClick = () => navigate('/show', { uri })
|
||||
|
||||
let description = ""
|
||||
if (isConfirmed) {
|
||||
if (isClaimed) {
|
||||
description = metadata.description
|
||||
} else if (isResolvingUri) {
|
||||
description = "Loading..."
|
||||
} else {
|
||||
} else if (showEmpty === FileTile.SHOW_EMPTY_PUBLISH) {
|
||||
onClick = () => navigate('/publish')
|
||||
description = <span className="empty">This location is unclaimed - <Link label="put something here" />!</span>
|
||||
} else if (showEmpty === FileTile.SHOW_EMPTY_PENDING) {
|
||||
description = <span className="empty">This file is pending confirmation.</span>
|
||||
}
|
||||
|
||||
return (
|
||||
<section className={ 'file-tile card ' + (obscureNsfw ? 'card--obscured ' : '') } onMouseEnter={this.handleMouseOver.bind(this)} onMouseLeave={this.handleMouseOut.bind(this)}>
|
||||
<Link onClick={() => navigate('/show', { uri })} className="card__link" className="card__link">
|
||||
<Link onClick={onClick} className="card__link" className="card__link">
|
||||
<div className={"card__inner file-tile__row"}>
|
||||
<div className="card__media"
|
||||
style={{ backgroundImage: "url('" + (metadata && metadata.thumbnail ? metadata.thumbnail : lbry.imagePath('default-thumb.svg')) + "')" }}>
|
||||
</div>
|
||||
<div className="file-tile__content">
|
||||
<div className="card__title-primary">
|
||||
{ !this.props.hidePrice
|
||||
? <FilePrice uri={this.props.uri} />
|
||||
: null}
|
||||
{ !hidePrice ? <FilePrice uri={this.props.uri} /> : null}
|
||||
<div className="meta">{uri}</div>
|
||||
<h3><TruncatedText lines={1}>{title}</TruncatedText></h3>
|
||||
</div>
|
||||
<div className="card__content card__subtext">
|
||||
<TruncatedText lines={3}>
|
||||
{isConfirmed
|
||||
? metadata.description
|
||||
: <span className="empty">This file is pending confirmation.</span>}
|
||||
{description}
|
||||
</TruncatedText>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -2,6 +2,7 @@ import React from 'react'
|
|||
import {
|
||||
connect
|
||||
} from 'react-redux'
|
||||
import lbryuri from 'lbryuri.js'
|
||||
import {
|
||||
selectWunderBarAddress,
|
||||
selectWunderBarIcon
|
||||
|
@ -28,7 +29,7 @@ const perform = (dispatch) => ({
|
|||
// activateSearch: () => dispatch(doActivateSearch()),
|
||||
// deactivateSearch: () => setTimeout(() => { dispatch(doDeactivateSearch()) }, 50),
|
||||
onSearch: (query) => dispatch(doNavigate('/search', { query })),
|
||||
onSubmit: (query) => console.debug('you submitted'),
|
||||
onSubmit: (query) => dispatch(doNavigate('/show', { uri: lbryuri.normalize(query) } ))
|
||||
})
|
||||
|
||||
export default connect(select, perform)(Wunderbar)
|
||||
|
|
|
@ -40,11 +40,14 @@ class WunderBar extends React.PureComponent {
|
|||
|
||||
this.setState({ address: event.target.value })
|
||||
|
||||
let searchTerm = event.target.value;
|
||||
let searchQuery = event.target.value;
|
||||
|
||||
this._userTypingTimer = setTimeout(() => {
|
||||
this._resetOnNextBlur = false;
|
||||
this.props.onSearch(searchTerm);
|
||||
const hasQuery = searchQuery.length === 0;
|
||||
this._resetOnNextBlur = hasQuery;
|
||||
if (searchQuery) {
|
||||
this.props.onSearch(searchQuery);
|
||||
}
|
||||
}, 800); // 800ms delay, tweak for faster/slower
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ const DiscoverPage = (props) => {
|
|||
|
||||
let content
|
||||
|
||||
if (fetchingFeaturedUris) content = <BusyMessage message="Fetching landing content" />
|
||||
if (fetchingFeaturedUris) content = <BusyMessage message="Fetching content" />
|
||||
if (!fetchingFeaturedUris && failed) content = <div className="empty">Failed to load landing content.</div>
|
||||
if (!fetchingFeaturedUris && !failed) {
|
||||
content = Object.keys(featuredUris).map(category => {
|
||||
|
|
|
@ -74,7 +74,7 @@ const SearchPage = (props) => {
|
|||
Exact URL
|
||||
<ToolTip label="?" body="This is the resolution of a LBRY URL and not controlled by LBRY Inc." className="tooltip--header" />
|
||||
</h3>
|
||||
<FileTile uri={lbryuri.normalize(query)} showEmpty={true} />
|
||||
<FileTile uri={lbryuri.normalize(query)} showEmpty={FileTile.SHOW_EMPTY_PUBLISH} />
|
||||
</section> : '' }
|
||||
<section className="section-spaced">
|
||||
<h3 className="card-row__header">
|
||||
|
|
Loading…
Add table
Reference in a new issue