mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-28 16:01:26 +00:00
default to search
This commit is contained in:
parent
10d66aeece
commit
f23bc00af6
9 changed files with 78 additions and 48 deletions
|
@ -28,7 +28,7 @@ type Props = {
|
||||||
hideNoResult: boolean, // don't show the tile if there is no claim at this uri
|
hideNoResult: boolean, // don't show the tile if there is no claim at this uri
|
||||||
displayHiddenMessage?: boolean,
|
displayHiddenMessage?: boolean,
|
||||||
displayDescription?: boolean,
|
displayDescription?: boolean,
|
||||||
small?: boolean,
|
size: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
class FileTile extends React.PureComponent<Props> {
|
class FileTile extends React.PureComponent<Props> {
|
||||||
|
@ -36,6 +36,7 @@ class FileTile extends React.PureComponent<Props> {
|
||||||
showUri: false,
|
showUri: false,
|
||||||
showLocal: false,
|
showLocal: false,
|
||||||
displayDescription: true,
|
displayDescription: true,
|
||||||
|
size: 'regular',
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
@ -65,7 +66,7 @@ class FileTile extends React.PureComponent<Props> {
|
||||||
hideNoResult,
|
hideNoResult,
|
||||||
displayHiddenMessage,
|
displayHiddenMessage,
|
||||||
displayDescription,
|
displayDescription,
|
||||||
small,
|
size,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const shouldHide = !claimIsMine && obscureNsfw && metadata && metadata.nsfw;
|
const shouldHide = !claimIsMine && obscureNsfw && metadata && metadata.nsfw;
|
||||||
|
@ -98,7 +99,8 @@ class FileTile extends React.PureComponent<Props> {
|
||||||
return !name && hideNoResult ? null : (
|
return !name && hideNoResult ? null : (
|
||||||
<section
|
<section
|
||||||
className={classnames('file-tile card--link', {
|
className={classnames('file-tile card--link', {
|
||||||
'file-tile--small': small,
|
'file-tile--small': size === 'small',
|
||||||
|
'file-tile--large': size === 'large',
|
||||||
})}
|
})}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
onKeyUp={onClick}
|
onKeyUp={onClick}
|
||||||
|
@ -107,20 +109,31 @@ class FileTile extends React.PureComponent<Props> {
|
||||||
>
|
>
|
||||||
<CardMedia title={title || name} thumbnail={thumbnail} />
|
<CardMedia title={title || name} thumbnail={thumbnail} />
|
||||||
<div className="file-tile__info">
|
<div className="file-tile__info">
|
||||||
{isResolvingUri && <div className="card__title--small">{__('Loading...')}</div>}
|
{isResolvingUri && (
|
||||||
|
<div
|
||||||
|
className={classnames({
|
||||||
|
'card__title--small': size !== 'large',
|
||||||
|
'card__title--large': size === 'large',
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
{__('Loading...')}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{!isResolvingUri && (
|
{!isResolvingUri && (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<div
|
<div
|
||||||
className={classnames({
|
className={classnames({
|
||||||
'card__title--file': !small,
|
'card__title--file': size === 'regular',
|
||||||
'card__title--x-small': small,
|
'card__title--x-small': size === 'small',
|
||||||
|
'card__title--large': size === 'large',
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<TruncatedText lines={small ? 2 : 3}>{title || name}</TruncatedText>
|
<TruncatedText lines={size === 'small' ? 2 : 3}>{title || name}</TruncatedText>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className={classnames('card__subtitle', {
|
className={classnames('card__subtitle', {
|
||||||
'card__subtitle--x-small': small,
|
'card__subtitle--x-small': size === 'small',
|
||||||
|
'card__subtitle--large': size === 'large',
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<span className="file-tile__channel">
|
<span className="file-tile__channel">
|
||||||
|
@ -133,8 +146,13 @@ class FileTile extends React.PureComponent<Props> {
|
||||||
{showLocal && isDownloaded && <Icon icon={icons.LOCAL} />}
|
{showLocal && isDownloaded && <Icon icon={icons.LOCAL} />}
|
||||||
</div>
|
</div>
|
||||||
{displayDescription && (
|
{displayDescription && (
|
||||||
<div className="card__subtext card__subtext--small">
|
<div
|
||||||
<TruncatedText lines={3}>{description}</TruncatedText>
|
className={classnames('card__subtext', {
|
||||||
|
'card__subtext--small': size !== 'small',
|
||||||
|
'card__subtext--large': size === 'large',
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<TruncatedText lines={size === 'large' ? 4 : 3}>{description}</TruncatedText>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{!name && (
|
{!name && (
|
||||||
|
|
|
@ -10,7 +10,7 @@ type Props = {
|
||||||
search: string => void,
|
search: string => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class RecommendedContent extends React.PureComponent<Props, State> {
|
export default class RecommendedContent extends React.PureComponent<Props> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
@ -37,14 +37,7 @@ export default class RecommendedContent extends React.PureComponent<Props, State
|
||||||
const { claim, search } = this.props;
|
const { claim, search } = this.props;
|
||||||
|
|
||||||
if (claim && claim.value && claim.value.stream && claim.value.stream.metadata) {
|
if (claim && claim.value && claim.value.stream && claim.value.stream.metadata) {
|
||||||
const {
|
const { title } = claim.value.stream.metadata;
|
||||||
value: {
|
|
||||||
stream: {
|
|
||||||
metadata: { title },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} = claim;
|
|
||||||
|
|
||||||
search(title);
|
search(title);
|
||||||
this.didSearch = true;
|
this.didSearch = true;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +55,7 @@ export default class RecommendedContent extends React.PureComponent<Props, State
|
||||||
recommendedContent.length &&
|
recommendedContent.length &&
|
||||||
recommendedContent.map(recommendedUri => (
|
recommendedContent.map(recommendedUri => (
|
||||||
<FileTile
|
<FileTile
|
||||||
small
|
size="small"
|
||||||
hideNoResult
|
hideNoResult
|
||||||
displayDescription={false}
|
displayDescription={false}
|
||||||
key={recommendedUri}
|
key={recommendedUri}
|
||||||
|
|
|
@ -5,10 +5,7 @@ import { isURIValid, normalizeURI } from 'lbry-redux';
|
||||||
import { FormField, FormRow } from 'component/common/form';
|
import { FormField, FormRow } from 'component/common/form';
|
||||||
import FileTile from 'component/fileTile';
|
import FileTile from 'component/fileTile';
|
||||||
import FileListSearch from 'component/fileListSearch';
|
import FileListSearch from 'component/fileListSearch';
|
||||||
import ToolTip from 'component/common/tooltip';
|
|
||||||
import Page from 'component/page';
|
import Page from 'component/page';
|
||||||
import Icon from 'component/common/icon';
|
|
||||||
import * as icons from 'constants/icons';
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
query: ?string,
|
query: ?string,
|
||||||
|
@ -36,8 +33,15 @@ class SearchPage extends React.PureComponent<Props> {
|
||||||
render() {
|
render() {
|
||||||
const { query, resultCount } = this.props;
|
const { query, resultCount } = this.props;
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page noPadding>
|
||||||
<React.Fragment>
|
{query &&
|
||||||
|
isURIValid(query) && (
|
||||||
|
<div className="search__top">
|
||||||
|
<div className="file-list__header">{`lbry://${query}`}</div>
|
||||||
|
<FileTile size="large" displayHiddenMessage uri={normalizeURI(query)} />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="search__content">
|
||||||
<FormRow alignRight>
|
<FormRow alignRight>
|
||||||
<FormField
|
<FormField
|
||||||
type="number"
|
type="number"
|
||||||
|
@ -61,23 +65,9 @@ class SearchPage extends React.PureComponent<Props> {
|
||||||
// />
|
// />
|
||||||
}
|
}
|
||||||
</FormRow>
|
</FormRow>
|
||||||
</React.Fragment>
|
<FileListSearch query={query} />
|
||||||
{isURIValid(query) && (
|
<div className="help">{__('These search results are provided by LBRY, Inc.')}</div>
|
||||||
<React.Fragment>
|
</div>
|
||||||
<div className="file-list__header">
|
|
||||||
{__('Exact URL')}
|
|
||||||
<ToolTip
|
|
||||||
icon
|
|
||||||
body={__('This is the resolution of a LBRY URL and not controlled by LBRY Inc.')}
|
|
||||||
>
|
|
||||||
<Icon icon={icons.HELP} />
|
|
||||||
</ToolTip>
|
|
||||||
</div>
|
|
||||||
<FileTile showUri displayHiddenMessage uri={normalizeURI(query)} />
|
|
||||||
</React.Fragment>
|
|
||||||
)}
|
|
||||||
<FileListSearch query={query} />
|
|
||||||
<div className="help">{__('These search results are provided by LBRY, Inc.')}</div>
|
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,6 +196,7 @@ p {
|
||||||
.main--no-padding {
|
.main--no-padding {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
|
padding-top: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,6 +162,8 @@ $large-breakpoint: 1921px;
|
||||||
--file-tile-media-width: calc(125px * (16 / 9));
|
--file-tile-media-width: calc(125px * (16 / 9));
|
||||||
--file-tile-media-height-small: 60px;
|
--file-tile-media-height-small: 60px;
|
||||||
--file-tile-media-width-small: calc(60px * (16 / 9));
|
--file-tile-media-width-small: calc(60px * (16 / 9));
|
||||||
|
--file-tile-media-height-large: 200px;
|
||||||
|
--file-tile-media-width-large: calc(200px * (16 / 9));
|
||||||
--file-page-min-width: 400px;
|
--file-page-min-width: 400px;
|
||||||
--recommended-content-width: 300px;
|
--recommended-content-width: 300px;
|
||||||
--recommended-content-width-medium: 400px;
|
--recommended-content-width-medium: 400px;
|
||||||
|
|
|
@ -125,6 +125,10 @@
|
||||||
line-height: 12px;
|
line-height: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card__title--large {
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
.card__title--file {
|
.card__title--file {
|
||||||
font-family: 'metropolis-bold';
|
font-family: 'metropolis-bold';
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
|
@ -156,6 +160,11 @@
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card__subtitle--large {
|
||||||
|
font-size: 18px;
|
||||||
|
padding-bottom: $spacing-vertical * 1/3;
|
||||||
|
}
|
||||||
|
|
||||||
.card__subtitle-price {
|
.card__subtitle-price {
|
||||||
padding-top: $spacing-vertical * 1/3;
|
padding-top: $spacing-vertical * 1/3;
|
||||||
}
|
}
|
||||||
|
@ -241,6 +250,10 @@
|
||||||
font-size: calc(var(--font-size-subtext-multiple) * 0.8em);
|
font-size: calc(var(--font-size-subtext-multiple) * 0.8em);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card__subtext--large {
|
||||||
|
font-size: calc(var(--font-size-subtext-multiple) * 0.9em);
|
||||||
|
}
|
||||||
|
|
||||||
.card__actions {
|
.card__actions {
|
||||||
margin-top: $spacing-vertical * 2/3;
|
margin-top: $spacing-vertical * 2/3;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -308,10 +321,6 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding-top: $spacing-vertical;
|
padding-top: $spacing-vertical;
|
||||||
|
|
||||||
&:first-of-type {
|
|
||||||
padding-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:last-of-type {
|
&:last-of-type {
|
||||||
padding-bottom: $spacing-vertical * 2/3;
|
padding-bottom: $spacing-vertical * 2/3;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.file-list__header {
|
.file-list__header {
|
||||||
margin-top: $spacing-vertical * 4/3;
|
padding-top: $spacing-vertical * 4/3;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
|
|
||||||
.tooltip {
|
.tooltip {
|
||||||
|
@ -49,6 +49,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.file-tile.file-tile--large {
|
||||||
|
.card__media {
|
||||||
|
height: var(--file-tile-media-height-large);
|
||||||
|
flex: 0 0 var(--file-tile-media-width-large);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.file-tile__info {
|
.file-tile__info {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
|
@ -85,7 +85,17 @@
|
||||||
background-color: var(--color-secondary);
|
background-color: var(--color-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.search__top {
|
||||||
|
padding: 0 $spacing-width $spacing-width;
|
||||||
|
background-color: var(--card-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.search__content {
|
||||||
|
padding: $spacing-width;
|
||||||
|
}
|
||||||
|
|
||||||
.search__results {
|
.search__results {
|
||||||
|
margin-top: -$spacing-width;
|
||||||
padding-bottom: $spacing-vertical;
|
padding-bottom: $spacing-vertical;
|
||||||
flex-flow: wrap column;
|
flex-flow: wrap column;
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ export type Claim = {
|
||||||
certificateId: ?string,
|
certificateId: ?string,
|
||||||
},
|
},
|
||||||
stream: {
|
stream: {
|
||||||
metadata: ?Metadata,
|
metadata: Metadata,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue