Update
This commit is contained in:
parent
f4cf36a87f
commit
e92dff60e8
9 changed files with 18 additions and 26 deletions
Binary file not shown.
Binary file not shown.
|
@ -106,7 +106,7 @@ function ChannelForm(props: Props) {
|
|||
const languageParam = params.languages;
|
||||
const primaryLanguage = Array.isArray(languageParam) && languageParam.length && languageParam[0];
|
||||
const secondaryLanguage = Array.isArray(languageParam) && languageParam.length >= 2 && languageParam[1];
|
||||
const [hideWatched, setHideWatched] = usePersistedState('hideWatched', false); // UPDATE: Experimenting with hiding watched content
|
||||
const [hideWatched, setHideWatched] = usePersistedState('hideWatched', false);
|
||||
const submitLabel = React.useMemo(() => {
|
||||
if (isClaimingInitialRewards) {
|
||||
return __('Claiming credits...');
|
||||
|
@ -241,7 +241,7 @@ function ChannelForm(props: Props) {
|
|||
errorMsg = __('Invalid %error_type%', { error_type: (thumbError && 'thumbnail') || (coverError && 'cover image') });
|
||||
}
|
||||
|
||||
// UPDATE: Add "Hide Watched" to channel pages
|
||||
// Add "Hide Watched" to channel pages
|
||||
function getHideWatchedElem() {
|
||||
return (
|
||||
<div className={classnames(`card claim-search__menus`)}>
|
||||
|
|
|
@ -67,7 +67,7 @@ function ClaimListHeader(props: Props) {
|
|||
const [orderParamUser, setOrderParamUser] = usePersistedState(`orderUser-${location.pathname}`, CS.ORDER_BY_TRENDING);
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const freshnessParam = freshness || urlParams.get(CS.FRESH_KEY) || defaultFreshness;
|
||||
const [hideWatched, setHideWatched] = usePersistedState('hideWatched', false); // UPDATE: Experimenting with hiding watched content
|
||||
const [hideWatched, setHideWatched] = usePersistedState('hideWatched', false);
|
||||
const contentTypeParam = urlParams.get(CS.CONTENT_KEY);
|
||||
const streamTypeParam =
|
||||
streamType || (CS.FILE_TYPES.includes(contentTypeParam) && contentTypeParam) || defaultStreamType || null;
|
||||
|
@ -100,8 +100,6 @@ function ClaimListHeader(props: Props) {
|
|||
? languageParam !== languageSetting && languageParam !== null
|
||||
: languageParam !== CS.LANGUAGES_ALL && languageParam !== null;
|
||||
|
||||
// UPDATE: Experimenting with hiding watched content
|
||||
// Adding a Hide Watched checkbox to the main menu
|
||||
function getHideWatchedElem() {
|
||||
return (
|
||||
<div className={`claim-search__checkbox`}>
|
||||
|
|
|
@ -21,7 +21,7 @@ import { selectIsSubscribedForUri } from 'redux/selectors/subscriptions';
|
|||
import { isClaimNsfw } from 'util/claim';
|
||||
import ClaimPreview from './view';
|
||||
import formatMediaDuration from 'util/formatMediaDuration';
|
||||
import { makeSelectContentWatchedPercentageForUri } from 'redux/selectors/content'; // UPDATE: Added mSCWPFU (Watched content)
|
||||
import { makeSelectContentWatchedPercentageForUri } from 'redux/selectors/content';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = props.uri && selectClaimForUri(state, props.uri);
|
||||
|
@ -47,7 +47,7 @@ const select = (state, props) => {
|
|||
wasPurchased: props.uri && makeSelectClaimWasPurchased(props.uri)(state),
|
||||
isCollectionMine: makeSelectCollectionIsMine(props.collectionId)(state),
|
||||
lang: selectLanguage(state),
|
||||
isWatched: makeSelectContentWatchedPercentageForUri(props.uri)(state) > 80, // UPDATE: Added isWatched, getting percent watched
|
||||
isWatched: makeSelectContentWatchedPercentageForUri(props.uri)(state) > 80, // Content considered "watched" when viewed to 80%
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import ClaimPreviewNoContent from './claim-preview-no-content';
|
|||
import CollectionEditButtons from 'component/collectionEditButtons';
|
||||
import { useIsMobile } from 'effects/use-screensize';
|
||||
import AbandonedChannelPreview from 'component/abandonedChannelPreview';
|
||||
import usePersistedState from 'effects/use-persisted-state'; // UPDATE: usePersistedState is required for watched content
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
|
||||
// preview images used on the landing page and on the channel page
|
||||
type Props = {
|
||||
|
@ -83,7 +83,7 @@ type Props = {
|
|||
showEdit?: boolean,
|
||||
dragHandleProps?: any,
|
||||
unavailableUris?: Array<string>,
|
||||
isWatched: boolean, // UPDATE: Declare isWatched variable
|
||||
isWatched: boolean,
|
||||
};
|
||||
|
||||
const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
|
@ -143,11 +143,11 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
|||
showEdit,
|
||||
dragHandleProps,
|
||||
unavailableUris,
|
||||
isWatched, // UPDATE: Variables to use in the ClaimPreviewTile
|
||||
isWatched,
|
||||
} = props;
|
||||
|
||||
const isMobile = useIsMobile();
|
||||
const [hideWatched, setHideWatched] = usePersistedState('hideWatched', false); //UPDATE: Use hideWatched
|
||||
const [hideWatched, setHideWatched] = usePersistedState('hideWatched', false);
|
||||
const isCollection = claim && claim.value_type === 'collection';
|
||||
const collectionClaimId = isCollection && claim && claim.claim_id;
|
||||
const listId = collectionId || collectionClaimId;
|
||||
|
@ -282,7 +282,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
|||
}
|
||||
}, [isValid, uri, isResolvingUri, shouldFetch, resolveUri]);
|
||||
|
||||
// UPDATE: Hiding watched content
|
||||
if (isWatched && hideWatched) {
|
||||
shouldHide = true;
|
||||
}
|
||||
|
@ -290,7 +289,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
|||
if (shouldHide) {
|
||||
return null;
|
||||
}
|
||||
// END OF UPDATE:
|
||||
|
||||
if (shouldHide && !showNullPlaceholder) {
|
||||
return null;
|
||||
|
|
|
@ -10,7 +10,7 @@ import { doFileGet } from 'redux/actions/file';
|
|||
import { doResolveUri } from 'redux/actions/claims';
|
||||
import { selectViewCountForUri, selectBanStateForUri } from 'lbryinc';
|
||||
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import { makeSelectContentWatchedPercentageForUri } from 'redux/selectors/content'; // UPDATE: Added percentage watched element
|
||||
import { makeSelectContentWatchedPercentageForUri } from 'redux/selectors/content';
|
||||
import { isClaimNsfw } from 'util/claim';
|
||||
import ClaimPreviewTile from './view';
|
||||
import formatMediaDuration from 'util/formatMediaDuration';
|
||||
|
@ -31,7 +31,7 @@ const select = (state, props) => {
|
|||
showMature: selectShowMatureContent(state),
|
||||
isMature: claim ? isClaimNsfw(claim) : false,
|
||||
viewCount: selectViewCountForUri(state, props.uri),
|
||||
isWatched: makeSelectContentWatchedPercentageForUri(props.uri)(state) > 80, // UPDATE: Get isWatched view percentage and only show < 80%
|
||||
isWatched: makeSelectContentWatchedPercentageForUri(props.uri)(state) > 80, // Content considered "watched" when viewed 80%
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import ClaimMenuList from 'component/claimMenuList';
|
|||
import CollectionPreviewOverlay from 'component/collectionPreviewOverlay';
|
||||
// $FlowFixMe cannot resolve ...
|
||||
import PlaceholderTx from 'static/img/placeholderTx.gif';
|
||||
import usePersistedState from 'effects/use-persisted-state'; // UPDATE: usePersistedState is required for watched content
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
|
@ -43,7 +43,7 @@ type Props = {
|
|||
collectionId?: string,
|
||||
viewCount: string,
|
||||
swipeLayout: boolean,
|
||||
isWatched: boolean, // UPDATE: Declare isWatched variable
|
||||
isWatched: boolean,
|
||||
};
|
||||
|
||||
// preview image cards used in related video functionality, channel overview page and homepage
|
||||
|
@ -69,12 +69,12 @@ function ClaimPreviewTile(props: Props) {
|
|||
mediaDuration,
|
||||
viewCount,
|
||||
swipeLayout = false,
|
||||
isWatched, // UPDATE: Variables to use in the ClaimPreviewTile
|
||||
isWatched,
|
||||
} = props;
|
||||
const isRepost = claim && claim.repost_channel_url;
|
||||
const isCollection = claim && claim.value_type === 'collection';
|
||||
const isStream = claim && claim.value_type === 'stream';
|
||||
const [hideWatched, setHideWatched] = usePersistedState('hideWatched', false); //UPDATE: Use hideWatched
|
||||
const [hideWatched, setHideWatched] = usePersistedState('hideWatched', false);
|
||||
// $FlowFixMe
|
||||
const isPlayable =
|
||||
claim &&
|
||||
|
@ -130,7 +130,6 @@ function ClaimPreviewTile(props: Props) {
|
|||
|
||||
let shouldHide = false;
|
||||
|
||||
// UPDATE: Hiding watched content
|
||||
if (isMature && !showMature) {
|
||||
// Unfortunately needed until this is resolved
|
||||
// https://github.com/lbryio/lbry-sdk/issues/2785
|
||||
|
@ -146,7 +145,6 @@ function ClaimPreviewTile(props: Props) {
|
|||
if (shouldHide) {
|
||||
return null;
|
||||
}
|
||||
// END OF UPDATE:
|
||||
|
||||
const isChannelPage = location.pathname.startsWith('/@');
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ const SearchOptions = (props: Props) => {
|
|||
delete TYPES_ADVANCED[SEARCH_OPTIONS.MEDIA_IMAGE];
|
||||
}
|
||||
|
||||
const [hideWatched, setHideWatched] = usePersistedState('hideWatched', false); // UPDATE: Experimenting with hiding watched content
|
||||
const [hideWatched, setHideWatched] = usePersistedState('hideWatched', false);
|
||||
|
||||
React.useEffect(() => {
|
||||
// We no longer let the user set the search results count, but the value
|
||||
|
@ -72,7 +72,6 @@ const SearchOptions = (props: Props) => {
|
|||
}
|
||||
}, []);
|
||||
|
||||
// UPDATE: Adding Hide Watched Content checkbox to search
|
||||
function getHideWatchedElem() {
|
||||
return (
|
||||
<div className={`claim-search__checkbox_searchbox`}>
|
||||
|
@ -177,7 +176,7 @@ const SearchOptions = (props: Props) => {
|
|||
</>
|
||||
);
|
||||
|
||||
// UPDATE: Changed element name to exactMatchElem
|
||||
// Changed element name to exactMatchElem
|
||||
const exactMatchElem = (
|
||||
<>
|
||||
<div className="filter-values">
|
||||
|
@ -223,7 +222,6 @@ const SearchOptions = (props: Props) => {
|
|||
</div>
|
||||
);
|
||||
|
||||
// UPDATE: Declare constant for the Hide Watch Content element
|
||||
const hideWatchedElem = (
|
||||
<div>
|
||||
{getHideWatchedElem()}
|
||||
|
@ -247,7 +245,7 @@ const SearchOptions = (props: Props) => {
|
|||
const uploadDateLabel =
|
||||
options[SEARCH_OPTIONS.CLAIM_TYPE] === SEARCH_OPTIONS.INCLUDE_CHANNELS ? __('Creation Date') : __('Upload Date');
|
||||
|
||||
// UPDATE: Added row to table for hiding watched content in search settings
|
||||
// Added row to table for hiding watched content in search settings
|
||||
return (
|
||||
<div>
|
||||
<Button
|
||||
|
|
Loading…
Add table
Reference in a new issue