mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-23 17:47:24 +00:00
add FileProperties to ClaimPreviewTile
This commit is contained in:
parent
16d52b1231
commit
cf3be2e8b7
7 changed files with 53 additions and 52 deletions
|
@ -11,8 +11,7 @@ import SubscribeButton from 'component/subscribeButton';
|
||||||
import useGetThumbnail from 'effects/use-get-thumbnail';
|
import useGetThumbnail from 'effects/use-get-thumbnail';
|
||||||
import { formatLbryUrlForWeb } from 'util/url';
|
import { formatLbryUrlForWeb } from 'util/url';
|
||||||
import { parseURI } from 'lbry-redux';
|
import { parseURI } from 'lbry-redux';
|
||||||
import VideoDuration from 'component/videoDuration';
|
import FileProperties from 'component/fileProperties';
|
||||||
import FileType from 'component/fileType';
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
uri: string,
|
uri: string,
|
||||||
|
@ -149,19 +148,15 @@ function ClaimPreviewTile(props: Props) {
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<NavLink {...navLinkProps}>
|
<NavLink {...navLinkProps}>
|
||||||
<FileThumbnail thumbnail={thumbnailUrl}>
|
<FileThumbnail thumbnail={thumbnailUrl} />
|
||||||
{!isChannel && (
|
|
||||||
<div className="claim-tile__absolute-info">
|
|
||||||
<VideoDuration uri={uri} className="claim-tile__video-length" />
|
|
||||||
<FileType uri={uri} />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</FileThumbnail>
|
|
||||||
</NavLink>
|
</NavLink>
|
||||||
<NavLink {...navLinkProps}>
|
<NavLink {...navLinkProps}>
|
||||||
<h2 className="claim-tile__title">
|
<div className="claim-tile__title-and-properties">
|
||||||
<TruncatedText text={title || (claim && claim.name)} lines={2} />
|
<h2 className="claim-tile__title">
|
||||||
</h2>
|
<TruncatedText text={title || (claim && claim.name)} lines={2} />
|
||||||
|
</h2>
|
||||||
|
{!isChannel && <FileProperties uri={uri} small />}
|
||||||
|
</div>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
<div className="claim-tile__info">
|
<div className="claim-tile__info">
|
||||||
{isChannel ? (
|
{isChannel ? (
|
||||||
|
@ -175,7 +170,7 @@ function ClaimPreviewTile(props: Props) {
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<UriIndicator uri={uri} link>
|
<UriIndicator uri={uri} link hideAnonymous>
|
||||||
<ChannelThumbnail thumbnailPreview={channelThumbnail} />
|
<ChannelThumbnail thumbnailPreview={channelThumbnail} />
|
||||||
</UriIndicator>
|
</UriIndicator>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as icons from 'constants/icons';
|
import * as icons from 'constants/icons';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import classnames from 'classnames';
|
||||||
import Icon from 'component/common/icon';
|
import Icon from 'component/common/icon';
|
||||||
import FilePrice from 'component/filePrice';
|
import FilePrice from 'component/filePrice';
|
||||||
import VideoDuration from 'component/videoDuration';
|
import VideoDuration from 'component/videoDuration';
|
||||||
|
@ -12,13 +13,14 @@ type Props = {
|
||||||
claimIsMine: boolean,
|
claimIsMine: boolean,
|
||||||
isSubscribed: boolean,
|
isSubscribed: boolean,
|
||||||
isNew: boolean,
|
isNew: boolean,
|
||||||
|
small: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function FileProperties(props: Props) {
|
export default function FileProperties(props: Props) {
|
||||||
const { uri, downloaded, claimIsMine, isSubscribed } = props;
|
const { uri, downloaded, claimIsMine, isSubscribed, small = false } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="file-properties">
|
<div className={classnames('file-properties', { 'file-properties--small': small })}>
|
||||||
{isSubscribed && <Icon tooltip icon={icons.SUBSCRIBE} />}
|
{isSubscribed && <Icon tooltip icon={icons.SUBSCRIBE} />}
|
||||||
{!claimIsMine && downloaded && <Icon tooltip icon={icons.DOWNLOAD} />}
|
{!claimIsMine && downloaded && <Icon tooltip icon={icons.DOWNLOAD} />}
|
||||||
<FilePrice hideFree uri={uri} />
|
<FilePrice hideFree uri={uri} />
|
||||||
|
|
|
@ -1,19 +1,17 @@
|
||||||
// @flow
|
// @flow
|
||||||
import type { Node } from 'react';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
// import FreezeframeWrapper from './FreezeframeWrapper';
|
// import FreezeframeWrapper from './FreezeframeWrapper';
|
||||||
import Placeholder from './placeholder.png';
|
import Placeholder from './placeholder.png';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
thumbnail: ?string, // externally sourced image
|
thumbnail: ?string, // externally sourced image
|
||||||
children?: Node,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const className = 'media__thumb';
|
const className = 'media__thumb';
|
||||||
|
|
||||||
class CardMedia extends React.PureComponent<Props> {
|
class CardMedia extends React.PureComponent<Props> {
|
||||||
render() {
|
render() {
|
||||||
const { thumbnail, children } = this.props;
|
const { thumbnail } = this.props;
|
||||||
|
|
||||||
// Disabling temporarily to see if people complain
|
// Disabling temporarily to see if people complain
|
||||||
// if (thumbnail && thumbnail.endsWith('gif')) {
|
// if (thumbnail && thumbnail.endsWith('gif')) {
|
||||||
|
@ -34,11 +32,7 @@ class CardMedia extends React.PureComponent<Props> {
|
||||||
url = thumbnail || Placeholder;
|
url = thumbnail || Placeholder;
|
||||||
// @endif
|
// @endif
|
||||||
|
|
||||||
return (
|
return <div style={{ backgroundImage: `url('${url.replace(/'/g, "\\'")}')` }} className={className} />;
|
||||||
<div style={{ backgroundImage: `url('${url.replace(/'/g, "\\'")}')` }} className={className}>
|
|
||||||
{children}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ type Props = {
|
||||||
link: ?boolean,
|
link: ?boolean,
|
||||||
claim: ?Claim,
|
claim: ?Claim,
|
||||||
addTooltip: boolean,
|
addTooltip: boolean,
|
||||||
|
hideAnonymous: boolean,
|
||||||
// Lint thinks we aren't using these, even though we are.
|
// Lint thinks we aren't using these, even though we are.
|
||||||
// Possibly because the resolve function is an arrow function that is passed in props?
|
// Possibly because the resolve function is an arrow function that is passed in props?
|
||||||
resolveUri: string => void,
|
resolveUri: string => void,
|
||||||
|
@ -43,7 +44,7 @@ class UriIndicator extends React.PureComponent<Props> {
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { link, isResolvingUri, claim, addTooltip, children, inline } = this.props;
|
const { link, isResolvingUri, claim, addTooltip, children, inline, hideAnonymous = false } = this.props;
|
||||||
|
|
||||||
if (!claim) {
|
if (!claim) {
|
||||||
return <span className="empty">{isResolvingUri ? 'Validating...' : 'Unused'}</span>;
|
return <span className="empty">{isResolvingUri ? 'Validating...' : 'Unused'}</span>;
|
||||||
|
@ -52,6 +53,10 @@ class UriIndicator extends React.PureComponent<Props> {
|
||||||
const isChannelClaim = claim.value_type === 'channel';
|
const isChannelClaim = claim.value_type === 'channel';
|
||||||
|
|
||||||
if (!claim.signing_channel && !isChannelClaim) {
|
if (!claim.signing_channel && !isChannelClaim) {
|
||||||
|
if (hideAnonymous) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return <span className={classnames('channel-name', { 'channel-name--inline': inline })}>Anonymous</span>;
|
return <span className={classnames('channel-name', { 'channel-name--inline': inline })}>Anonymous</span>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -288,9 +288,11 @@
|
||||||
margin-left: var(--spacing-medium);
|
margin-left: var(--spacing-medium);
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
|
||||||
&:first-child,
|
@media (min-width: $breakpoint-medium) {
|
||||||
&:nth-child(5n) {
|
&:first-child,
|
||||||
margin-left: 0;
|
&:nth-child(5n) {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
@ -303,6 +305,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: $breakpoint-medium) {
|
@media (max-width: $breakpoint-medium) {
|
||||||
|
width: calc((100% - var(--spacing-medium) * 2) / 3);
|
||||||
|
|
||||||
|
&:first-child,
|
||||||
|
&:nth-child(3n + 1) {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.channel-thumbnail {
|
.channel-thumbnail {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
@ -312,19 +321,24 @@
|
||||||
width: calc((100% - var(--spacing-medium) * 1) / 2);
|
width: calc((100% - var(--spacing-medium) * 1) / 2);
|
||||||
margin-bottom: var(--spacing-large);
|
margin-bottom: var(--spacing-large);
|
||||||
|
|
||||||
.channel-thumbnail {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:first-child,
|
&:first-child,
|
||||||
&:nth-child(2n + 1) {
|
&:nth-child(2n + 1) {
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.channel-thumbnail {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.claim-preview--channel {
|
||||||
|
.media__thumb {
|
||||||
|
padding-top: 10%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.claim-tile__title {
|
.claim-tile__title {
|
||||||
margin: var(--spacing-small);
|
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: var(--font-small);
|
font-size: var(--font-small);
|
||||||
|
@ -357,7 +371,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.claim-tile__publishes {
|
.claim-tile__publishes {
|
||||||
font-size: var(--font-small);
|
font-size: var(--font-xsmall);
|
||||||
}
|
}
|
||||||
|
|
||||||
.claim-tile__about--channel {
|
.claim-tile__about--channel {
|
||||||
|
@ -370,21 +384,9 @@
|
||||||
font-size: var(--font-body);
|
font-size: var(--font-body);
|
||||||
}
|
}
|
||||||
|
|
||||||
.claim-tile__absolute-info {
|
.claim-tile__title-and-properties {
|
||||||
position: absolute;
|
|
||||||
bottom: var(--spacing-small);
|
|
||||||
right: var(--spacing-small);
|
|
||||||
font-size: var(--font-xsmall);
|
|
||||||
padding: 0.2rem;
|
|
||||||
border-radius: var(--border-radius);
|
|
||||||
font-weight: bold;
|
|
||||||
background-color: black;
|
|
||||||
color: white;
|
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: flex-start;
|
||||||
}
|
justify-content: space-between;
|
||||||
|
margin: var(--spacing-small);
|
||||||
.claim-tile__video-length {
|
|
||||||
margin-right: var(--spacing-xsmall);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: var(--font-small);
|
font-size: var(--font-small);
|
||||||
color: var(--color-text-help);
|
color: var(--color-text-help);
|
||||||
margin-left: var(--spacing-small);
|
margin-left: var(--spacing-xsmall);
|
||||||
|
|
||||||
& > *:not(:last-child) {
|
& > *:not(:last-child) {
|
||||||
margin-right: var(--spacing-small);
|
margin-right: var(--spacing-small);
|
||||||
|
@ -15,6 +15,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.file-properties--small {
|
||||||
|
font-size: var(--font-xsmall);
|
||||||
|
}
|
||||||
|
|
||||||
.file-properties--large {
|
.file-properties--large {
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
margin-bottom: var(--spacing-large);
|
margin-bottom: var(--spacing-large);
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
.media__thumb {
|
.media__thumb {
|
||||||
@include thumbnail;
|
@include thumbnail;
|
||||||
position: relative;
|
|
||||||
border-radius: var(--card-radius);
|
border-radius: var(--card-radius);
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
background-color: var(--color-placeholder-background);
|
background-color: var(--color-placeholder-background);
|
||||||
|
|
Loading…
Add table
Reference in a new issue