2019-06-28 09:27:55 +02:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
import {
|
|
|
|
doResolveUri,
|
|
|
|
makeSelectClaimForUri,
|
|
|
|
makeSelectIsUriResolving,
|
|
|
|
makeSelectClaimIsMine,
|
|
|
|
makeSelectClaimIsPending,
|
|
|
|
makeSelectClaimIsNsfw,
|
2020-01-07 22:07:12 +01:00
|
|
|
doFileGet,
|
2020-05-07 14:22:55 +02:00
|
|
|
makeSelectReflectingClaimForUri,
|
2020-05-11 17:54:39 +02:00
|
|
|
makeSelectClaimWasPurchased,
|
2020-05-21 17:38:28 +02:00
|
|
|
makeSelectStreamingUrlForUri,
|
2021-03-26 00:52:28 +01:00
|
|
|
makeSelectClaimIsStreamPlaceholder,
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
makeSelectCollectionIsMine,
|
|
|
|
doCollectionEdit,
|
|
|
|
makeSelectUrlsForCollectionId,
|
|
|
|
makeSelectIndexForUrlInCollection,
|
2021-07-16 08:53:38 +02:00
|
|
|
makeSelectTitleForUri,
|
|
|
|
makeSelectDateForUri,
|
2019-06-28 09:27:55 +02:00
|
|
|
} from 'lbry-redux';
|
2021-03-03 19:50:16 +01:00
|
|
|
import { selectMutedChannels, makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
2019-07-17 05:32:29 +02:00
|
|
|
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
Livestream category improvements (#7115)
* ❌ Remove old method of displaying active livestreams
Completely remove it for now to make the commit deltas clearer.
We'll replace it with the new method at the end.
* Fetch and store active-livestream info in redux
* Tiles can now query active-livestream state from redux instead of getting from parent.
* ⏪ ClaimTilesDiscover: revert and cleanup
## Simplify
- Simplify to just `uris` instead of having multiple arrays (`uris`, `modifiedUris`, `prevUris`)
- The `prevUris` is for CLS prevention. With this removal, the CLS issue is back, but we'll handle it differently later.
- Temporarily disable the view-count fetching. Code is left there so that I don't forget.
## Fix
- `shouldPerformSearch` was never true when `prefixUris` is present. Corrected the logic.
- Aside: prefix and pin is so similar in function. Hm ....
* ClaimTilesDiscover: factor out options
## Change
Move the `option` code outside and passed in as a pre-calculated prop.
## Reason
To skip rendering while waiting for `claim_search`, we need to add `React.memo(areEqual)`. However, the flag that determines if we are fetching `claim_search` (fetchingClaimSearchByQuery[]) depends on the derived options as the key.
Instead of calculating `options` twice, we moved it to the props so both sides can use it.
It also makes the component a bit more readable.
The downside is that the prop-passing might not be clear.
* ClaimTilesDiscover: reduce ~17 renders at startup to just 2.
* ClaimTilesDiscover: fill with placeholder while waiting for claim_search
## Issue
Livestream claims are fetched seperately, so they might already exists. While claim_search is running, the list only consists of livestreams (collapsed).
## Fix
Fill up the space with placeholders to prevent layout shift.
* Add 'useFetchViewCount' to handle fetching from lists
This effect also stashes fetched uris, so that we won't re-fetch the same uris during the same instance (e.g. during infinite scroll).
* ⏪ ClaimListDiscover: revert and cleanup
## Revert
- Removed the 'finalUris' stuff that was meant to "pause" visual changes when fetching. I think it'll be cleaner to use React.memo to achieve that.
## Alterations
- Added `renderUri` to make it clear which array that this component will render.
- Re-do the way we fetch view counts now that 'finalUris' is gone. Not the best method, but at least correct for now.
* ClaimListDiscover: add prefixUris, similar to ClaimTilesDiscover
This will be initially used to append livestreams at the top.
* ✅ Re-enable active livestream tiles using the new method
* doFetchActiveLivestreams: add interval check
- Added a default minimum of 5 minutes between fetches. Clients can bypass this through `forceFetch` if needed.
* doFetchActiveLivestreams: add option check
We'll need to support different 'orderBy', so adding an "options check" when determining if we just made the same fetch.
* WildWest: limit livestream tiles + add ability to show more
Most likely this behavior will change in the future, so we'll leave `ClaimListDiscover` untouched and handle the logic at the page level.
This solution uses 2 `ClaimListDiscover` -- if the reduced livestream list is visible, it handles the header; else the normal list handles the header.
* Use better tile-count on larger screens.
Used the same method as how the homepage does it.
2021-09-24 16:26:21 +02:00
|
|
|
import { makeSelectIsActiveLivestream } from 'redux/selectors/livestream';
|
2019-10-17 18:58:28 +02:00
|
|
|
import { selectShowMatureContent } from 'redux/selectors/settings';
|
2020-05-21 17:38:28 +02:00
|
|
|
import { makeSelectHasVisitedUri } from 'redux/selectors/content';
|
2019-07-08 22:54:58 +02:00
|
|
|
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
2021-03-03 19:50:16 +01:00
|
|
|
import { selectModerationBlockList } from 'redux/selectors/comments';
|
2021-07-16 08:53:38 +02:00
|
|
|
|
2019-06-28 09:27:55 +02:00
|
|
|
import ClaimPreview from './view';
|
2021-07-16 08:53:38 +02:00
|
|
|
import formatMediaDuration from 'util/formatMediaDuration';
|
2019-06-28 09:27:55 +02:00
|
|
|
|
2021-07-16 08:53:38 +02:00
|
|
|
const select = (state, props) => {
|
|
|
|
const claim = props.uri && makeSelectClaimForUri(props.uri)(state);
|
|
|
|
const media = claim && claim.value && (claim.value.video || claim.value.audio);
|
|
|
|
const mediaDuration = media && media.duration && formatMediaDuration(media.duration, { screenReader: true });
|
|
|
|
|
|
|
|
return {
|
|
|
|
claim,
|
|
|
|
mediaDuration,
|
|
|
|
date: props.uri && makeSelectDateForUri(props.uri)(state),
|
|
|
|
title: props.uri && makeSelectTitleForUri(props.uri)(state),
|
|
|
|
pending: props.uri && makeSelectClaimIsPending(props.uri)(state),
|
|
|
|
reflectingProgress: props.uri && makeSelectReflectingClaimForUri(props.uri)(state),
|
|
|
|
obscureNsfw: selectShowMatureContent(state) === false,
|
|
|
|
claimIsMine: props.uri && makeSelectClaimIsMine(props.uri)(state),
|
|
|
|
isResolvingUri: props.uri && makeSelectIsUriResolving(props.uri)(state),
|
|
|
|
isResolvingRepost: props.uri && makeSelectIsUriResolving(props.repostUrl)(state),
|
|
|
|
repostClaim: props.uri && makeSelectClaimForUri(props.uri)(state),
|
|
|
|
nsfw: props.uri && makeSelectClaimIsNsfw(props.uri)(state),
|
|
|
|
blackListedOutpoints: selectBlackListedOutpoints(state),
|
|
|
|
filteredOutpoints: selectFilteredOutpoints(state),
|
|
|
|
mutedUris: selectMutedChannels(state),
|
|
|
|
blockedUris: selectModerationBlockList(state),
|
|
|
|
hasVisitedUri: props.uri && makeSelectHasVisitedUri(props.uri)(state),
|
|
|
|
channelIsBlocked: props.uri && makeSelectChannelIsMuted(props.uri)(state),
|
|
|
|
isSubscribed: props.uri && makeSelectIsSubscribed(props.uri, true)(state),
|
|
|
|
streamingUrl: props.uri && makeSelectStreamingUrlForUri(props.uri)(state),
|
|
|
|
wasPurchased: props.uri && makeSelectClaimWasPurchased(props.uri)(state),
|
|
|
|
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
Livestream category improvements (#7115)
* ❌ Remove old method of displaying active livestreams
Completely remove it for now to make the commit deltas clearer.
We'll replace it with the new method at the end.
* Fetch and store active-livestream info in redux
* Tiles can now query active-livestream state from redux instead of getting from parent.
* ⏪ ClaimTilesDiscover: revert and cleanup
## Simplify
- Simplify to just `uris` instead of having multiple arrays (`uris`, `modifiedUris`, `prevUris`)
- The `prevUris` is for CLS prevention. With this removal, the CLS issue is back, but we'll handle it differently later.
- Temporarily disable the view-count fetching. Code is left there so that I don't forget.
## Fix
- `shouldPerformSearch` was never true when `prefixUris` is present. Corrected the logic.
- Aside: prefix and pin is so similar in function. Hm ....
* ClaimTilesDiscover: factor out options
## Change
Move the `option` code outside and passed in as a pre-calculated prop.
## Reason
To skip rendering while waiting for `claim_search`, we need to add `React.memo(areEqual)`. However, the flag that determines if we are fetching `claim_search` (fetchingClaimSearchByQuery[]) depends on the derived options as the key.
Instead of calculating `options` twice, we moved it to the props so both sides can use it.
It also makes the component a bit more readable.
The downside is that the prop-passing might not be clear.
* ClaimTilesDiscover: reduce ~17 renders at startup to just 2.
* ClaimTilesDiscover: fill with placeholder while waiting for claim_search
## Issue
Livestream claims are fetched seperately, so they might already exists. While claim_search is running, the list only consists of livestreams (collapsed).
## Fix
Fill up the space with placeholders to prevent layout shift.
* Add 'useFetchViewCount' to handle fetching from lists
This effect also stashes fetched uris, so that we won't re-fetch the same uris during the same instance (e.g. during infinite scroll).
* ⏪ ClaimListDiscover: revert and cleanup
## Revert
- Removed the 'finalUris' stuff that was meant to "pause" visual changes when fetching. I think it'll be cleaner to use React.memo to achieve that.
## Alterations
- Added `renderUri` to make it clear which array that this component will render.
- Re-do the way we fetch view counts now that 'finalUris' is gone. Not the best method, but at least correct for now.
* ClaimListDiscover: add prefixUris, similar to ClaimTilesDiscover
This will be initially used to append livestreams at the top.
* ✅ Re-enable active livestream tiles using the new method
* doFetchActiveLivestreams: add interval check
- Added a default minimum of 5 minutes between fetches. Clients can bypass this through `forceFetch` if needed.
* doFetchActiveLivestreams: add option check
We'll need to support different 'orderBy', so adding an "options check" when determining if we just made the same fetch.
* WildWest: limit livestream tiles + add ability to show more
Most likely this behavior will change in the future, so we'll leave `ClaimListDiscover` untouched and handle the logic at the page level.
This solution uses 2 `ClaimListDiscover` -- if the reduced livestream list is visible, it handles the header; else the normal list handles the header.
* Use better tile-count on larger screens.
Used the same method as how the homepage does it.
2021-09-24 16:26:21 +02:00
|
|
|
isLivestreamActive: makeSelectIsActiveLivestream(props.uri)(state),
|
2021-07-16 08:53:38 +02:00
|
|
|
isCollectionMine: makeSelectCollectionIsMine(props.collectionId)(state),
|
|
|
|
collectionUris: makeSelectUrlsForCollectionId(props.collectionId)(state),
|
|
|
|
collectionIndex: makeSelectIndexForUrlInCollection(props.uri, props.collectionId)(state),
|
|
|
|
};
|
|
|
|
};
|
2019-06-28 09:27:55 +02:00
|
|
|
|
2021-03-03 19:50:16 +01:00
|
|
|
const perform = (dispatch) => ({
|
|
|
|
resolveUri: (uri) => dispatch(doResolveUri(uri)),
|
|
|
|
getFile: (uri) => dispatch(doFileGet(uri, false)),
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
editCollection: (id, params) => dispatch(doCollectionEdit(id, params)),
|
2019-06-28 09:27:55 +02:00
|
|
|
});
|
|
|
|
|
2020-04-01 20:43:50 +02:00
|
|
|
export default connect(select, perform)(ClaimPreview);
|