fix collection preview links

This commit is contained in:
zeppi 2021-08-10 10:38:53 -04:00 committed by jessopb
parent fd66e6b9b1
commit dcac5ebcc9
2 changed files with 6 additions and 7 deletions

View file

@ -202,10 +202,9 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
let ariaLabelData = isChannelUri ? title : formatClaimPreviewTitle(title, channelTitle, date, mediaDuration); let ariaLabelData = isChannelUri ? title : formatClaimPreviewTitle(title, channelTitle, date, mediaDuration);
let navigateUrl = formatLbryUrlForWeb((claim && claim.canonical_url) || uri || '/'); let navigateUrl = formatLbryUrlForWeb((claim && claim.canonical_url) || uri || '/');
let navigateSearch = new URLSearchParams();
if (listId) { if (listId) {
const collectionParams = new URLSearchParams(); navigateSearch.set(COLLECTIONS_CONSTS.COLLECTION_ID, listId);
collectionParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, listId);
navigateUrl = navigateUrl + `?` + collectionParams.toString();
} }
const handleNavLinkClick = (e) => { const handleNavLinkClick = (e) => {
@ -218,6 +217,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
const navLinkProps = { const navLinkProps = {
to: { to: {
pathname: navigateUrl, pathname: navigateUrl,
search: navigateSearch.toString() ? '?' + navigateSearch.toString() : '',
state: containerId ? { [CONTAINER_ID]: containerId } : undefined, state: containerId ? { [CONTAINER_ID]: containerId } : undefined,
}, },
onClick: (e) => handleNavLinkClick(e), onClick: (e) => handleNavLinkClick(e),
@ -273,6 +273,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
if (claim && !pending && !disableNavigation) { if (claim && !pending && !disableNavigation) {
history.push({ history.push({
pathname: navigateUrl, pathname: navigateUrl,
search: navigateSearch.toString() ? '?' + navigateSearch.toString() : '',
state: containerId ? { [CONTAINER_ID]: containerId } : undefined, state: containerId ? { [CONTAINER_ID]: containerId } : undefined,
}); });
} }
@ -363,9 +364,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
<NavLink aria-hidden tabIndex={-1} {...navLinkProps}> <NavLink aria-hidden tabIndex={-1} {...navLinkProps}>
<FileThumbnail thumbnail={thumbnailUrl}> <FileThumbnail thumbnail={thumbnailUrl}>
<div className="claim-preview__hover-actions"> <div className="claim-preview__hover-actions">
{isPlayable && ( {isPlayable && <FileWatchLaterLink focusable={false} uri={uri} />}
<FileWatchLaterLink focusable={false} uri={uri} />
)}
</div> </div>
<div className="claim-preview__hover-actions"> <div className="claim-preview__hover-actions">
{/* @if TARGET='app' */} {/* @if TARGET='app' */}

View file

@ -1,6 +1,6 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { doSetContentHistoryItem, doSetPrimaryUri } from 'redux/actions/content'; import { doSetContentHistoryItem, doSetPrimaryUri } from 'redux/actions/content';
import { withRouter } from 'react-router'; import { withRouter } from 'react-router-dom';
import { import {
doFetchFileInfo, doFetchFileInfo,
makeSelectFileInfoForUri, makeSelectFileInfoForUri,