merge plus some bug fixes
This commit is contained in:
commit
9c02327b26
9 changed files with 42 additions and 149 deletions
|
@ -114,7 +114,7 @@ function getPidsForProcessName(name) {
|
||||||
function createWindow () {
|
function createWindow () {
|
||||||
win = new BrowserWindow({backgroundColor: '#155B4A', minWidth: 800, minHeight: 600 }) //$color-primary
|
win = new BrowserWindow({backgroundColor: '#155B4A', minWidth: 800, minHeight: 600 }) //$color-primary
|
||||||
win.maximize()
|
win.maximize()
|
||||||
// win.webContents.openDevTools();
|
win.webContents.openDevTools();
|
||||||
win.loadURL(`file://${__dirname}/dist/index.html`)
|
win.loadURL(`file://${__dirname}/dist/index.html`)
|
||||||
win.on('closed', () => {
|
win.on('closed', () => {
|
||||||
win = null
|
win = null
|
||||||
|
|
|
@ -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 = () => {
|
||||||
|
|
|
@ -5,6 +5,9 @@ import {
|
||||||
import {
|
import {
|
||||||
doNavigate,
|
doNavigate,
|
||||||
} from 'actions/app'
|
} from 'actions/app'
|
||||||
|
import {
|
||||||
|
doResolveUri,
|
||||||
|
} from 'actions/content'
|
||||||
import {
|
import {
|
||||||
selectHidePrice,
|
selectHidePrice,
|
||||||
selectObscureNsfw,
|
selectObscureNsfw,
|
||||||
|
@ -45,6 +48,7 @@ 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)(FileCard)
|
export default connect(makeSelect, perform)(FileCard)
|
||||||
|
|
|
@ -9,33 +9,21 @@ import UriIndicator from 'component/uriIndicator';
|
||||||
class FileCard extends React.Component {
|
class FileCard extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
this._fileInfoSubscribeId = null
|
|
||||||
this._isMounted = null
|
|
||||||
this._metadata = null
|
|
||||||
this.state = {
|
this.state = {
|
||||||
showNsfwHelp: false,
|
showNsfwHelp: false
|
||||||
isHidden: false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this._isMounted = true;
|
const {
|
||||||
if (this.props.hideOnRemove) {
|
resolvingUri,
|
||||||
this._fileInfoSubscribeId = lbry.fileInfoSubscribe(this.props.outpoint, this.onFileInfoUpdate);
|
resolveUri,
|
||||||
}
|
claim,
|
||||||
}
|
uri,
|
||||||
|
} = this.props
|
||||||
|
|
||||||
componentWillUnmount() {
|
if(!resolvingUri && !claim && uri) {
|
||||||
if (this._fileInfoSubscribeId) {
|
resolveUri(uri)
|
||||||
lbry.fileInfoUnsubscribe(this.props.outpoint, this._fileInfoSubscribeId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onFileInfoUpdate(fileInfo) {
|
|
||||||
if (!fileInfo && this._isMounted && this.props.hideOnRemove) {
|
|
||||||
this.setState({
|
|
||||||
isHidden: true
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,9 +40,6 @@ class FileCard extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.state.isHidden) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
metadata,
|
metadata,
|
||||||
|
@ -73,7 +58,7 @@ class FileCard extends React.Component {
|
||||||
} else if (isResolvingUri) {
|
} else if (isResolvingUri) {
|
||||||
description = "Loading..."
|
description = "Loading..."
|
||||||
} else {
|
} else {
|
||||||
description = <span className="empty">This file is pending confirmation</span>
|
description = <span className="empty">This file is pending confirmation.</span>
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -94,7 +79,7 @@ class FileCard extends React.Component {
|
||||||
<TruncatedText lines={2}>{description}</TruncatedText>
|
<TruncatedText lines={2}>{description}</TruncatedText>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
{this.state.showNsfwHelp && this.state.hovered
|
{obscureNsfw && this.state.hovered
|
||||||
? <div className='card-overlay'>
|
? <div className='card-overlay'>
|
||||||
<p>
|
<p>
|
||||||
This content is Not Safe For Work.
|
This content is Not Safe For Work.
|
||||||
|
|
|
@ -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} />)
|
content.push(<FileTile key={uri} uri={uri} hidePrice={hidePrices} hideOnRemove={true} />)
|
||||||
})
|
})
|
||||||
return (
|
return (
|
||||||
<section>
|
<section>
|
||||||
|
@ -89,96 +89,4 @@ class FileList extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// const FileList = React.createClass({
|
|
||||||
// _sortFunctions: {
|
|
||||||
// date: function(fileInfos) {
|
|
||||||
// return fileInfos.slice().reverse();
|
|
||||||
// },
|
|
||||||
// title: function(fileInfos) {
|
|
||||||
// return fileInfos.slice().sort(function(fileInfo1, fileInfo2) {
|
|
||||||
// const title1 = fileInfo1.metadata ? fileInfo1.metadata.title.toLowerCase() : fileInfo1.name;
|
|
||||||
// const title2 = fileInfo2.metadata ? fileInfo2.metadata.title.toLowerCase() : fileInfo2.name;
|
|
||||||
// if (title1 < title2) {
|
|
||||||
// return -1;
|
|
||||||
// } else if (title1 > title2) {
|
|
||||||
// return 1;
|
|
||||||
// } else {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// filename: function(fileInfos) {
|
|
||||||
// return fileInfos.slice().sort(function({file_name: fileName1}, {file_name: fileName2}) {
|
|
||||||
// const fileName1Lower = fileName1.toLowerCase();
|
|
||||||
// const fileName2Lower = fileName2.toLowerCase();
|
|
||||||
// if (fileName1Lower < fileName2Lower) {
|
|
||||||
// return -1;
|
|
||||||
// } else if (fileName2Lower > fileName1Lower) {
|
|
||||||
// return 1;
|
|
||||||
// } else {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// propTypes: {
|
|
||||||
// fileInfos: React.PropTypes.array.isRequired,
|
|
||||||
// hidePrices: React.PropTypes.bool,
|
|
||||||
// },
|
|
||||||
// getDefaultProps: function() {
|
|
||||||
// return {
|
|
||||||
// hidePrices: false,
|
|
||||||
// };
|
|
||||||
// },
|
|
||||||
// getInitialState: function() {
|
|
||||||
// return {
|
|
||||||
// sortBy: 'date',
|
|
||||||
// };
|
|
||||||
// },
|
|
||||||
// handleSortChanged: function(event) {
|
|
||||||
// this.setState({
|
|
||||||
// sortBy: event.target.value,
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
// render: function() {
|
|
||||||
// var content = [],
|
|
||||||
// seenUris = {};
|
|
||||||
|
|
||||||
// console.debug(this.props)
|
|
||||||
|
|
||||||
// const fileInfosSorted = this._sortFunctions[this.state.sortBy](this.props.fileInfos);
|
|
||||||
// for (let {outpoint, name, channel_name, metadata, mime_type, claim_id, has_signature, signature_is_valid} of fileInfosSorted) {
|
|
||||||
// if (seenUris[name] || !claim_id) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// let streamMetadata;
|
|
||||||
// if (metadata) {
|
|
||||||
// streamMetadata = metadata.stream.metadata;
|
|
||||||
// } else {
|
|
||||||
// streamMetadata = null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// const uri = lbryuri.build({contentName: name, channelName: channel_name});
|
|
||||||
// seenUris[name] = true;
|
|
||||||
// content.push(<FileTile key={outpoint} uri={uri} hideOnRemove={true} />)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return (
|
|
||||||
// <section>
|
|
||||||
// <span className='sort-section'>
|
|
||||||
// Sort by { ' ' }
|
|
||||||
// <FormField type="select" onChange={this.handleSortChanged}>
|
|
||||||
// <option value="date">Date</option>
|
|
||||||
// <option value="title">Title</option>
|
|
||||||
// <option value="filename">File name</option>
|
|
||||||
// </FormField>
|
|
||||||
// </span>
|
|
||||||
// {content}
|
|
||||||
// </section>
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
export default FileList
|
export default FileList
|
||||||
|
|
|
@ -52,4 +52,4 @@ const perform = (dispatch) => ({
|
||||||
navigate: (path, params) => dispatch(doNavigate(path, params))
|
navigate: (path, params) => dispatch(doNavigate(path, params))
|
||||||
})
|
})
|
||||||
|
|
||||||
export default connect(makeSelect, perform)(FileTile)
|
export default connect(makeSelect, perform)(FileTile)
|
|
@ -79,40 +79,42 @@ class FileTile extends React.Component {
|
||||||
} else if (isResolvingUri) {
|
} else if (isResolvingUri) {
|
||||||
description = "Loading..."
|
description = "Loading..."
|
||||||
} else {
|
} else {
|
||||||
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">
|
<Link onClick={() => navigate('/show', { uri })} 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-identity">
|
<div className="card__title-primary">
|
||||||
{ !hidePrice ? <span style={{float: "right"}}><FilePrice uri={uri} /></span> : null}
|
{ !this.props.hidePrice
|
||||||
<h5 title={title}><TruncatedText lines={1}>{title}</TruncatedText></h5>
|
? <FilePrice uri={this.props.uri} />
|
||||||
<div className="card__subtitle">
|
: null}
|
||||||
<UriIndicator uri={uri} />
|
<div className="meta">{uri}</div>
|
||||||
</div>
|
<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}>
|
||||||
{description}
|
{isConfirmed
|
||||||
|
? metadata.description
|
||||||
|
: <span className="empty">This file is pending confirmation.</span>}
|
||||||
</TruncatedText>
|
</TruncatedText>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{this.state.showNsfwHelp && this.state.hovered
|
|
||||||
? <div className='card-overlay'>
|
|
||||||
<p>
|
|
||||||
This content is Not Safe For Work.
|
|
||||||
To view adult content, please change your <Link className="button-text" onClick={() => navigate('/settings')} label="Settings" />.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
: null}
|
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
|
{this.state.showNsfwHelp
|
||||||
|
? <div className='card-overlay'>
|
||||||
|
<p>
|
||||||
|
This content is Not Safe For Work.
|
||||||
|
To view adult content, please change your <Link className="button-text" onClick={() => navigate('/settings')} label="Settings" />.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
: null}
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import React from 'react';
|
||||||
import lbryio from 'lbryio.js';
|
import lbryio from 'lbryio.js';
|
||||||
import lbryuri from 'lbryuri'
|
import lbryuri from 'lbryuri'
|
||||||
import FileCard from 'component/fileCard';
|
import FileCard from 'component/fileCard';
|
||||||
|
import {BusyMessage} from 'component/common.js';
|
||||||
import ToolTip from 'component/tooltip.js';
|
import ToolTip from 'component/tooltip.js';
|
||||||
|
|
||||||
const communityCategoryToolTipText = ('Community Content is a public space where anyone can share content with the ' +
|
const communityCategoryToolTipText = ('Community Content is a public space where anyone can share content with the ' +
|
||||||
|
@ -31,7 +32,7 @@ const DiscoverPage = (props) => {
|
||||||
|
|
||||||
let content
|
let content
|
||||||
|
|
||||||
if (fetchingFeaturedUris) content = <div className="empty">Fetching landing content.</div>
|
if (fetchingFeaturedUris) content = <BusyMessage message="Fetching landing 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 => {
|
||||||
|
|
|
@ -66,7 +66,6 @@ const SearchPage = (props) => {
|
||||||
const {
|
const {
|
||||||
query,
|
query,
|
||||||
} = props
|
} = props
|
||||||
// <SearchResults {...props} />
|
|
||||||
return (
|
return (
|
||||||
<main className="main--single-column">
|
<main className="main--single-column">
|
||||||
{ isValidUri(query) ?
|
{ isValidUri(query) ?
|
||||||
|
@ -75,14 +74,14 @@ 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">
|
||||||
Search Results for {query}
|
Search Results for {query}
|
||||||
<ToolTip label="?" body="These search results are provided by LBRY, Inc." className="tooltip--header" />
|
<ToolTip label="?" body="These search results are provided by LBRY, Inc." className="tooltip--header" />
|
||||||
</h3>
|
</h3>
|
||||||
|
<SearchResults {...props} />
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue