diff --git a/static/app-strings.json b/static/app-strings.json index 100546ac1..823d42bf4 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -2180,5 +2180,13 @@ "Creator": "Creator", "From comments": "From comments", "From search": "From search", + "Manage tags": "Manage tags", + "Enter the full channel name or URL to search.\n\nExamples:\n - @channel\n - @channel#3\n - https://odysee.com/@Odysee:8\n - lbry://@Odysee#8": "Enter the full channel name or URL to search.\n\nExamples:\n - @channel\n - @channel#3\n - https://odysee.com/@Odysee:8\n - lbry://@Odysee#8", + "Trending for #Btc": "Trending for #Btc", + "Block and muted channels": "Block and muted channels", + "Claiming credits...": "Claiming credits...", + "Strict": "Strict", + "MatchCount": "MatchCount", + "Word Count": "Word Count", "--end--": "--end--" } diff --git a/ui/component/claimListDiscover/view.jsx b/ui/component/claimListDiscover/view.jsx index e450a2c45..f0cbda250 100644 --- a/ui/component/claimListDiscover/view.jsx +++ b/ui/component/claimListDiscover/view.jsx @@ -53,6 +53,7 @@ type Props = { streamType?: string | Array, defaultStreamType?: string | Array, + searchText?: string, empty?: string, feeAmount?: string, releaseTime?: string, @@ -122,6 +123,7 @@ function ClaimListDiscover(props: Props) { name, claimType, pageSize, + searchText, defaultClaimType, streamType = SIMPLE_SITE ? [CS.FILE_VIDEO, CS.FILE_AUDIO] : undefined, defaultStreamType = SIMPLE_SITE ? CS.FILE_VIDEO : undefined, // add param for DEFAULT_STREAM_TYPE @@ -281,6 +283,10 @@ function ClaimListDiscover(props: Props) { options.channel_ids = channelIdsParam; } + if (searchText) { + options.text = searchText; + } + if (tagsParam) { if (tagsParam !== CS.TAGS_ALL && tagsParam !== '') { if (tagsParam === CS.TAGS_FOLLOWED) { diff --git a/ui/component/recommendedContent/view.jsx b/ui/component/recommendedContent/view.jsx index 2de10bd10..3c071c5b6 100644 --- a/ui/component/recommendedContent/view.jsx +++ b/ui/component/recommendedContent/view.jsx @@ -9,6 +9,9 @@ import { useIsMobile, useIsMediumScreen } from 'effects/use-screensize'; import Button from 'component/button'; import classnames from 'classnames'; import RecSys from 'recsys'; +import { FormField } from '../common/form-components/form-field'; +import I18nMessage from '../i18nMessage'; +import CreditAmount from '../common/credit-amount'; const VIEW_ALL_RELATED = 'view_all_related'; const VIEW_MORE_FROM = 'view_more_from'; @@ -36,6 +39,8 @@ export default React.memo(function RecommendedContent(props: Props) { claimId, } = props; const [viewMode, setViewMode] = React.useState(VIEW_ALL_RELATED); + const [strict, setStrict] = React.useState(false); + const [wordCount, setWordCount] = React.useState(3); const signingChannel = claim && claim.signing_channel; const channelName = signingChannel ? signingChannel.name : null; const isMobile = useIsMobile(); @@ -64,14 +69,81 @@ export default React.memo(function RecommendedContent(props: Props) { } } + function getSearchTextForClaim(claim) { + const wordMap = {}; + + const addToWordmap = (word) => { + if (wordMap[word]) { + wordMap[word]++; + } else { + wordMap[word] = 1; + } + }; + + claim.name.split('-').map((word) => addToWordmap(word)); + if (claim.value.title) { + claim.value.title.split(' ').map((word) => addToWordmap(word)); + } + if (claim.value.tags) { + claim.value.tags.forEach((tag) => tag.split(' ').map((word) => addToWordmap(word))); + } + if (claim.value.description) { + claim.value.description.split(' ').map((word) => addToWordmap(word)); + } + console.log('wordMap', wordMap); + + const sorted = Object.entries(wordMap) + .sort(([, a], [, b]) => b - a) + .map(([el, val]) => el) + .filter((e) => e.length >= 4); + let searchText = sorted.slice(0, wordCount).join(strict ? ' +' : ' '); + console.log('searchText', searchText); + // console.log('claim.title'); + // if (claim.value && claim.value.title) { + // searchText += claim.value.title; + // } + // if (claim.value.description) { + // searchText += claim.value.description; + // } + console.log('searchText', searchText); + return searchText; + } + + const searchText = claim ? getSearchTextForClaim(claim) : undefined; + return ( + // + //
+ // + //
+ // + // ) + // } + subtitle={ +
- ) +
+ setWordCount(event.target.value)} + /> + setStrict(!strict)} + /> +
+

{searchText}

+
} body={
- {viewMode === VIEW_ALL_RELATED && ( + {viewMode === VIEW_ALL_RELATED && IS_WEB && ( } empty={__('No related content found')} onClick={handleRecommendationClicked} /> )} + {/*{viewMode === VIEW_ALL_RELATED && !IS_WEB && (*/} + {/* }*/} + {/* empty={__('No related content found')}*/} + {/* onClick={handleRecommendationClicked}*/} + {/* />*/} + {/*)}*/} + {viewMode === VIEW_ALL_RELATED && !IS_WEB && ( + } + empty={__('No related content found')} + /> + )} {viewMode === VIEW_MORE_FROM && signingChannel && ( (function RecommendedContent(props: Props) { claimType={['stream']} orderBy="new" pageSize={20} - infiniteScroll={false} + infiniteScroll={true} hideFilters channelIds={[signingChannel.claim_id]} loading={isSearching}