// @flow import * as ICONS from 'constants/icons'; import * as PAGES from 'constants/pages'; import React from 'react'; import { parseURI } from 'lbry-redux'; import ClaimPreview from 'component/claimPreview'; import Button from 'component/button'; import ClaimEffectiveAmount from 'component/claimEffectiveAmount'; import HelpLink from 'component/common/help-link'; import I18nMessage from 'component/i18nMessage'; type Props = { query: string, winningUri: ?Claim, doResolveUris: (Array) => void, hideLink?: boolean, }; export default function SearchTopClaim(props: Props) { const { doResolveUris, query = '', winningUri, hideLink = false } = props; const uriFromQuery = `lbry://${query}`; let channelUriFromQuery; try { const { isChannel } = parseURI(uriFromQuery); if (!isChannel) { channelUriFromQuery = `lbry://@${query}`; } } catch (e) {} React.useEffect(() => { let urisToResolve = []; if (uriFromQuery) { urisToResolve.push(uriFromQuery); } if (channelUriFromQuery) { urisToResolve.push(channelUriFromQuery); } if (urisToResolve.length > 0) { doResolveUris(urisToResolve); } }, [doResolveUris, uriFromQuery, channelUriFromQuery]); if (!winningUri) { return null; } return (
{__('Most supported')}
( )} />
{!hideLink && (
)}
); }