diff --git a/package.json b/package.json index 5a6e0741a..dfae48926 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "formik": "^0.10.4", "hast-util-sanitize": "^1.1.2", "keytar": "^4.2.1", - "lbry-redux": "lbryio/lbry-redux#83fec2a8419cbf0f1fafdc98a50dab3051191ef5", + "lbry-redux": "lbryio/lbry-redux#8794a775bf71e7b8b7d1ac44392196bb58a0042a", "localforage": "^1.7.1", "mammoth": "^1.4.6", "mime": "^2.3.1", diff --git a/src/renderer/component/fileCard/view.jsx b/src/renderer/component/fileCard/view.jsx index f63e23d13..07f896b11 100644 --- a/src/renderer/component/fileCard/view.jsx +++ b/src/renderer/component/fileCard/view.jsx @@ -97,17 +97,13 @@ class FileCard extends React.PureComponent { {title}
- {pending ? ( -
Pending...
- ) : ( - - - {isRewardContent && } - {fileInfo && } - - )} + {pending ?
Pending...
: } +
+
+ {showPrice && } + {isRewardContent && } + {fileInfo && }
- {showPrice && } ); diff --git a/src/renderer/component/fileTile/view.jsx b/src/renderer/component/fileTile/view.jsx index 2535eb886..557c1c678 100644 --- a/src/renderer/component/fileTile/view.jsx +++ b/src/renderer/component/fileTile/view.jsx @@ -116,7 +116,7 @@ class FileTile extends React.PureComponent { 'card__title--x-small': small, })} > - {title || name} + {title || name}
({ - claimsInChannel: makeSelectClaimsInChannelForCurrentPage(props.channelUri)(state), + claim: makeSelectClaimForUri(props.uri)(state), + recommendedContent: makeSelectRecommendedContentForUri(props.uri)(state), autoplay: makeSelectClientSetting(settings.AUTOPLAY)(state), }); const perform = dispatch => ({ - fetchClaims: (uri, page) => dispatch(doFetchClaimsByChannel(uri, page)), setAutoplay: value => dispatch(doSetClientSetting(settings.AUTOPLAY, value)), + search: query => dispatch(doSearch(query, 20)), }); export default connect( diff --git a/src/renderer/component/recommendedContent/view.jsx b/src/renderer/component/recommendedContent/view.jsx index df2ac55e6..12b7107a1 100644 --- a/src/renderer/component/recommendedContent/view.jsx +++ b/src/renderer/component/recommendedContent/view.jsx @@ -4,47 +4,65 @@ import FileTile from 'component/fileTile'; import { FormRow, FormField } from 'component/common/form'; import ToolTip from 'component/common/tooltip'; import type { Claim } from 'types/claim'; -import { buildURI, parseURI } from 'lbry-redux'; type Props = { uri: string, - channelUri: ?string, - claimsInChannel: ?Array, + claim: ?Claim, autoplay: boolean, + recommendedContent: Array, + search: string => void, setAutoplay: boolean => void, - fetchClaims: (string, number) => void, }; -export default class RecommendedContent extends React.PureComponent { +type State = { + didSearch: boolean, +}; + +export default class RecommendedContent extends React.PureComponent { + constructor() { + super(); + + this.state = { + didSearch: false, + }; + } + componentDidMount() { - const { channelUri, fetchClaims, claimsInChannel } = this.props; - if (channelUri && !claimsInChannel) { - fetchClaims(channelUri, 1); + this.getRecommendedContent(); + } + + componentDidUpdate(prevProps: Props) { + const { claim, uri } = this.props; + const { didSearch } = this.state; + + if (uri !== prevProps.uri) { + this.setState({ didSearch: false }); + } + + if (claim && !didSearch) { + this.getRecommendedContent(); + } + } + + getRecommendedContent() { + const { claim, search } = this.props; + + if (claim && claim.value && claim.value.stream && claim.value.stream.metadata) { + const { + value: { + stream: { + metadata: { title }, + }, + }, + } = claim; + // console.log("search", title) + search(title); + this.setState({ didSearch: true }); } } render() { - const { claimsInChannel, autoplay, uri, setAutoplay } = this.props; - - let recommendedContent; - if (claimsInChannel) { - recommendedContent = claimsInChannel.filter(claim => { - const { name, claim_id: claimId, channel_name: channelName, value } = claim; - const { isChannel } = parseURI(uri); - - // The uri may include the channel name - const recommendedUri = - isChannel && value && value.publisherSignature - ? buildURI({ - contentName: name, - claimName: channelName, - claimId: value.publisherSignature.certificateId, - }) - : buildURI({ claimName: name, claimId }); - - return recommendedUri !== uri; - }); - } + const { autoplay, setAutoplay, recommendedContent } = this.props; return (
@@ -62,12 +80,14 @@ export default class RecommendedContent extends React.PureComponent { {recommendedContent && - recommendedContent.map(({ permanent_url: permanentUrl }) => ( + recommendedContent.length && + recommendedContent.map(recommendedUri => ( ))}
diff --git a/src/renderer/page/file/view.jsx b/src/renderer/page/file/view.jsx index b70e69461..9dfab3fe2 100644 --- a/src/renderer/page/file/view.jsx +++ b/src/renderer/page/file/view.jsx @@ -218,7 +218,7 @@ class FilePage extends React.Component {
- + ); } diff --git a/src/renderer/scss/_gui.scss b/src/renderer/scss/_gui.scss index cae904513..226d547e0 100644 --- a/src/renderer/scss/_gui.scss +++ b/src/renderer/scss/_gui.scss @@ -274,7 +274,7 @@ p { } .credit-amount--free { - color: var(--color-secondary); + color: var(--color-credit-free); &.credit-amount--file-page { color: var(--color-dark-blue); @@ -283,7 +283,7 @@ p { } .credit-amount--cost { - color: var(--color-yellow); + color: var(--color-credit-price); &.credit-amount--file-page { color: var(--color-black); diff --git a/src/renderer/scss/_vars.scss b/src/renderer/scss/_vars.scss index ac80156c0..a9e8141cb 100644 --- a/src/renderer/scss/_vars.scss +++ b/src/renderer/scss/_vars.scss @@ -9,7 +9,7 @@ $large-breakpoint: 1921px; :root { /* Widths & spacings */ - --side-nav-width: 190px; + --side-nav-width: 160px; --side-nav-width-m: 240px; --side-nav-width-l: 320px; --font-size-subtext-multiple: 0.92; @@ -31,7 +31,7 @@ $large-breakpoint: 1921px; --color-dark-blue: #2f6f61; --color-light-blue: #49b2e2; --color-red: #e2495e; - --color-yellow: #fbd55e; + --color-yellow: #e8b414; --color-green: #399483; --color-green-light: #effbe4; --color-green-blue: #2ec1a8; @@ -49,6 +49,8 @@ $large-breakpoint: 1921px; --color-bg-alt: var(--color-grey-light); --color-placeholder: var(--color-grey); --color-search-placeholder: var(--color-placeholder); + --color-credit-free: var(--color-dark-blue); + --color-credit-price: var(--color-yellow); /* Shadows */ --box-shadow-layer: transparent; // 0 2px 4px rgba(0,0,0,0.25); diff --git a/src/renderer/scss/component/_card.scss b/src/renderer/scss/component/_card.scss index 40ba15923..e7e1be0f2 100644 --- a/src/renderer/scss/component/_card.scss +++ b/src/renderer/scss/component/_card.scss @@ -142,12 +142,6 @@ font-size: 14px; font-family: 'metropolis-medium'; color: var(--card-text-color); - display: flex; - align-items: center; - - .icon { - margin: 0 0 0 $spacing-vertical * 1/3; - } } .card__subtitle--x-small { @@ -170,6 +164,15 @@ padding-top: $spacing-vertical * 2/3; } +.card__file-properties { + display: flex; + align-items: center; + + .icon { + margin: 0 0 0 $spacing-vertical * 1/3; + } +} + // .card-media__internal__links should always be inside a card .card { .card-media__internal-links { diff --git a/src/renderer/scss/component/_nav.scss b/src/renderer/scss/component/_nav.scss index fb1162c9a..ff282eea1 100644 --- a/src/renderer/scss/component/_nav.scss +++ b/src/renderer/scss/component/_nav.scss @@ -1,5 +1,5 @@ .nav { - width: var(--side-nav-width); + min-width: var(--side-nav-width); background-color: var(--nav-bg-color); padding: $spacing-width * 1/3; color: var(--nav-color); @@ -13,11 +13,11 @@ @media (min-width: $medium-breakpoint) { padding-left: $spacing-width; - width: calc(var(--side-nav-width) * 1.2); + width: calc(var(--side-nav-width) * 1.4); } @media (min-width: $large-breakpoint) { - width: calc(var(--side-nav-width) * 1.4); + width: calc(var(--side-nav-width) * 1.6); } } diff --git a/static/themes/dark.css b/static/themes/dark.css index 7343530d5..d3ca442c5 100644 --- a/static/themes/dark.css +++ b/static/themes/dark.css @@ -9,6 +9,7 @@ --color-bg: var(--color-blue-grey); --color-bg-alt: #2D3D56; --color-placeholder: var(--color-bg-alt); + --color-credit-free: var(--color-secondary); /* Text */ --text-color: var(--color-white); diff --git a/yarn.lock b/yarn.lock index 4e3f7c24d..13d1c7185 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5651,9 +5651,9 @@ lazy-val@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/lazy-val/-/lazy-val-1.0.3.tgz#bb97b200ef00801d94c317e29dc6ed39e31c5edc" -lbry-redux@lbryio/lbry-redux#b4fffe863df316bc73183567ab978221ee623b8c: +lbry-redux@lbryio/lbry-redux#03c3354c12f7834e6ed63705ff19487669be32b9: version "0.0.1" - resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/b4fffe863df316bc73183567ab978221ee623b8c" + resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/03c3354c12f7834e6ed63705ff19487669be32b9" dependencies: proxy-polyfill "0.1.6" reselect "^3.0.0"