2018-03-26 23:32:43 +02:00
|
|
|
// @flow
|
2021-08-18 00:34:16 +02:00
|
|
|
import { DOMAIN, ENABLE_NO_SOURCE_CLAIMS } from 'config';
|
Re-design comment threads (#1489)
* Redesign threadline and fetching state
- threadline goes right below channel avatar, mimicking reddits implementation, has a increase effect on hover and is slimmer, creating more space for comments on screen
- fetching state now replaces show/hide button, also mimicking reddit, and now says that it is loading, instead of a blank spinner, and also improves space a bit
* Redesign comment threads
- Allow for infinite comment chains
- Can go back and forth between the pages
- Can go back to all comments or to the first comment in the chain
- Some other improvements, which include:
- add title on non-drawer comment sections (couldn't see amount of comments)
- fix Expandable component (would begin expanded and collapse after the effect runs, which looked bad and shifted the layout, now each comments greater than the set length begins collapsed)
- used constants for consistency
* Fix replying to last thread comment
* Fix buttons condition (only on fetched comment to avoid deleted case)
* Fix auto-scroll
* Bring back instant feedback for Show More replies
* Improve thread back links
- Now going back to all comments links the top-level comment for easier navigation
- Going back to ~ previous ~ now goes back into the chain instead of topmost level
* Clear timeouts due to unrelated issue
* Fix deep thread linked comment case and more scroll improvements
* More minor changes
* Flow
* Fix commentList tile style
* Fix long channel names overflowing on small screens
* More scroll changes
* Fix threadline
* Revert "Fix long channel names overflowing on small screens"
This reverts commit e4d2dc7da5861ed8136a60f3352e41a690cd4d33.
* Fix replies fetch
* Revert "Fix replies fetch"
This reverts commit ec70054675a604a7a5f3764ba07c36bf7b0f49c8.
* Cleanup and make smooth
* Always use linked comment on threads
* Cleanup
* Higlight thread comment
* Fix comment body styles
2022-05-16 12:22:13 +02:00
|
|
|
import { LINKED_COMMENT_QUERY_PARAM, THREAD_COMMENT_QUERY_PARAM } from 'constants/comment';
|
2022-03-15 17:18:08 +01:00
|
|
|
import React, { useEffect } from 'react';
|
2021-07-07 09:10:28 +02:00
|
|
|
import { lazyImport } from 'util/lazyImport';
|
2022-02-27 03:55:37 +01:00
|
|
|
import { Redirect } from 'react-router-dom';
|
2020-09-02 22:08:37 +02:00
|
|
|
import Spinner from 'component/spinner';
|
2017-12-21 22:08:54 +01:00
|
|
|
import ChannelPage from 'page/channel';
|
2018-03-26 23:32:43 +02:00
|
|
|
import Page from 'component/page';
|
2018-04-24 20:17:11 +02:00
|
|
|
import Button from 'component/button';
|
2019-12-13 22:46:28 +01:00
|
|
|
import Card from 'component/common/card';
|
2021-10-26 08:15:08 +02:00
|
|
|
import Yrbl from 'component/yrbl';
|
2020-02-14 17:42:38 +01:00
|
|
|
import { formatLbryUrlForWeb } from 'util/url';
|
2021-10-17 10:36:14 +02:00
|
|
|
import { parseURI } from 'util/lbryURI';
|
|
|
|
import * as COLLECTIONS_CONSTS from 'constants/collections';
|
2022-02-27 03:55:37 +01:00
|
|
|
import * as MODALS from 'constants/modal_types';
|
2017-05-05 08:13:06 +02:00
|
|
|
|
2021-08-07 11:00:33 +02:00
|
|
|
const AbandonedChannelPreview = lazyImport(() =>
|
|
|
|
import('component/abandonedChannelPreview' /* webpackChunkName: "abandonedChannelPreview" */)
|
|
|
|
);
|
2021-07-07 09:10:28 +02:00
|
|
|
const FilePage = lazyImport(() => import('page/file' /* webpackChunkName: "filePage" */));
|
|
|
|
const LivestreamPage = lazyImport(() => import('page/livestream' /* webpackChunkName: "livestream" */));
|
2021-08-07 11:00:33 +02:00
|
|
|
const isDev = process.env.NODE_ENV !== 'production';
|
2021-06-11 08:06:29 +02:00
|
|
|
|
2018-03-26 23:32:43 +02:00
|
|
|
type Props = {
|
|
|
|
isResolvingUri: boolean,
|
2020-02-05 07:14:37 +01:00
|
|
|
isSubscribed: boolean,
|
2018-03-26 23:32:43 +02:00
|
|
|
uri: string,
|
2019-04-24 16:02:08 +02:00
|
|
|
claim: StreamClaim,
|
2019-03-28 17:53:13 +01:00
|
|
|
location: UrlLocation,
|
2021-12-01 16:24:27 +01:00
|
|
|
blackListedOutpointMap: { [string]: number },
|
2020-07-02 18:47:36 +02:00
|
|
|
claimIsMine: boolean,
|
|
|
|
claimIsPending: boolean,
|
2021-03-10 19:34:21 +01:00
|
|
|
isLivestream: boolean,
|
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
|
|
|
collectionId: string,
|
|
|
|
collection: Collection,
|
|
|
|
collectionUrls: Array<string>,
|
|
|
|
isResolvingCollection: boolean,
|
2022-04-07 03:16:37 +02:00
|
|
|
isAuthenticated: boolean,
|
2022-03-14 20:15:30 +01:00
|
|
|
geoRestriction: ?GeoRestriction,
|
2022-06-02 06:50:55 +02:00
|
|
|
homepageFetched: boolean,
|
2022-05-09 14:26:04 +02:00
|
|
|
latestContentPath?: boolean,
|
|
|
|
liveContentPath?: boolean,
|
|
|
|
latestClaimUrl: ?string,
|
|
|
|
fetchLatestClaimForChannel: (uri: string) => void,
|
|
|
|
fetchChannelLiveStatus: (channelId: string) => void,
|
|
|
|
doResolveUri: (uri: string, returnCached?: boolean, resolveReposts?: boolean, options?: any) => void,
|
2022-02-24 16:20:07 +01:00
|
|
|
doBeginPublish: (name: ?string) => void,
|
|
|
|
doFetchItemsInCollection: ({ collectionId: string }) => void,
|
2022-02-27 03:55:37 +01:00
|
|
|
doOpenModal: (string, {}) => void,
|
2018-03-26 23:32:43 +02:00
|
|
|
};
|
|
|
|
|
2022-02-24 16:20:07 +01:00
|
|
|
export default function ShowPage(props: Props) {
|
2020-07-02 18:47:36 +02:00
|
|
|
const {
|
|
|
|
isResolvingUri,
|
|
|
|
uri,
|
|
|
|
claim,
|
2021-12-01 16:24:27 +01:00
|
|
|
blackListedOutpointMap,
|
2020-07-02 18:47:36 +02:00
|
|
|
location,
|
|
|
|
claimIsMine,
|
|
|
|
isSubscribed,
|
|
|
|
claimIsPending,
|
2021-03-10 19:34:21 +01:00
|
|
|
isLivestream,
|
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
|
|
|
collectionId,
|
|
|
|
collection,
|
|
|
|
collectionUrls,
|
|
|
|
isResolvingCollection,
|
2022-04-07 03:16:37 +02:00
|
|
|
isAuthenticated,
|
2022-03-14 20:15:30 +01:00
|
|
|
geoRestriction,
|
2022-06-02 06:50:55 +02:00
|
|
|
homepageFetched,
|
2022-05-09 14:26:04 +02:00
|
|
|
latestContentPath,
|
|
|
|
liveContentPath,
|
|
|
|
latestClaimUrl,
|
|
|
|
fetchLatestClaimForChannel,
|
|
|
|
fetchChannelLiveStatus,
|
2022-02-24 16:20:07 +01:00
|
|
|
doResolveUri,
|
|
|
|
doBeginPublish,
|
|
|
|
doFetchItemsInCollection,
|
2022-02-27 03:55:37 +01:00
|
|
|
doOpenModal,
|
2020-07-02 18:47:36 +02:00
|
|
|
} = props;
|
2021-02-25 20:14:21 +01:00
|
|
|
|
2022-02-24 16:20:07 +01:00
|
|
|
const { search, pathname, hash } = location;
|
|
|
|
const urlParams = new URLSearchParams(search);
|
Re-design comment threads (#1489)
* Redesign threadline and fetching state
- threadline goes right below channel avatar, mimicking reddits implementation, has a increase effect on hover and is slimmer, creating more space for comments on screen
- fetching state now replaces show/hide button, also mimicking reddit, and now says that it is loading, instead of a blank spinner, and also improves space a bit
* Redesign comment threads
- Allow for infinite comment chains
- Can go back and forth between the pages
- Can go back to all comments or to the first comment in the chain
- Some other improvements, which include:
- add title on non-drawer comment sections (couldn't see amount of comments)
- fix Expandable component (would begin expanded and collapse after the effect runs, which looked bad and shifted the layout, now each comments greater than the set length begins collapsed)
- used constants for consistency
* Fix replying to last thread comment
* Fix buttons condition (only on fetched comment to avoid deleted case)
* Fix auto-scroll
* Bring back instant feedback for Show More replies
* Improve thread back links
- Now going back to all comments links the top-level comment for easier navigation
- Going back to ~ previous ~ now goes back into the chain instead of topmost level
* Clear timeouts due to unrelated issue
* Fix deep thread linked comment case and more scroll improvements
* More minor changes
* Flow
* Fix commentList tile style
* Fix long channel names overflowing on small screens
* More scroll changes
* Fix threadline
* Revert "Fix long channel names overflowing on small screens"
This reverts commit e4d2dc7da5861ed8136a60f3352e41a690cd4d33.
* Fix replies fetch
* Revert "Fix replies fetch"
This reverts commit ec70054675a604a7a5f3764ba07c36bf7b0f49c8.
* Cleanup and make smooth
* Always use linked comment on threads
* Cleanup
* Higlight thread comment
* Fix comment body styles
2022-05-16 12:22:13 +02:00
|
|
|
const linkedCommentId = urlParams.get(LINKED_COMMENT_QUERY_PARAM);
|
|
|
|
const threadCommentId = urlParams.get(THREAD_COMMENT_QUERY_PARAM);
|
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
|
|
|
|
2019-10-17 21:09:03 +02:00
|
|
|
const signingChannel = claim && claim.signing_channel;
|
2019-11-15 16:13:19 +01:00
|
|
|
const canonicalUrl = claim && claim.canonical_url;
|
2019-11-19 18:41:31 +01:00
|
|
|
const claimExists = claim !== null && claim !== undefined;
|
|
|
|
const haventFetchedYet = claim === undefined;
|
2020-05-01 23:08:57 +02:00
|
|
|
const isMine = claim && claim.is_my_output;
|
2022-05-09 14:26:04 +02:00
|
|
|
const claimId = claim && claim.claim_id;
|
|
|
|
const isNewestPath = latestContentPath || liveContentPath;
|
2022-02-24 16:20:07 +01:00
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
const { contentName, isChannel } = parseURI(uri); // deprecated contentName - use streamName and channelName
|
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
|
|
|
const isCollection = claim && claim.value_type === 'collection';
|
|
|
|
const resolvedCollection = collection && collection.id; // not null
|
2021-12-16 22:59:13 +01:00
|
|
|
const showLiveStream = isLivestream && ENABLE_NO_SOURCE_CLAIMS;
|
2022-02-24 16:20:07 +01:00
|
|
|
const isClaimBlackListed =
|
|
|
|
claim &&
|
|
|
|
blackListedOutpointMap &&
|
|
|
|
Boolean(
|
|
|
|
(signingChannel && blackListedOutpointMap[`${signingChannel.txid}:${signingChannel.nout}`]) ||
|
|
|
|
blackListedOutpointMap[`${claim.txid}:${claim.nout}`]
|
|
|
|
);
|
2021-12-16 22:59:13 +01:00
|
|
|
|
2022-05-24 12:39:21 +02:00
|
|
|
const shouldResolveUri =
|
|
|
|
(doResolveUri && !isResolvingUri && uri && haventFetchedYet) ||
|
|
|
|
(claimExists && !claimIsPending && (!canonicalUrl || (isMine === undefined && isAuthenticated)));
|
|
|
|
|
2022-05-09 14:26:04 +02:00
|
|
|
useEffect(() => {
|
|
|
|
if (!canonicalUrl && isNewestPath) {
|
|
|
|
doResolveUri(uri);
|
|
|
|
}
|
|
|
|
// only for mount on a latest content page
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (!latestClaimUrl && liveContentPath && claimId) {
|
|
|
|
fetchChannelLiveStatus(claimId);
|
|
|
|
}
|
|
|
|
}, [claimId, fetchChannelLiveStatus, latestClaimUrl, liveContentPath]);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (!latestClaimUrl && latestContentPath && canonicalUrl) {
|
|
|
|
fetchLatestClaimForChannel(canonicalUrl);
|
|
|
|
}
|
|
|
|
}, [canonicalUrl, fetchLatestClaimForChannel, latestClaimUrl, latestContentPath]);
|
|
|
|
|
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
|
|
|
// changed this from 'isCollection' to resolve strangers' collections.
|
2022-03-14 20:15:30 +01:00
|
|
|
useEffect(() => {
|
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
|
|
|
if (collectionId && !resolvedCollection) {
|
2022-02-24 16:20:07 +01:00
|
|
|
doFetchItemsInCollection({ collectionId });
|
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
|
|
|
}
|
2022-02-24 16:20:07 +01:00
|
|
|
}, [isCollection, resolvedCollection, collectionId, doFetchItemsInCollection]);
|
2017-05-12 01:28:43 +02:00
|
|
|
|
2019-10-17 21:09:03 +02:00
|
|
|
useEffect(() => {
|
2019-11-15 16:13:19 +01:00
|
|
|
if (canonicalUrl) {
|
2022-07-12 21:58:18 +02:00
|
|
|
const statePos =
|
|
|
|
hash.indexOf('#state') > -1
|
|
|
|
? hash.indexOf('#state')
|
|
|
|
: hash.indexOf('&state') > -1
|
|
|
|
? hash.indexOf('&state')
|
|
|
|
: undefined;
|
|
|
|
const pageHash = statePos === undefined ? hash : hash.substring(0, statePos);
|
|
|
|
const urlPath = pathname + pageHash;
|
|
|
|
const path = urlPath.slice(1).replace(/:/g, '#');
|
|
|
|
// parseURI can parse queries and hashes when they are mixed with the uri
|
|
|
|
let queryString, pathHash;
|
|
|
|
try {
|
|
|
|
({ queryString, pathHash } = parseURI(path));
|
|
|
|
} catch (e) {}
|
|
|
|
const canonicalUrlPath = '/' + canonicalUrl.replace(/^lbry:\/\//, '').replace(/#/g, ':');
|
2022-02-24 16:20:07 +01:00
|
|
|
|
2020-08-18 05:41:28 +02:00
|
|
|
// replaceState will fail if on a different domain (like webcache.googleusercontent.com)
|
2021-08-07 11:00:33 +02:00
|
|
|
const hostname = isDev ? 'localhost' : DOMAIN;
|
2022-02-01 13:59:30 +01:00
|
|
|
|
2022-07-12 21:58:18 +02:00
|
|
|
let replaceUrl = canonicalUrlPath;
|
|
|
|
if (canonicalUrlPath !== urlPath && hostname === window.location.hostname) {
|
|
|
|
const urlParams = new URLSearchParams(search || queryString);
|
2021-06-11 23:46:52 +02:00
|
|
|
if (urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID)) {
|
|
|
|
const listId = urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID) || '';
|
|
|
|
urlParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, listId);
|
|
|
|
}
|
2022-02-01 13:59:30 +01:00
|
|
|
|
2022-07-12 21:58:18 +02:00
|
|
|
if (urlParams.toString()) replaceUrl += `?${urlParams.toString()}`;
|
|
|
|
if (pathHash || (!pathHash && !queryString && pageHash)) replaceUrl += String(pathHash || pageHash);
|
|
|
|
|
|
|
|
history.replaceState(history.state, '', replaceUrl);
|
2022-02-01 13:59:30 +01:00
|
|
|
}
|
2019-10-13 19:19:39 +02:00
|
|
|
}
|
2022-05-24 12:39:21 +02:00
|
|
|
}, [canonicalUrl, pathname, hash, search]);
|
2019-11-15 16:13:19 +01:00
|
|
|
|
2022-05-24 12:39:21 +02:00
|
|
|
useEffect(() => {
|
|
|
|
if (shouldResolveUri) {
|
2022-02-24 16:20:07 +01:00
|
|
|
doResolveUri(
|
2021-11-24 15:33:34 +01:00
|
|
|
uri,
|
|
|
|
false,
|
|
|
|
true,
|
2022-04-07 03:16:37 +02:00
|
|
|
isMine === undefined && isAuthenticated ? { include_is_my_output: true, include_purchase_receipt: true } : {}
|
2021-11-24 15:33:34 +01:00
|
|
|
);
|
2017-10-12 16:05:18 +02:00
|
|
|
}
|
2022-05-24 12:39:21 +02:00
|
|
|
}, [shouldResolveUri, doResolveUri, uri, isMine, isAuthenticated]);
|
2020-02-03 18:23:21 +01:00
|
|
|
|
2022-05-09 14:26:04 +02:00
|
|
|
// Wait for latest claim fetch
|
|
|
|
if (isNewestPath && latestClaimUrl === undefined) {
|
|
|
|
return (
|
|
|
|
<div className="main--empty">
|
|
|
|
<Spinner delayed />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isNewestPath && latestClaimUrl) {
|
|
|
|
const params = urlParams.toString() !== '' ? `?${urlParams.toString()}` : '';
|
|
|
|
return <Redirect to={`${formatLbryUrlForWeb(latestClaimUrl)}${params}`} />;
|
|
|
|
}
|
|
|
|
|
2020-02-14 17:42:38 +01:00
|
|
|
// Don't navigate directly to repost urls
|
|
|
|
// Always redirect to the actual content
|
2022-05-09 14:26:04 +02:00
|
|
|
// Also redirect to channel page (uri) when on a non-existing latest path (live or content)
|
|
|
|
if (claim && (claim.repost_url === uri || (isNewestPath && latestClaimUrl === null))) {
|
2022-02-24 16:20:07 +01:00
|
|
|
const newUrl = formatLbryUrlForWeb(canonicalUrl);
|
2020-02-14 17:42:38 +01:00
|
|
|
return <Redirect to={newUrl} />;
|
|
|
|
}
|
2022-02-24 16:20:07 +01:00
|
|
|
|
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
|
|
|
let urlForCollectionZero;
|
2022-02-24 16:20:07 +01:00
|
|
|
if (claim && isCollection && collectionUrls && collectionUrls.length) {
|
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
|
|
|
urlForCollectionZero = collectionUrls && collectionUrls[0];
|
|
|
|
const claimId = claim.claim_id;
|
|
|
|
urlParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, claimId);
|
|
|
|
const newUrl = formatLbryUrlForWeb(`${urlForCollectionZero}?${urlParams.toString()}`);
|
|
|
|
return <Redirect to={newUrl} />;
|
|
|
|
}
|
2019-08-27 00:42:16 +02:00
|
|
|
|
2022-02-24 16:20:07 +01:00
|
|
|
if (!claim || !claim.name) {
|
2022-06-02 06:50:55 +02:00
|
|
|
const maybeIsCategoryPage = pathname.startsWith('/$/');
|
|
|
|
const waitingForCategory = maybeIsCategoryPage && !homepageFetched;
|
|
|
|
|
2022-02-24 16:20:07 +01:00
|
|
|
return (
|
2019-10-17 21:09:03 +02:00
|
|
|
<Page>
|
2022-02-24 16:20:07 +01:00
|
|
|
{(haventFetchedYet ||
|
2022-05-24 12:39:21 +02:00
|
|
|
shouldResolveUri || // covers the initial mount case where we haven't run doResolveUri, so 'isResolvingUri' is not true yet.
|
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
|
|
|
isResolvingUri ||
|
|
|
|
isResolvingCollection || // added for collection
|
2022-02-24 16:20:07 +01:00
|
|
|
(isCollection && !urlForCollectionZero)) && ( // added for collection - make sure we accept urls = []
|
2020-09-02 22:08:37 +02:00
|
|
|
<div className="main--empty">
|
2022-05-24 12:39:21 +02:00
|
|
|
<Spinner />
|
2020-09-02 22:08:37 +02:00
|
|
|
</div>
|
|
|
|
)}
|
2022-02-24 16:20:07 +01:00
|
|
|
|
2022-06-02 06:50:55 +02:00
|
|
|
{!isResolvingUri && !isSubscribed && !shouldResolveUri && !waitingForCategory && (
|
2021-03-25 07:48:29 +01:00
|
|
|
<div className="main--empty">
|
|
|
|
<Yrbl
|
2021-04-12 18:04:18 +02:00
|
|
|
title={isChannel ? __('Channel Not Found') : __('No Content Found')}
|
2021-03-25 07:48:29 +01:00
|
|
|
subtitle={
|
2021-04-12 18:04:18 +02:00
|
|
|
isChannel ? (
|
2021-04-08 23:10:39 +02:00
|
|
|
__(`Probably because you didn't make it.`)
|
|
|
|
) : (
|
|
|
|
<div className="section__actions">
|
|
|
|
<Button
|
|
|
|
button="primary"
|
|
|
|
label={__('Publish Something')}
|
2022-02-24 16:20:07 +01:00
|
|
|
onClick={() => doBeginPublish(contentName)}
|
2021-04-08 23:10:39 +02:00
|
|
|
/>
|
|
|
|
<Button
|
|
|
|
button="secondary"
|
|
|
|
label={__('Repost Something')}
|
2022-03-03 17:21:36 +01:00
|
|
|
onClick={() => doOpenModal(MODALS.REPOST, { contentName })}
|
2021-04-08 23:10:39 +02:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
)
|
2021-03-25 07:48:29 +01:00
|
|
|
}
|
|
|
|
/>
|
|
|
|
</div>
|
2020-02-05 07:14:37 +01:00
|
|
|
)}
|
2022-02-24 16:20:07 +01:00
|
|
|
|
2021-06-11 08:06:29 +02:00
|
|
|
{!isResolvingUri && isSubscribed && claim === null && (
|
|
|
|
<React.Suspense fallback={null}>
|
2022-02-24 16:20:07 +01:00
|
|
|
<AbandonedChannelPreview uri={uri} type="large" />
|
2021-06-11 08:06:29 +02:00
|
|
|
</React.Suspense>
|
|
|
|
)}
|
2019-10-17 21:09:03 +02:00
|
|
|
</Page>
|
|
|
|
);
|
2022-02-24 16:20:07 +01:00
|
|
|
}
|
2019-03-04 17:57:07 +01:00
|
|
|
|
2022-05-24 06:15:18 +02:00
|
|
|
if (geoRestriction && !claimIsMine) {
|
|
|
|
return (
|
|
|
|
<div className="main--empty">
|
|
|
|
<Yrbl
|
|
|
|
title={__(isChannel ? 'Channel unavailable' : 'Content unavailable')}
|
|
|
|
subtitle={__(geoRestriction.message || '')}
|
|
|
|
type="sad"
|
|
|
|
alwaysShow
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-02-24 16:20:07 +01:00
|
|
|
if (claim.name.length && claim.name[0] === '@') {
|
|
|
|
return <ChannelPage uri={uri} location={location} />;
|
2017-05-10 05:06:48 +02:00
|
|
|
}
|
2019-10-17 21:09:03 +02:00
|
|
|
|
2022-02-24 16:20:07 +01:00
|
|
|
if (isClaimBlackListed && !claimIsMine) {
|
|
|
|
return (
|
|
|
|
<Page className="custom-wrapper">
|
|
|
|
<Card
|
|
|
|
title={uri}
|
|
|
|
subtitle={__(
|
|
|
|
'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.'
|
|
|
|
)}
|
|
|
|
actions={
|
|
|
|
<div className="section__actions">
|
|
|
|
<Button button="link" href="https://odysee.com/@OdyseeHelp:b/copyright:f" label={__('Read More')} />
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</Page>
|
|
|
|
);
|
|
|
|
}
|
2017-05-05 08:13:06 +02:00
|
|
|
|
2022-02-24 16:20:07 +01:00
|
|
|
if (showLiveStream) {
|
|
|
|
return (
|
|
|
|
<React.Suspense fallback={null}>
|
|
|
|
<LivestreamPage uri={uri} claim={claim} />
|
|
|
|
</React.Suspense>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<React.Suspense fallback={null}>
|
Re-design comment threads (#1489)
* Redesign threadline and fetching state
- threadline goes right below channel avatar, mimicking reddits implementation, has a increase effect on hover and is slimmer, creating more space for comments on screen
- fetching state now replaces show/hide button, also mimicking reddit, and now says that it is loading, instead of a blank spinner, and also improves space a bit
* Redesign comment threads
- Allow for infinite comment chains
- Can go back and forth between the pages
- Can go back to all comments or to the first comment in the chain
- Some other improvements, which include:
- add title on non-drawer comment sections (couldn't see amount of comments)
- fix Expandable component (would begin expanded and collapse after the effect runs, which looked bad and shifted the layout, now each comments greater than the set length begins collapsed)
- used constants for consistency
* Fix replying to last thread comment
* Fix buttons condition (only on fetched comment to avoid deleted case)
* Fix auto-scroll
* Bring back instant feedback for Show More replies
* Improve thread back links
- Now going back to all comments links the top-level comment for easier navigation
- Going back to ~ previous ~ now goes back into the chain instead of topmost level
* Clear timeouts due to unrelated issue
* Fix deep thread linked comment case and more scroll improvements
* More minor changes
* Flow
* Fix commentList tile style
* Fix long channel names overflowing on small screens
* More scroll changes
* Fix threadline
* Revert "Fix long channel names overflowing on small screens"
This reverts commit e4d2dc7da5861ed8136a60f3352e41a690cd4d33.
* Fix replies fetch
* Revert "Fix replies fetch"
This reverts commit ec70054675a604a7a5f3764ba07c36bf7b0f49c8.
* Cleanup and make smooth
* Always use linked comment on threads
* Cleanup
* Higlight thread comment
* Fix comment body styles
2022-05-16 12:22:13 +02:00
|
|
|
<FilePage
|
|
|
|
uri={uri}
|
|
|
|
collectionId={collectionId}
|
|
|
|
linkedCommentId={linkedCommentId}
|
|
|
|
threadCommentId={threadCommentId}
|
|
|
|
/>
|
2022-02-24 16:20:07 +01:00
|
|
|
</React.Suspense>
|
|
|
|
);
|
|
|
|
}
|