2018-03-26 23:32:43 +02:00
|
|
|
// @flow
|
2021-04-08 23:10:39 +02:00
|
|
|
import * as PAGES from 'constants/pages';
|
2019-10-17 21:09:03 +02:00
|
|
|
import React, { useEffect } from 'react';
|
2021-04-08 23:10:39 +02:00
|
|
|
import { Redirect, useHistory } 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';
|
2020-02-14 17:42:38 +01:00
|
|
|
import { formatLbryUrlForWeb } from 'util/url';
|
2021-10-08 05:47:39 +02:00
|
|
|
import { parseURI } from 'util/lbryURI';
|
|
|
|
import * as COLLECTIONS_CONSTS from 'constants/collections';
|
2017-05-05 08:13:06 +02:00
|
|
|
|
2021-10-19 04:31:23 +02:00
|
|
|
import AbandonedChannelPreview from 'component/abandonedChannelPreview';
|
|
|
|
import FilePage from 'page/file';
|
|
|
|
import Yrbl from 'component/yrbl';
|
2021-06-11 08:06:29 +02:00
|
|
|
|
2018-03-26 23:32:43 +02:00
|
|
|
type Props = {
|
|
|
|
isResolvingUri: boolean,
|
2021-02-25 20:14:21 +01:00
|
|
|
resolveUri: (string) => void,
|
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,
|
2019-10-17 21:09:03 +02:00
|
|
|
title: string,
|
2020-07-02 18:47:36 +02:00
|
|
|
claimIsMine: boolean,
|
|
|
|
claimIsPending: boolean,
|
2021-10-13 19:34:23 +02:00
|
|
|
beginPublish: (?string) => void,
|
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,
|
|
|
|
fetchCollectionItems: (string) => void,
|
2022-08-09 17:19:23 +02:00
|
|
|
isBlacklisted: boolean,
|
|
|
|
isBlacklistedDueToDMCA: boolean,
|
|
|
|
errorCensor: ?ClaimErrorCensor,
|
2018-03-26 23:32:43 +02:00
|
|
|
};
|
|
|
|
|
2019-10-17 21:09:03 +02:00
|
|
|
function ShowPage(props: Props) {
|
2020-07-02 18:47:36 +02:00
|
|
|
const {
|
|
|
|
isResolvingUri,
|
|
|
|
resolveUri,
|
|
|
|
uri,
|
|
|
|
claim,
|
|
|
|
location,
|
|
|
|
claimIsMine,
|
|
|
|
isSubscribed,
|
|
|
|
claimIsPending,
|
2021-03-25 07:48:29 +01:00
|
|
|
beginPublish,
|
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
|
|
|
fetchCollectionItems,
|
|
|
|
collectionId,
|
|
|
|
collection,
|
|
|
|
collectionUrls,
|
|
|
|
isResolvingCollection,
|
2022-08-09 17:19:23 +02:00
|
|
|
isBlacklisted,
|
|
|
|
isBlacklistedDueToDMCA,
|
|
|
|
errorCensor,
|
2020-07-02 18:47:36 +02:00
|
|
|
} = props;
|
2021-02-25 20:14:21 +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
|
|
|
const { search } = location;
|
|
|
|
|
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;
|
2021-10-16 00:07:58 +02:00
|
|
|
const { contentName, isChannel } = parseURI(uri); // deprecated contentName - use streamName and channelName
|
2021-04-08 23:10:39 +02:00
|
|
|
const { push } = useHistory();
|
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
|
|
|
|
|
|
|
|
// changed this from 'isCollection' to resolve strangers' collections.
|
|
|
|
React.useEffect(() => {
|
|
|
|
if (collectionId && !resolvedCollection) {
|
|
|
|
fetchCollectionItems(collectionId);
|
|
|
|
}
|
|
|
|
}, [isCollection, resolvedCollection, collectionId, fetchCollectionItems]);
|
2017-05-12 01:28:43 +02:00
|
|
|
|
2019-10-17 21:09:03 +02:00
|
|
|
useEffect(() => {
|
2020-05-01 23:08:57 +02:00
|
|
|
if (
|
|
|
|
(resolveUri && !isResolvingUri && uri && haventFetchedYet) ||
|
2020-07-02 18:47:36 +02:00
|
|
|
(claimExists && !claimIsPending && (!canonicalUrl || isMine === undefined))
|
2020-05-01 23:08:57 +02:00
|
|
|
) {
|
2017-10-12 16:05:18 +02:00
|
|
|
resolveUri(uri);
|
|
|
|
}
|
2021-08-17 19:23:57 +02:00
|
|
|
}, [resolveUri, isResolvingUri, canonicalUrl, uri, claimExists, haventFetchedYet, isMine, claimIsPending, search]);
|
2020-02-03 18:23:21 +01:00
|
|
|
|
2020-02-14 17:42:38 +01:00
|
|
|
// Don't navigate directly to repost urls
|
|
|
|
// Always redirect to the actual content
|
|
|
|
// Also need to add repost_url to the Claim type for flow
|
|
|
|
// $FlowFixMe
|
|
|
|
if (claim && claim.repost_url === uri) {
|
|
|
|
const newUrl = formatLbryUrlForWeb(claim.canonical_url);
|
|
|
|
return <Redirect to={newUrl} />;
|
|
|
|
}
|
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;
|
|
|
|
if (claim && claim.value_type === 'collection' && collectionUrls && collectionUrls.length) {
|
|
|
|
urlForCollectionZero = collectionUrls && collectionUrls[0];
|
|
|
|
const claimId = claim.claim_id;
|
|
|
|
const urlParams = new URLSearchParams(search);
|
|
|
|
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
|
|
|
|
2020-02-14 17:42:38 +01:00
|
|
|
let innerContent = '';
|
2022-08-09 17:19:23 +02:00
|
|
|
if ((!claim || (claim && !claim.name)) && !isBlacklisted) {
|
2019-10-17 21:09:03 +02:00
|
|
|
innerContent = (
|
|
|
|
<Page>
|
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
|
|
|
{(claim === undefined ||
|
|
|
|
isResolvingUri ||
|
|
|
|
isResolvingCollection || // added for collection
|
|
|
|
(claim && claim.value_type === 'collection' && !urlForCollectionZero)) && ( // added for collection - make sure we accept urls = []
|
2020-09-02 22:08:37 +02:00
|
|
|
<div className="main--empty">
|
2021-03-25 07:48:29 +01:00
|
|
|
<Spinner delayed />
|
2020-09-02 22:08:37 +02:00
|
|
|
</div>
|
|
|
|
)}
|
2020-02-05 07:14:37 +01:00
|
|
|
{!isResolvingUri && !isSubscribed && (
|
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')}
|
|
|
|
onClick={() => beginPublish(contentName)}
|
|
|
|
/>
|
|
|
|
<Button
|
|
|
|
button="secondary"
|
2021-10-14 22:46:36 +02:00
|
|
|
onClick={() => push(`/$/${PAGES.REPOST_NEW}${contentName ? `?to=${contentName}` : ''}`)}
|
2021-04-08 23:10:39 +02:00
|
|
|
label={__('Repost Something')}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
)
|
2021-03-25 07:48:29 +01:00
|
|
|
}
|
|
|
|
/>
|
|
|
|
</div>
|
2020-02-05 07:14:37 +01:00
|
|
|
)}
|
2021-10-19 04:31:23 +02:00
|
|
|
{!isResolvingUri && isSubscribed && claim === null && <AbandonedChannelPreview uri={uri} type={'large'} />}
|
2019-10-17 21:09:03 +02:00
|
|
|
</Page>
|
|
|
|
);
|
2022-08-09 17:19:23 +02:00
|
|
|
} else if (claim && claim.name.length && claim.name[0] === '@') {
|
2019-10-17 21:09:03 +02:00
|
|
|
innerContent = <ChannelPage uri={uri} location={location} />;
|
2022-08-09 17:19:23 +02:00
|
|
|
} else if (isBlacklisted && !claimIsMine) {
|
|
|
|
innerContent = isBlacklistedDueToDMCA ? (
|
|
|
|
<Page>
|
|
|
|
<Card
|
|
|
|
title={uri}
|
|
|
|
subtitle={__(
|
2022-08-09 19:13:57 +02:00
|
|
|
'Your hub has blocked access to this content do to a complaint received under the US Digital Millennium Copyright Act.'
|
2022-08-09 17:19:23 +02:00
|
|
|
)}
|
|
|
|
actions={
|
|
|
|
<div className="section__actions">
|
|
|
|
<Button button="link" href="https://lbry.com/faq/dmca" label={__('Read More')} />
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</Page>
|
|
|
|
) : (
|
|
|
|
<Page>
|
|
|
|
<Card
|
|
|
|
title={uri}
|
|
|
|
subtitle={
|
|
|
|
<>
|
2022-08-09 19:13:57 +02:00
|
|
|
{__('Your hub has blocked this content because it subscribes to the following blocking channel:')}{' '}
|
2022-08-09 17:19:23 +02:00
|
|
|
<Button
|
|
|
|
button="link"
|
2022-08-09 19:13:57 +02:00
|
|
|
navigate={errorCensor && errorCensor.canonical_url}
|
2022-08-09 17:19:23 +02:00
|
|
|
label={errorCensor && errorCensor.name}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
}
|
|
|
|
/>
|
|
|
|
</Page>
|
|
|
|
);
|
2021-02-25 20:14:21 +01:00
|
|
|
} else if (claim) {
|
2022-08-09 17:19:23 +02:00
|
|
|
innerContent = <FilePage uri={uri} location={location} />;
|
2017-05-10 05:06:48 +02:00
|
|
|
}
|
2019-10-17 21:09:03 +02:00
|
|
|
|
2021-10-19 04:31:23 +02:00
|
|
|
return <React.Fragment>{innerContent}</React.Fragment>;
|
2017-05-05 08:13:06 +02:00
|
|
|
}
|
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
export default ShowPage;
|