my_files fixes

This commit is contained in:
Jeremy Kauffman 2017-01-13 12:13:46 -05:00 committed by Alex Liebowitz
parent b70b2a859d
commit 3b7d093201
6 changed files with 15 additions and 27 deletions

View file

@ -4,7 +4,7 @@ import SettingsPage from './page/settings.js';
import HelpPage from './page/help.js';
import WatchPage from './page/watch.js';
import ReportPage from './page/report.js';
import MyFilesPage from './page/my_files.js';
import {MyFilesPage} from './page/my_files.js';
import StartPage from './page/start.js';
import ClaimCodePage from './page/claim_code.js';
import ReferralPage from './page/referral.js';

View file

@ -178,7 +178,7 @@ export let FileActions = React.createClass({
}
const openInFolderMessage = window.navigator.platform.startsWith('Mac') ? 'Open in Finder' : 'Open in Folder',
showMenu = !this.state.attemptingRemove && this.state.fileInfo !== null;
let linkBlock;
if (this.state.attemptingRemove || (this.state.fileInfo === false && !this.state.attemptingDownload)) {
linkBlock = <Link button="text" label="Download" icon="icon-download" onClick={this.onDownloadClick} />;

View file

@ -50,27 +50,25 @@ let FilePrice = React.createClass({
});
/*should be merged into FileTile once FileTile is refactored to take a single id*/
let FileTileStream = React.createClass({
export let FileTileStream = React.createClass({
propTypes: {
metadata: React.PropTypes.object,
sdHash: React.PropTypes.string,
showPrice: React.PropTypes.bool,
hidePrice: React.PropTypes.bool,
obscureNsfw: React.PropTypes.bool,
hideOnRemove: React.PropTypes.bool
},
getInitialState: function() {
return {
showNsfwHelp: false,
isRemoved: false
}
},
getDefaultProps: function() {
return {
hideOnRemove: false,
obscureNsfw: !lbry.getClientSetting('showNsfw'),
showPrice: true
hidePrice: false
}
},
handleMouseOver: function() {
@ -100,7 +98,6 @@ let FileTileStream = React.createClass({
const metadata = this.props.metadata || {},
obscureNsfw = this.props.obscureNsfw && metadata.nsfw,
title = metadata.title ? metadata.title : ('lbry://' + this.props.name);
return (
<section className={ 'file-tile card ' + (obscureNsfw ? 'card-obscured ' : '') } onMouseEnter={this.handleMouseOver} onMouseLeave={this.handleMouseOut}>
<div className="row-fluid card-content file-tile__row">
@ -108,7 +105,7 @@ let FileTileStream = React.createClass({
<a href={'/?show=' + this.props.name}><Thumbnail className="file-tile__thumbnail" src={metadata.thumbnail} alt={'Photo for ' + (title || this.props.name)} /></a>
</div>
<div className="span9">
{ this.props.showPrice
{ !this.props.hidePrice
? <FilePrice name={this.props.name} />
: null}
<div className="meta"><a href={'/?show=' + this.props.name}>lbry://{this.props.name}</a></div>
@ -140,7 +137,7 @@ let FileTileStream = React.createClass({
}
});
let FileTile = React.createClass({
export let FileTile = React.createClass({
_isMounted: false,
propTypes: {
@ -176,6 +173,4 @@ let FileTile = React.createClass({
return <FileTileStream name={this.props.name} sdHash={this.state.sdHash} metadata={this.state.metadata} />;
}
});
export default FileTile;
});

View file

@ -1,7 +1,7 @@
import React from 'react';
import lbry from '../lbry.js';
import lighthouse from '../lighthouse.js';
import FileTile from '../component/file-tile.js';
import {FileTile} from '../component/file-tile.js';
import {Link, ToolTipLink} from '../component/link.js';
import {BusyMessage} from '../component/common.js';

View file

@ -2,11 +2,10 @@ import React from 'react';
import lbry from '../lbry.js';
import {Link} from '../component/link.js';
import FormField from '../component/form.js';
import FileTile from '../component/file-tile.js';
import Modal from '../component/modal.js';
import {FileTileStream} from '../component/file-tile.js';
import {BusyMessage, Thumbnail} from '../component/common.js';
var MyFilesPage = React.createClass({
export let MyFilesPage = React.createClass({
_fileTimeout: null,
_fileInfoCheckRate: 300,
_fileInfoCheckNum: 0,
@ -170,17 +169,14 @@ var MyFilesPage = React.createClass({
const filesInfoSorted = this._sortFunctions[this.state.sortBy](this.state.filesInfo);
for (let fileInfo of filesInfoSorted) {
let {completed, lbry_uri, sd_hash, metadata, download_path, stopped, pending} = fileInfo;
let {lbry_uri, sd_hash, metadata} = fileInfo;
if (!metadata || seenUris[lbry_uri]) {
continue;
}
seenUris[lbry_uri] = true;
content.push(<FileTile name={lbry_uri} sdHash={sd_hash} isMine={this.props.show == 'published'} showPrice={false} hideOnRemove={true}
metadata={metadata} completed={completed} stopped={stopped} pending={pending} path={download_path}
{... this.state.filesAvailable !== null ? {available: this.state.filesAvailable[sd_hash]} : {}} />);
content.push(<FileTileStream name={lbry_uri} sdHash={sd_hash} hideOnRemove={true} hidePrice={true} metadata={metadata} />);
}
}
return (
@ -197,6 +193,4 @@ var MyFilesPage = React.createClass({
</main>
);
}
});
export default MyFilesPage;
});

View file

@ -91,8 +91,7 @@ var PublishPage = React.createClass({
if (this.refs.file.getValue() !== '') {
publishArgs.file_path = this._tempFilePath;
}
console.log(publishArgs);
lbry.publish(publishArgs, (message) => {
this.handlePublishStarted();
}, null, (error) => {