more progress but probably more breakage

This commit is contained in:
Jeremy Kauffman 2017-09-15 09:56:32 -04:00
parent 13d61651c9
commit e119533973
10 changed files with 63 additions and 76 deletions

View file

@ -14,14 +14,12 @@ import FileActions from "./view";
const select = (state, props) => ({ const select = (state, props) => ({
fileInfo: makeSelectFileInfoForUri(props.uri)(state), fileInfo: makeSelectFileInfoForUri(props.uri)(state),
/*availability check is disabled due to poor performance, TBD if it dies forever or requires daemon fix*/ /*availability check is disabled due to poor performance, TBD if it dies forever or requires daemon fix*/
platform: selectPlatform(state),
costInfo: makeSelectCostInfoForUri(props.uri)(state), costInfo: makeSelectCostInfoForUri(props.uri)(state),
claimIsMine: makeSelectClaimIsMine(props.uri)(state), claimIsMine: makeSelectClaimIsMine(props.uri)(state),
}); });
const perform = dispatch => ({ const perform = dispatch => ({
checkAvailability: uri => dispatch(doFetchAvailability(uri)), checkAvailability: uri => dispatch(doFetchAvailability(uri)),
openInFolder: fileInfo => dispatch(doOpenFileInFolder(fileInfo)),
openInShell: fileInfo => dispatch(doOpenFileInShell(fileInfo)), openInShell: fileInfo => dispatch(doOpenFileInShell(fileInfo)),
openModal: (modal, props) => dispatch(doOpenModal(modal, props)), openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
startDownload: uri => dispatch(doPurchaseUri(uri)), startDownload: uri => dispatch(doPurchaseUri(uri)),

View file

@ -1,7 +1,6 @@
import React from "react"; import React from "react";
import Link from "component/link"; import Link from "component/link";
import FileDownloadLink from "component/fileDownloadLink"; import FileDownloadLink from "component/fileDownloadLink";
import { DropDownMenu, DropDownMenuItem } from "component/menu";
import * as modals from "constants/modal_types"; import * as modals from "constants/modal_types";
class FileActions extends React.PureComponent { class FileActions extends React.PureComponent {
@ -10,58 +9,38 @@ class FileActions extends React.PureComponent {
} }
render() { render() {
const { const { fileInfo, uri, openModal, claimIsMine, editClaim } = this.props;
fileInfo,
platform,
uri,
openInFolder,
openModal,
claimIsMine,
editClaim,
} = this.props;
const name = fileInfo ? fileInfo.name : null; const name = fileInfo ? fileInfo.name : null;
const channel = fileInfo ? fileInfo.channel_name : null; const channel = fileInfo ? fileInfo.channel_name : null;
const metadata = fileInfo ? fileInfo.metadata : null, const metadata = fileInfo ? fileInfo.metadata : null,
openInFolderMessage = platform.startsWith("Mac")
? __("Open in Finder")
: __("Open in Folder"),
showMenu = fileInfo && Object.keys(fileInfo).length > 0, showMenu = fileInfo && Object.keys(fileInfo).length > 0,
title = metadata ? metadata.title : uri; title = metadata ? metadata.title : uri;
return ( return (
<section className="file-actions"> <section className="card__actions">
{claimIsMine &&
<Link
button="text"
icon="icon-edit"
label={__("Edit")}
onClick={() => editClaim({ name, channel })}
/>}
<FileDownloadLink uri={uri} /> <FileDownloadLink uri={uri} />
<Link <Link
label={__("Support")}
button="text" button="text"
icon="icon-gift" icon="icon-gift"
label={__("Support")}
onClick={this.handleSupportButtonClicked.bind(this)} onClick={this.handleSupportButtonClicked.bind(this)}
/> />
{showMenu <Link
? <div className="button-set-item"> button="text"
<DropDownMenu> icon="icon-trash"
<DropDownMenuItem label={__("Remove")}
key={0} className="card__action--right"
onClick={() => openInFolder(fileInfo)} onClick={() => openModal(modals.CONFIRM_FILE_REMOVE, { uri })}
label={openInFolderMessage} />
/>
{claimIsMine &&
<DropDownMenuItem
key={1}
onClick={() => editClaim({ name, channel })}
label={__("Edit claim")}
/>}
<DropDownMenuItem
key={2}
onClick={() => openModal(modals.CONFIRM_FILE_REMOVE, { uri })}
label={__("Remove...")}
/>
</DropDownMenu>
</div>
: ""}
</section> </section>
); );
} }

View file

@ -61,9 +61,9 @@ class FileDownloadLink extends React.PureComponent {
); );
return ( return (
<div className="faux-button-block file-actions__download-status-bar button-set-item"> <div className="faux-button-block file-download button-set-item">
<div <div
className="faux-button-block file-actions__download-status-bar-overlay" className="faux-button-block file-download__overlay"
style={{ width: progress + "%" }} style={{ width: progress + "%" }}
> >
{labelWithIcon} {labelWithIcon}

View file

@ -88,6 +88,7 @@ class FileList extends React.PureComponent {
key={fileInfo.outpoint || fileInfo.claim_id} key={fileInfo.outpoint || fileInfo.claim_id}
uri={uri} uri={uri}
hidePrice={true} hidePrice={true}
showActions={true}
showEmpty={this.props.fileTileShowEmpty} showEmpty={this.props.fileTileShowEmpty}
/> />
); );

View file

@ -1,6 +1,7 @@
import React from "react"; import React from "react";
import lbryuri from "lbryuri.js"; import lbryuri from "lbryuri.js";
import CardMedia from "component/cardMedia"; import CardMedia from "component/cardMedia";
import FileActions from "component/fileActions";
import Link from "component/link"; import Link from "component/link";
import { TruncatedText } from "component/common.js"; import { TruncatedText } from "component/common.js";
import FilePrice from "component/filePrice"; import FilePrice from "component/filePrice";
@ -53,6 +54,7 @@ class FileTile extends React.PureComponent {
render() { render() {
const { const {
claim, claim,
showActions,
metadata, metadata,
isResolvingUri, isResolvingUri,
showEmpty, showEmpty,
@ -104,7 +106,7 @@ class FileTile extends React.PureComponent {
onMouseEnter={this.handleMouseOver.bind(this)} onMouseEnter={this.handleMouseOver.bind(this)}
onMouseLeave={this.handleMouseOut.bind(this)} onMouseLeave={this.handleMouseOut.bind(this)}
> >
<Link onClick={onClick} className="card__link"> <div onClick={onClick} className="card__link">
<div className={"card__inner file-tile__row"}> <div className={"card__inner file-tile__row"}>
<CardMedia title={title} thumbnail={thumbnail} /> <CardMedia title={title} thumbnail={thumbnail} />
<div className="file-tile__content"> <div className="file-tile__content">
@ -116,14 +118,15 @@ class FileTile extends React.PureComponent {
<TruncatedText lines={1}>{title}</TruncatedText> <TruncatedText lines={1}>{title}</TruncatedText>
</h3> </h3>
</div> </div>
<div className="card__content card__subtext"> {description &&
<TruncatedText lines={3}> <div className="card__content card__subtext">
{description} <TruncatedText lines={!showActions ? 4 : 2}>
</TruncatedText> {description}
</div> </TruncatedText>
</div>}
</div> </div>
</div> </div>
</Link> </div>
{this.state.showNsfwHelp && <NsfwOverlay />} {this.state.showNsfwHelp && <NsfwOverlay />}
</section> </section>
); );

View file

@ -47,15 +47,16 @@ class VideoPlayButton extends React.PureComponent {
? "icon-play" ? "icon-play"
: "icon-folder-o"; : "icon-folder-o";
return; return (
<Link <Link
button={button ? button : null} button={button ? button : null}
disabled={disabled} disabled={disabled}
label={label ? label : ""} label={label ? label : ""}
className="video__play-button" className="video__play-button"
icon={icon} icon={icon}
onClick={this.onWatchClick.bind(this)} onClick={this.onWatchClick.bind(this)}
/>; />
);
} }
} }

View file

@ -23,7 +23,7 @@ const FormatItem = props => {
const mediaType = lbry.getMediaType(contentType); const mediaType = lbry.getMediaType(contentType);
return ( return (
<table className="table-standard"> <table className="table-standard table-stretch">
<tbody> <tbody>
<tr> <tr>
<td>{__("Published on")}</td><td><DateTime block={height} /></td> <td>{__("Published on")}</td><td><DateTime block={height} /></td>
@ -156,12 +156,10 @@ class FilePage extends React.PureComponent {
</Link> </Link>
: uriIndicator} : uriIndicator}
</div> </div>
<div className="card__actions"> <FileActions
<FileActions uri={uri}
uri={uri} onTipShow={this.handleTipShow.bind(this)}
onTipShow={this.handleTipShow.bind(this)} />
/>
</div>
</div> </div>
{!showTipBox && {!showTipBox &&
<div className="card__content card__subtext card__subtext card__subtext--allow-newlines"> <div className="card__content card__subtext card__subtext card__subtext--allow-newlines">

View file

@ -6,7 +6,7 @@
@import "component/_table"; @import "component/_table";
@import "component/_button.scss"; @import "component/_button.scss";
@import "component/_card.scss"; @import "component/_card.scss";
@import "component/_file-actions.scss"; @import "component/_file-download.scss";
@import "component/_file-selector.scss"; @import "component/_file-selector.scss";
@import "component/_file-tile.scss"; @import "component/_file-tile.scss";
@import "component/_form-field.scss"; @import "component/_form-field.scss";

View file

@ -51,6 +51,9 @@
margin-top: $spacing-vertical; margin-top: $spacing-vertical;
margin-bottom: var(--card-margin); margin-bottom: var(--card-margin);
} }
.card__action--right {
float: right;
}
.card__content { .card__content {
margin-top: var(--card-margin); margin-top: var(--card-margin);
margin-bottom: var(--card-margin); margin-bottom: var(--card-margin);
@ -84,6 +87,7 @@ $font-size-subtext-multiple: 0.82;
.card__link { .card__link {
display: block; display: block;
cursor: pointer;
} }
.card--link { .card--link {
transition: transform 120ms ease-in-out; transition: transform 120ms ease-in-out;

View file

@ -1,22 +1,15 @@
.file-download, .file-download__overlay {
.file-actions
{
line-height: var(--button-height);
min-height: var(--button-height);
}
.file-actions__download-status-bar, .file-actions__download-status-bar-overlay {
.button__content { .button__content {
margin: 0 var(--text-link-padding); margin: 0 var(--text-link-padding);
} }
} }
.file-actions__download-status-bar .file-download
{ {
position: relative; position: relative;
color: var(--color-download); color: var(--color-download);
} }
.file-actions__download-status-bar-overlay .file-download__overlay
{ {
background: var(--color-download); background: var(--color-download);
color: white; color: white;
@ -27,3 +20,13 @@
top: 0px; top: 0px;
left: 0px; left: 0px;
} }
/*
.file-actions
{
line-height: var(--button-height);
min-height: var(--button-height);
}
*/