omit channels from suggested publish on search

This commit is contained in:
jessop 2019-12-20 10:13:50 -05:00 committed by Sean Yesmunt
parent 8ccc3f8b89
commit a43d91504f
2 changed files with 23 additions and 12 deletions

View file

@ -175,6 +175,10 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
); );
} }
if (placeholder === 'publish' && !claim && uri.startsWith('lbry://@')) {
return null;
}
return ( return (
<li <li
ref={ref} ref={ref}

View file

@ -23,6 +23,12 @@ export default function SearchPage(props: Props) {
const urlParams = new URLSearchParams(location.search); const urlParams = new URLSearchParams(location.search);
const urlQuery = urlParams.get('q'); const urlQuery = urlParams.get('q');
let normalizedUri;
let isUriValid;
if (isURIValid(urlQuery)) {
isUriValid = true;
normalizedUri = normalizeURI(urlQuery);
} else {
let INVALID_URI_CHARS = new RegExp(regexInvalidURI, 'gu'); let INVALID_URI_CHARS = new RegExp(regexInvalidURI, 'gu');
let modifiedUrlQuery = urlQuery let modifiedUrlQuery = urlQuery
? urlQuery ? urlQuery
@ -30,8 +36,9 @@ export default function SearchPage(props: Props) {
.replace(/\s+/g, '-') .replace(/\s+/g, '-')
.replace(INVALID_URI_CHARS, '') .replace(INVALID_URI_CHARS, '')
: ''; : '';
const isModifiedUriValid = isURIValid(modifiedUrlQuery); isUriValid = isURIValid(modifiedUrlQuery);
const normalizedModifiedUri = isModifiedUriValid && normalizeURI(modifiedUrlQuery); normalizedUri = isUriValid && normalizeURI(modifiedUrlQuery);
}
useEffect(() => { useEffect(() => {
if (urlQuery) { if (urlQuery) {
@ -44,11 +51,11 @@ export default function SearchPage(props: Props) {
<section className="search"> <section className="search">
{urlQuery && ( {urlQuery && (
<Fragment> <Fragment>
{isModifiedUriValid && ( {isUriValid && (
<header className="search__header"> <header className="search__header">
<ClaimUri uri={normalizedModifiedUri} /> <ClaimUri uri={normalizedUri} />
<div className="card"> <div className="card">
<ClaimPreview uri={normalizedModifiedUri} type="large" placeholder="publish" /> <ClaimPreview uri={normalizedUri} type="large" placeholder="publish" />
</div> </div>
</header> </header>
)} )}