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';
|
import UriIndicator from 'component/uriIndicator';
|
||||||
|
|
||||||
class FileCard extends React.Component {
|
class FileCard extends React.Component {
|
||||||
constructor(props) {
|
|
||||||
super(props)
|
|
||||||
this.state = {
|
|
||||||
showNsfwHelp: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const {
|
const {
|
||||||
resolvingUri,
|
isResolvingUri,
|
||||||
resolveUri,
|
resolveUri,
|
||||||
claim,
|
claim,
|
||||||
uri,
|
uri,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
if(!resolvingUri && !claim && uri) {
|
if(!isResolvingUri && !claim && uri) {
|
||||||
resolveUri(uri)
|
resolveUri(uri)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,16 +42,14 @@ class FileCard extends React.Component {
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
const uri = lbryuri.normalize(this.props.uri);
|
const uri = lbryuri.normalize(this.props.uri);
|
||||||
const isConfirmed = !!metadata;
|
const title = !isResolvingUri && metadata && metadata.title ? metadata.title : uri;
|
||||||
const title = isConfirmed ? metadata.title : uri;
|
const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw;
|
||||||
const obscureNsfw = this.props.obscureNsfw && isConfirmed && metadata.nsfw;
|
|
||||||
let description = ""
|
let description = ""
|
||||||
if (isConfirmed) {
|
if (isResolvingUri) {
|
||||||
description = metadata.description
|
|
||||||
} else if (isResolvingUri) {
|
|
||||||
description = "Loading..."
|
description = "Loading..."
|
||||||
} else {
|
} else if (metadata && metadata.description) {
|
||||||
description = <span className="empty">This file is pending confirmation.</span>
|
description = metadata.description
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -71,7 +71,7 @@ class FileList extends React.Component {
|
||||||
contentName: fileInfo.name,
|
contentName: fileInfo.name,
|
||||||
channelName: fileInfo.channel_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 (
|
return (
|
||||||
<section>
|
<section>
|
||||||
|
|
|
@ -7,8 +7,10 @@ import {Thumbnail, TruncatedText,} from 'component/common.js';
|
||||||
import FilePrice from 'component/filePrice'
|
import FilePrice from 'component/filePrice'
|
||||||
import UriIndicator from 'component/uriIndicator';
|
import UriIndicator from 'component/uriIndicator';
|
||||||
|
|
||||||
/*should be merged into FileTile once FileTile is refactored to take a single id*/
|
|
||||||
class FileTile extends React.Component {
|
class FileTile extends React.Component {
|
||||||
|
static SHOW_EMPTY_PUBLISH = "publish"
|
||||||
|
static SHOW_EMPTY_PENDING = "pending"
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
this._fileInfoSubscribeId = null
|
this._fileInfoSubscribeId = null
|
||||||
|
@ -62,46 +64,48 @@ class FileTile extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
claim,
|
||||||
metadata,
|
metadata,
|
||||||
isResolvingUri,
|
isResolvingUri,
|
||||||
|
showEmpty,
|
||||||
navigate,
|
navigate,
|
||||||
hidePrice,
|
hidePrice,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
const uri = lbryuri.normalize(this.props.uri);
|
const uri = lbryuri.normalize(this.props.uri);
|
||||||
const isConfirmed = !!metadata;
|
const isClaimed = !!claim;
|
||||||
const title = isConfirmed ? metadata.title : uri;
|
const title = isClaimed && metadata && metadata.title ? metadata.title : uri;
|
||||||
const obscureNsfw = this.props.obscureNsfw && isConfirmed && metadata.nsfw;
|
const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw;
|
||||||
|
let onClick = () => navigate('/show', { uri })
|
||||||
|
|
||||||
let description = ""
|
let description = ""
|
||||||
if (isConfirmed) {
|
if (isClaimed) {
|
||||||
description = metadata.description
|
description = metadata.description
|
||||||
} else if (isResolvingUri) {
|
} else if (isResolvingUri) {
|
||||||
description = "Loading..."
|
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>
|
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={() => 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__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')) + "')" }}>
|
||||||
</div>
|
</div>
|
||||||
<div className="file-tile__content">
|
<div className="file-tile__content">
|
||||||
<div className="card__title-primary">
|
<div className="card__title-primary">
|
||||||
{ !this.props.hidePrice
|
{ !hidePrice ? <FilePrice uri={this.props.uri} /> : null}
|
||||||
? <FilePrice uri={this.props.uri} />
|
|
||||||
: null}
|
|
||||||
<div className="meta">{uri}</div>
|
<div className="meta">{uri}</div>
|
||||||
<h3><TruncatedText lines={1}>{title}</TruncatedText></h3>
|
<h3><TruncatedText lines={1}>{title}</TruncatedText></h3>
|
||||||
</div>
|
</div>
|
||||||
<div className="card__content card__subtext">
|
<div className="card__content card__subtext">
|
||||||
<TruncatedText lines={3}>
|
<TruncatedText lines={3}>
|
||||||
{isConfirmed
|
{description}
|
||||||
? metadata.description
|
|
||||||
: <span className="empty">This file is pending confirmation.</span>}
|
|
||||||
</TruncatedText>
|
</TruncatedText>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,6 +2,7 @@ import React from 'react'
|
||||||
import {
|
import {
|
||||||
connect
|
connect
|
||||||
} from 'react-redux'
|
} from 'react-redux'
|
||||||
|
import lbryuri from 'lbryuri.js'
|
||||||
import {
|
import {
|
||||||
selectWunderBarAddress,
|
selectWunderBarAddress,
|
||||||
selectWunderBarIcon
|
selectWunderBarIcon
|
||||||
|
@ -28,7 +29,7 @@ const perform = (dispatch) => ({
|
||||||
// activateSearch: () => dispatch(doActivateSearch()),
|
// activateSearch: () => dispatch(doActivateSearch()),
|
||||||
// deactivateSearch: () => setTimeout(() => { dispatch(doDeactivateSearch()) }, 50),
|
// deactivateSearch: () => setTimeout(() => { dispatch(doDeactivateSearch()) }, 50),
|
||||||
onSearch: (query) => dispatch(doNavigate('/search', { query })),
|
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)
|
export default connect(select, perform)(Wunderbar)
|
||||||
|
|
|
@ -40,11 +40,14 @@ class WunderBar extends React.PureComponent {
|
||||||
|
|
||||||
this.setState({ address: event.target.value })
|
this.setState({ address: event.target.value })
|
||||||
|
|
||||||
let searchTerm = event.target.value;
|
let searchQuery = event.target.value;
|
||||||
|
|
||||||
this._userTypingTimer = setTimeout(() => {
|
this._userTypingTimer = setTimeout(() => {
|
||||||
this._resetOnNextBlur = false;
|
const hasQuery = searchQuery.length === 0;
|
||||||
this.props.onSearch(searchTerm);
|
this._resetOnNextBlur = hasQuery;
|
||||||
|
if (searchQuery) {
|
||||||
|
this.props.onSearch(searchQuery);
|
||||||
|
}
|
||||||
}, 800); // 800ms delay, tweak for faster/slower
|
}, 800); // 800ms delay, tweak for faster/slower
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ const DiscoverPage = (props) => {
|
||||||
|
|
||||||
let content
|
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 = <div className="empty">Failed to load landing content.</div>
|
||||||
if (!fetchingFeaturedUris && !failed) {
|
if (!fetchingFeaturedUris && !failed) {
|
||||||
content = Object.keys(featuredUris).map(category => {
|
content = Object.keys(featuredUris).map(category => {
|
||||||
|
|
|
@ -74,7 +74,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={lbryuri.normalize(query)} showEmpty={true} />
|
<FileTile uri={lbryuri.normalize(query)} showEmpty={FileTile.SHOW_EMPTY_PUBLISH} />
|
||||||
</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