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 (
<li
ref={ref}

View file

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