mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-01 01:35:11 +00:00
commit
db64a1ea31
12 changed files with 85 additions and 54 deletions
|
@ -49,7 +49,7 @@
|
||||||
"formik": "^0.10.4",
|
"formik": "^0.10.4",
|
||||||
"hast-util-sanitize": "^1.1.2",
|
"hast-util-sanitize": "^1.1.2",
|
||||||
"keytar": "^4.2.1",
|
"keytar": "^4.2.1",
|
||||||
"lbry-redux": "lbryio/lbry-redux#ada4880c5d0758c7973aff9d443a87874d98b320",
|
"lbry-redux": "lbryio/lbry-redux#31f7afa8a37f5741dac01fc1ecdf153f3bed95dc",
|
||||||
"localforage": "^1.7.1",
|
"localforage": "^1.7.1",
|
||||||
"mammoth": "^1.4.6",
|
"mammoth": "^1.4.6",
|
||||||
"mime": "^2.3.1",
|
"mime": "^2.3.1",
|
||||||
|
|
|
@ -36,7 +36,7 @@ class FileListSearch extends React.PureComponent<Props> {
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<div className="search__results">
|
<div className="search__results">
|
||||||
<div className="search-result__row">
|
<div className="search-result__row">
|
||||||
<div className="file-list__header">{__('Content')}</div>
|
<div className="file-list__header">{__('Search Results')}</div>
|
||||||
<HiddenNsfwClaims uris={uris} />
|
<HiddenNsfwClaims uris={uris} />
|
||||||
{!isSearching && fileResults.length ? (
|
{!isSearching && fileResults.length ? (
|
||||||
fileResults.map(uri => <FileTile key={uri} uri={uri} />)
|
fileResults.map(uri => <FileTile key={uri} uri={uri} />)
|
||||||
|
|
|
@ -9,6 +9,7 @@ import Icon from 'component/common/icon';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import FilePrice from 'component/filePrice';
|
import FilePrice from 'component/filePrice';
|
||||||
|
import UriIndicator from 'component/uriIndicator';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
showUri: boolean,
|
showUri: boolean,
|
||||||
|
@ -28,7 +29,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 +37,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 +67,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;
|
||||||
|
@ -89,16 +91,15 @@ class FileTile extends React.PureComponent<Props> {
|
||||||
const onClick = () => navigate('/show', { uri });
|
const onClick = () => navigate('/show', { uri });
|
||||||
|
|
||||||
let name;
|
let name;
|
||||||
let channel;
|
|
||||||
if (claim) {
|
if (claim) {
|
||||||
({ name } = claim);
|
({ name } = claim);
|
||||||
channel = claim.channel_name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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,24 +108,35 @@ 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">
|
||||||
{showUri ? uri : channel || __('Anonymous')}
|
{showUri ? uri : <UriIndicator uri={uri} link />}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="card__file-properties">
|
<div className="card__file-properties">
|
||||||
|
@ -133,8 +145,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}
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { connect } from 'react-redux';
|
||||||
import {
|
import {
|
||||||
selectSearchState as selectSearch,
|
selectSearchState as selectSearch,
|
||||||
selectWunderBarAddress,
|
selectWunderBarAddress,
|
||||||
|
selectSearchSuggestions,
|
||||||
doUpdateSearchQuery,
|
doUpdateSearchQuery,
|
||||||
doFocusSearchInput,
|
doFocusSearchInput,
|
||||||
doBlurSearchInput,
|
doBlurSearchInput,
|
||||||
|
@ -23,6 +24,7 @@ const select = state => {
|
||||||
return {
|
return {
|
||||||
...searchState,
|
...searchState,
|
||||||
wunderbarValue,
|
wunderbarValue,
|
||||||
|
suggestions: selectSearchSuggestions(state),
|
||||||
resultCount: makeSelectClientSetting(settings.RESULT_COUNT)(state),
|
resultCount: makeSelectClientSetting(settings.RESULT_COUNT)(state),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,10 @@ export type Claim = {
|
||||||
valid_at_height: number,
|
valid_at_height: number,
|
||||||
value: ?{
|
value: ?{
|
||||||
publisherSignature: ?{
|
publisherSignature: ?{
|
||||||
certificateId: ?string,
|
certificateId: string,
|
||||||
},
|
},
|
||||||
stream: {
|
stream: {
|
||||||
metadata: ?Metadata,
|
metadata: Metadata,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue