2021-03-03 19:50:16 +01:00
|
|
|
// @flow
|
2021-12-05 04:20:24 +01:00
|
|
|
import { URL, SHARE_DOMAIN_URL } from 'config';
|
2021-03-03 19:50:16 +01:00
|
|
|
import * as ICONS from 'constants/icons';
|
2021-03-31 10:01:49 +02:00
|
|
|
import * as PAGES from 'constants/pages';
|
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
|
|
|
import * as MODALS from 'constants/modal_types';
|
2021-10-08 05:47:39 +02:00
|
|
|
import * as COLLECTIONS_CONSTS from 'constants/collections';
|
2021-03-03 19:50:16 +01:00
|
|
|
import React from 'react';
|
|
|
|
import classnames from 'classnames';
|
|
|
|
import { Menu, MenuButton, MenuList, MenuItem } from '@reach/menu-button';
|
|
|
|
import Icon from 'component/common/icon';
|
2022-01-07 20:02:33 +01:00
|
|
|
import { generateShareUrl, generateLbryContentUrl, formatLbryUrlForWeb, generateListSearchUrlParams } from 'util/url';
|
2021-03-31 10:01:49 +02:00
|
|
|
import { useHistory } from 'react-router';
|
2021-10-08 05:47:39 +02:00
|
|
|
import { buildURI, parseURI } from 'util/lbryURI';
|
2021-03-12 14:48:42 +01:00
|
|
|
|
2021-12-05 04:20:24 +01:00
|
|
|
const SHARE_DOMAIN = SHARE_DOMAIN_URL || URL;
|
2021-08-09 18:35:36 +02:00
|
|
|
const PAGE_VIEW_QUERY = 'view';
|
2021-06-11 22:49:18 +02:00
|
|
|
const EDIT_PAGE = 'edit';
|
|
|
|
|
|
|
|
type SubscriptionArgs = {
|
|
|
|
channelName: string,
|
|
|
|
uri: string,
|
|
|
|
notificationsDisabled?: boolean,
|
|
|
|
};
|
2021-03-03 19:50:16 +01:00
|
|
|
|
|
|
|
type Props = {
|
2021-03-12 14:48:42 +01:00
|
|
|
uri: string,
|
2021-03-03 19:50:16 +01:00
|
|
|
claim: ?Claim,
|
2021-06-24 16:33:11 +02:00
|
|
|
repostedClaim: ?Claim,
|
|
|
|
contentClaim: ?Claim,
|
|
|
|
contentSigningChannel: ?Claim,
|
|
|
|
contentChannelUri: string,
|
2021-06-11 22:49:18 +02:00
|
|
|
openModal: (id: string, {}) => void,
|
2021-03-03 19:50:16 +01:00
|
|
|
inline?: boolean,
|
|
|
|
channelIsMuted: boolean,
|
|
|
|
channelIsBlocked: boolean,
|
2021-06-16 04:27:58 +02:00
|
|
|
channelIsAdminBlocked: boolean,
|
|
|
|
isAdmin: boolean,
|
2021-06-11 22:49:18 +02:00
|
|
|
doChannelMute: (string) => void,
|
|
|
|
doChannelUnmute: (string) => void,
|
2021-03-03 19:50:16 +01:00
|
|
|
doCommentModBlock: (string) => void,
|
|
|
|
doCommentModUnBlock: (string) => void,
|
2022-04-17 19:04:56 +02:00
|
|
|
doCommentModBlockAsAdmin: (string, ?string, ?string) => void,
|
2021-06-16 04:27:58 +02:00
|
|
|
doCommentModUnBlockAsAdmin: (string, 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
|
|
|
doCollectionEdit: (string, any) => void,
|
|
|
|
hasClaimInWatchLater: boolean,
|
2021-08-09 18:35:36 +02:00
|
|
|
hasClaimInFavorites: 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
|
|
|
claimInCollection: boolean,
|
|
|
|
collectionId: string,
|
|
|
|
isMyCollection: boolean,
|
2021-07-09 10:01:28 +02:00
|
|
|
doToast: ({ message: string, isError?: boolean }) => void,
|
2021-06-11 22:49:18 +02:00
|
|
|
claimIsMine: boolean,
|
|
|
|
fileInfo: FileListItem,
|
|
|
|
prepareEdit: ({}, string, {}) => void,
|
|
|
|
isSubscribed: boolean,
|
|
|
|
doChannelSubscribe: (SubscriptionArgs) => void,
|
|
|
|
doChannelUnsubscribe: (SubscriptionArgs) => void,
|
2021-06-09 13:21:05 +02:00
|
|
|
isChannelPage: boolean,
|
2021-06-15 22:06:57 +02:00
|
|
|
editedCollection: Collection,
|
2021-09-02 22:05:32 +02:00
|
|
|
playNextUri: string,
|
|
|
|
resolvedList: boolean,
|
|
|
|
fetchCollectionItems: (string) => void,
|
|
|
|
doToggleShuffleList: (string) => void,
|
2022-02-23 00:00:09 +01:00
|
|
|
lastUsedCollection: ?Collection,
|
|
|
|
hasClaimInLastUsedCollection: boolean,
|
2022-02-24 18:42:00 +01:00
|
|
|
lastUsedCollectionIsNotBuiltin: boolean,
|
2021-03-03 19:50:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
function ClaimMenuList(props: Props) {
|
|
|
|
const {
|
2021-03-12 14:48:42 +01:00
|
|
|
uri,
|
2021-03-03 19:50:16 +01:00
|
|
|
claim,
|
2021-06-24 16:33:11 +02:00
|
|
|
repostedClaim,
|
|
|
|
contentClaim,
|
|
|
|
contentSigningChannel,
|
|
|
|
contentChannelUri,
|
2021-06-11 22:49:18 +02:00
|
|
|
openModal,
|
2021-03-03 19:50:16 +01:00
|
|
|
inline = false,
|
2021-06-11 22:49:18 +02:00
|
|
|
doChannelMute,
|
|
|
|
doChannelUnmute,
|
2021-03-03 19:50:16 +01:00
|
|
|
channelIsMuted,
|
|
|
|
channelIsBlocked,
|
2021-06-16 04:27:58 +02:00
|
|
|
channelIsAdminBlocked,
|
|
|
|
isAdmin,
|
2021-03-03 19:50:16 +01:00
|
|
|
doCommentModBlock,
|
|
|
|
doCommentModUnBlock,
|
2021-06-16 04:27:58 +02:00
|
|
|
doCommentModBlockAsAdmin,
|
|
|
|
doCommentModUnBlockAsAdmin,
|
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
|
|
|
doCollectionEdit,
|
|
|
|
hasClaimInWatchLater,
|
2021-08-09 18:35:36 +02:00
|
|
|
hasClaimInFavorites,
|
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,
|
|
|
|
isMyCollection,
|
|
|
|
doToast,
|
2021-06-11 22:49:18 +02:00
|
|
|
claimIsMine,
|
|
|
|
fileInfo,
|
|
|
|
prepareEdit,
|
|
|
|
isSubscribed,
|
|
|
|
doChannelSubscribe,
|
|
|
|
doChannelUnsubscribe,
|
2021-06-09 13:21:05 +02:00
|
|
|
isChannelPage = false,
|
2021-06-15 22:06:57 +02:00
|
|
|
editedCollection,
|
2021-09-02 22:05:32 +02:00
|
|
|
playNextUri,
|
|
|
|
resolvedList,
|
|
|
|
fetchCollectionItems,
|
|
|
|
doToggleShuffleList,
|
2022-02-23 00:00:09 +01:00
|
|
|
lastUsedCollection,
|
|
|
|
hasClaimInLastUsedCollection,
|
2022-02-24 18:42:00 +01:00
|
|
|
lastUsedCollectionIsNotBuiltin,
|
2021-03-03 19:50:16 +01:00
|
|
|
} = props;
|
2021-09-02 22:05:32 +02:00
|
|
|
const [doShuffle, setDoShuffle] = React.useState(false);
|
2021-06-24 16:33:11 +02:00
|
|
|
const incognitoClaim = contentChannelUri && !contentChannelUri.includes('@');
|
|
|
|
const isChannel = !incognitoClaim && !contentSigningChannel;
|
|
|
|
const { channelName } = parseURI(contentChannelUri);
|
2021-06-11 22:49:18 +02:00
|
|
|
const showDelete = claimIsMine || (fileInfo && (fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0));
|
2021-07-26 06:29:29 +02:00
|
|
|
const subscriptionLabel = repostedClaim
|
|
|
|
? isSubscribed
|
|
|
|
? __('Unfollow @%channelName%', { channelName })
|
|
|
|
: __('Follow @%channelName%', { channelName })
|
|
|
|
: isSubscribed
|
|
|
|
? __('Unfollow')
|
|
|
|
: __('Follow');
|
2021-03-31 10:01:49 +02:00
|
|
|
|
2021-06-21 14:54:59 +02:00
|
|
|
const { push, replace } = useHistory();
|
2021-09-02 22:05:32 +02:00
|
|
|
|
|
|
|
const fetchItems = React.useCallback(() => {
|
|
|
|
if (collectionId) {
|
|
|
|
fetchCollectionItems(collectionId);
|
|
|
|
}
|
|
|
|
}, [collectionId, fetchCollectionItems]);
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
if (doShuffle && resolvedList) {
|
|
|
|
doToggleShuffleList(collectionId);
|
|
|
|
if (playNextUri) {
|
2021-09-10 19:27:21 +02:00
|
|
|
const navigateUrl = formatLbryUrlForWeb(playNextUri);
|
|
|
|
push({
|
|
|
|
pathname: navigateUrl,
|
|
|
|
search: generateListSearchUrlParams(collectionId),
|
|
|
|
state: { collectionId, forceAutoplay: true },
|
|
|
|
});
|
2021-09-02 22:05:32 +02:00
|
|
|
}
|
|
|
|
}
|
2021-09-10 19:27:21 +02:00
|
|
|
}, [collectionId, doShuffle, doToggleShuffleList, playNextUri, push, resolvedList]);
|
2021-09-02 22:05:32 +02: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
|
|
|
if (!claim) {
|
|
|
|
return null;
|
|
|
|
}
|
2021-03-03 19:50:16 +01:00
|
|
|
|
2021-07-16 04:17:48 +02:00
|
|
|
const lbryUrl: string = generateLbryContentUrl(claim.canonical_url, claim.permanent_url);
|
|
|
|
const shareUrl: string = generateShareUrl(SHARE_DOMAIN, lbryUrl);
|
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 isCollectionClaim = claim && claim.value_type === 'collection';
|
|
|
|
// $FlowFixMe
|
|
|
|
const isPlayable =
|
2021-06-14 13:44:51 +02:00
|
|
|
contentClaim &&
|
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
|
|
|
// $FlowFixMe
|
2021-06-14 13:44:51 +02:00
|
|
|
contentClaim.value &&
|
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
|
|
|
// $FlowFixMe
|
2021-06-14 13:44:51 +02:00
|
|
|
contentClaim.value.stream_type &&
|
|
|
|
// $FlowFixMe
|
|
|
|
(contentClaim.value.stream_type === 'audio' || contentClaim.value.stream_type === 'video');
|
2021-03-03 19:50:16 +01:00
|
|
|
|
2021-06-24 16:33:11 +02:00
|
|
|
function handleAdd(source, name, collectionId) {
|
|
|
|
doToast({
|
|
|
|
message: source ? __('Item removed from %name%', { name }) : __('Item added to %name%', { name }),
|
|
|
|
});
|
2022-01-27 16:20:21 +01:00
|
|
|
if (contentClaim) {
|
|
|
|
doCollectionEdit(collectionId, { uris: [contentClaim.permanent_url], remove: source, type: 'playlist' });
|
|
|
|
}
|
2021-06-24 16:33:11 +02:00
|
|
|
}
|
|
|
|
|
2021-06-11 22:49:18 +02:00
|
|
|
function handleFollow() {
|
|
|
|
const subscriptionHandler = isSubscribed ? doChannelUnsubscribe : doChannelSubscribe;
|
2021-10-14 22:46:36 +02:00
|
|
|
if (channelName) {
|
|
|
|
subscriptionHandler({
|
|
|
|
channelName: '@' + channelName,
|
|
|
|
uri: contentChannelUri,
|
|
|
|
notificationsDisabled: true,
|
|
|
|
});
|
|
|
|
}
|
2021-06-11 22:49:18 +02:00
|
|
|
}
|
|
|
|
|
2021-03-03 19:50:16 +01:00
|
|
|
function handleToggleMute() {
|
2021-06-11 22:49:18 +02:00
|
|
|
if (channelIsMuted) {
|
2021-06-24 16:33:11 +02:00
|
|
|
doChannelUnmute(contentChannelUri);
|
2021-06-11 22:49:18 +02:00
|
|
|
} else {
|
2021-06-24 16:33:11 +02:00
|
|
|
doChannelMute(contentChannelUri);
|
2021-06-11 22:49:18 +02:00
|
|
|
}
|
2021-03-03 19:50:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function handleToggleBlock() {
|
|
|
|
if (channelIsBlocked) {
|
2021-06-24 16:33:11 +02:00
|
|
|
doCommentModUnBlock(contentChannelUri);
|
2021-03-03 19:50:16 +01:00
|
|
|
} else {
|
2021-06-24 16:33:11 +02:00
|
|
|
doCommentModBlock(contentChannelUri);
|
2021-03-03 19:50:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-11 22:49:18 +02:00
|
|
|
function handleEdit() {
|
|
|
|
if (!isChannel) {
|
2021-06-24 16:33:11 +02:00
|
|
|
const signingChannelName = contentSigningChannel && contentSigningChannel.name;
|
2021-06-11 22:49:18 +02:00
|
|
|
|
2021-10-14 22:46:36 +02:00
|
|
|
const uriObject: LbryUrlObj = {
|
2021-06-11 22:49:18 +02:00
|
|
|
streamName: claim.name,
|
|
|
|
streamClaimId: claim.claim_id,
|
|
|
|
};
|
|
|
|
if (signingChannelName) {
|
|
|
|
uriObject.channelName = signingChannelName;
|
|
|
|
}
|
2021-06-12 15:46:04 +02:00
|
|
|
const editUri = buildURI(uriObject);
|
2021-06-11 22:49:18 +02:00
|
|
|
|
|
|
|
push(`/$/${PAGES.UPLOAD}`);
|
|
|
|
prepareEdit(claim, editUri, fileInfo);
|
|
|
|
} else {
|
|
|
|
const channelUrl = claim.name + ':' + claim.claim_id;
|
|
|
|
push(`/${channelUrl}?${PAGE_VIEW_QUERY}=${EDIT_PAGE}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function handleDelete() {
|
2021-06-24 16:33:11 +02:00
|
|
|
if (!repostedClaim && !isChannel) {
|
|
|
|
openModal(MODALS.CONFIRM_FILE_REMOVE, { uri, doGoBack: false });
|
2021-06-11 22:49:18 +02:00
|
|
|
} else {
|
2021-06-24 16:33:11 +02:00
|
|
|
openModal(MODALS.CONFIRM_CLAIM_REVOKE, { claim, cb: isChannel && (() => replace(`/$/${PAGES.CHANNELS}`)) });
|
2021-06-11 22:49:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function handleSupport() {
|
|
|
|
openModal(MODALS.SEND_TIP, { uri, isSupport: true });
|
|
|
|
}
|
|
|
|
|
2021-06-16 04:27:58 +02:00
|
|
|
function handleToggleAdminBlock() {
|
|
|
|
if (channelIsAdminBlocked) {
|
2021-06-24 16:33:11 +02:00
|
|
|
doCommentModUnBlockAsAdmin(contentChannelUri, '');
|
2021-06-16 04:27:58 +02:00
|
|
|
} else {
|
2022-04-17 19:04:56 +02:00
|
|
|
doCommentModBlockAsAdmin(contentChannelUri, undefined, undefined);
|
2021-06-16 04:27:58 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-09 10:01:28 +02:00
|
|
|
function copyToClipboard(textToCopy, successMsg, failureMsg) {
|
|
|
|
navigator.clipboard
|
|
|
|
.writeText(textToCopy)
|
|
|
|
.then(() => {
|
|
|
|
doToast({ message: __(successMsg) });
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
doToast({ message: __(failureMsg), isError: true });
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-03-04 22:01:14 +01:00
|
|
|
function handleCopyLink() {
|
2021-07-09 10:01:28 +02:00
|
|
|
copyToClipboard(shareUrl, 'Link copied.', 'Failed to copy link.');
|
2021-03-04 22:01:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function handleReportContent() {
|
2021-06-14 13:44:51 +02:00
|
|
|
// $FlowFixMe
|
2021-06-24 16:33:11 +02:00
|
|
|
push(`/$/${PAGES.REPORT_CONTENT}?claimId=${contentClaim && contentClaim.claim_id}`);
|
2021-03-04 22:01:14 +01:00
|
|
|
}
|
|
|
|
|
2021-12-10 00:05:37 +01:00
|
|
|
// changes MenuButton behavior to show/hide MenuList not on press but on click event
|
|
|
|
let isEventSimulated = false;
|
|
|
|
const menuButtonHandler = (e) => {
|
|
|
|
if (e.key === 'Enter') {
|
|
|
|
e.preventDefault();
|
|
|
|
e.type = 'click';
|
|
|
|
}
|
|
|
|
if (!isEventSimulated && e.type === 'mousedown') {
|
|
|
|
e.preventDefault();
|
|
|
|
} else if (e.type === 'click') {
|
|
|
|
isEventSimulated = true;
|
|
|
|
e.target.dispatchEvent(new MouseEvent('mousedown', { bubbles: true }));
|
|
|
|
isEventSimulated = false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-03-03 19:50:16 +01:00
|
|
|
return (
|
|
|
|
<Menu>
|
|
|
|
<MenuButton
|
|
|
|
className={classnames('menu__button', { 'claim__menu-button': !inline, 'claim__menu-button--inline': inline })}
|
2021-12-10 00:05:37 +01:00
|
|
|
onMouseDown={menuButtonHandler}
|
2021-03-03 19:50:16 +01:00
|
|
|
onClick={(e) => {
|
|
|
|
e.stopPropagation();
|
|
|
|
e.preventDefault();
|
2021-12-10 00:05:37 +01:00
|
|
|
menuButtonHandler(e);
|
2021-03-03 19:50:16 +01:00
|
|
|
}}
|
2021-12-10 00:05:37 +01:00
|
|
|
onKeyDown={menuButtonHandler}
|
2021-03-03 19:50:16 +01:00
|
|
|
>
|
|
|
|
<Icon size={20} icon={ICONS.MORE_VERTICAL} />
|
|
|
|
</MenuButton>
|
|
|
|
<MenuList className="menu__list">
|
2021-09-10 19:27:21 +02:00
|
|
|
<>
|
|
|
|
{/* COLLECTION OPERATIONS */}
|
|
|
|
{collectionId && isCollectionClaim ? (
|
2021-06-20 11:08:10 +02:00
|
|
|
<>
|
2021-09-10 19:27:21 +02:00
|
|
|
<MenuItem className="comment__menu-option" onSelect={() => push(`/$/${PAGES.LIST}/${collectionId}`)}>
|
|
|
|
<a className="menu__link" href={`/$/${PAGES.LIST}/${collectionId}`}>
|
|
|
|
<Icon aria-hidden icon={ICONS.VIEW} />
|
|
|
|
{__('View List')}
|
|
|
|
</a>
|
|
|
|
</MenuItem>
|
|
|
|
<MenuItem
|
|
|
|
className="comment__menu-option"
|
|
|
|
onSelect={() => {
|
|
|
|
if (!resolvedList) fetchItems();
|
|
|
|
setDoShuffle(true);
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<div className="menu__link">
|
|
|
|
<Icon aria-hidden icon={ICONS.SHUFFLE} />
|
|
|
|
{__('Shuffle Play')}
|
|
|
|
</div>
|
|
|
|
</MenuItem>
|
|
|
|
{isMyCollection && (
|
2021-06-15 22:06:57 +02:00
|
|
|
<>
|
2021-09-10 19:27:21 +02:00
|
|
|
<MenuItem
|
|
|
|
className="comment__menu-option"
|
|
|
|
onSelect={() => push(`/$/${PAGES.LIST}/${collectionId}?view=edit`)}
|
|
|
|
>
|
|
|
|
<div className="menu__link">
|
|
|
|
<Icon aria-hidden iconColor={'red'} icon={ICONS.PUBLISH} />
|
|
|
|
{editedCollection ? __('Publish') : __('Edit List')}
|
|
|
|
</div>
|
2021-09-02 22:05:32 +02:00
|
|
|
</MenuItem>
|
|
|
|
<MenuItem
|
|
|
|
className="comment__menu-option"
|
2021-09-10 19:27:21 +02:00
|
|
|
onSelect={() => openModal(MODALS.COLLECTION_DELETE, { collectionId })}
|
2021-09-02 22:05:32 +02:00
|
|
|
>
|
|
|
|
<div className="menu__link">
|
2021-09-10 19:27:21 +02:00
|
|
|
<Icon aria-hidden icon={ICONS.DELETE} />
|
|
|
|
{__('Delete List')}
|
2021-06-15 22:06:57 +02:00
|
|
|
</div>
|
|
|
|
</MenuItem>
|
2021-07-14 17:53:43 +02:00
|
|
|
</>
|
|
|
|
)}
|
|
|
|
</>
|
2021-09-10 19:27:21 +02:00
|
|
|
) : (
|
|
|
|
isPlayable && (
|
|
|
|
<>
|
|
|
|
{/* WATCH LATER */}
|
|
|
|
<MenuItem
|
|
|
|
className="comment__menu-option"
|
|
|
|
onSelect={() => handleAdd(hasClaimInWatchLater, __('Watch Later'), COLLECTIONS_CONSTS.WATCH_LATER_ID)}
|
|
|
|
>
|
|
|
|
<div className="menu__link">
|
|
|
|
<Icon aria-hidden icon={hasClaimInWatchLater ? ICONS.DELETE : ICONS.TIME} />
|
|
|
|
{hasClaimInWatchLater ? __('In Watch Later') : __('Watch Later')}
|
|
|
|
</div>
|
|
|
|
</MenuItem>
|
|
|
|
{/* FAVORITES LIST */}
|
|
|
|
<MenuItem
|
|
|
|
className="comment__menu-option"
|
|
|
|
onSelect={() => handleAdd(hasClaimInFavorites, __('Favorites'), COLLECTIONS_CONSTS.FAVORITES_ID)}
|
|
|
|
>
|
|
|
|
<div className="menu__link">
|
|
|
|
<Icon aria-hidden icon={hasClaimInFavorites ? ICONS.DELETE : ICONS.STAR} />
|
|
|
|
{hasClaimInFavorites ? __('In Favorites') : __('Favorites')}
|
|
|
|
</div>
|
|
|
|
</MenuItem>
|
|
|
|
{/* CURRENTLY ONLY SUPPORT PLAYLISTS FOR PLAYABLE; LATER DIFFERENT TYPES */}
|
|
|
|
<MenuItem
|
|
|
|
className="comment__menu-option"
|
|
|
|
onSelect={() => openModal(MODALS.COLLECTION_ADD, { uri, type: 'playlist' })}
|
|
|
|
>
|
|
|
|
<div className="menu__link">
|
|
|
|
<Icon aria-hidden icon={ICONS.STACK} />
|
|
|
|
{__('Add to Lists')}
|
|
|
|
</div>
|
|
|
|
</MenuItem>
|
2022-02-24 18:42:00 +01:00
|
|
|
{lastUsedCollection && lastUsedCollectionIsNotBuiltin && (
|
2022-02-23 00:00:09 +01:00
|
|
|
<MenuItem
|
|
|
|
className="comment__menu-option"
|
|
|
|
onSelect={() =>
|
|
|
|
handleAdd(hasClaimInLastUsedCollection, lastUsedCollection.name, lastUsedCollection.id)
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<div className="menu__link">
|
|
|
|
{!hasClaimInLastUsedCollection && <Icon aria-hidden icon={ICONS.ADD} />}
|
|
|
|
{hasClaimInLastUsedCollection && <Icon aria-hidden icon={ICONS.DELETE} />}
|
|
|
|
{!hasClaimInLastUsedCollection &&
|
|
|
|
__('Add to %collection%', { collection: lastUsedCollection.name })}
|
|
|
|
{hasClaimInLastUsedCollection && __('In %collection%', { collection: lastUsedCollection.name })}
|
|
|
|
</div>
|
|
|
|
</MenuItem>
|
|
|
|
)}
|
2021-09-10 19:27:21 +02:00
|
|
|
<hr className="menu__separator" />
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
)}
|
|
|
|
</>
|
2022-01-07 20:02:33 +01:00
|
|
|
{!isChannelPage && (
|
2021-09-10 19:27:21 +02:00
|
|
|
<>
|
2022-01-07 20:02:33 +01:00
|
|
|
<MenuItem className="comment__menu-option" onSelect={handleSupport}>
|
|
|
|
<div className="menu__link">
|
|
|
|
<Icon aria-hidden icon={ICONS.LBC} />
|
|
|
|
{__('Support --[button to support a claim]--')}
|
|
|
|
</div>
|
|
|
|
</MenuItem>
|
|
|
|
</>
|
|
|
|
)}
|
2021-06-24 16:33:11 +02:00
|
|
|
|
2022-01-07 20:02:33 +01:00
|
|
|
{!incognitoClaim && !claimIsMine && !isChannelPage && (
|
|
|
|
<>
|
|
|
|
<hr className="menu__separator" />
|
|
|
|
<MenuItem className="comment__menu-option" onSelect={handleFollow}>
|
|
|
|
<div className="menu__link">
|
|
|
|
<Icon aria-hidden icon={ICONS.SUBSCRIBE} />
|
|
|
|
{subscriptionLabel}
|
|
|
|
</div>
|
|
|
|
</MenuItem>
|
|
|
|
</>
|
|
|
|
)}
|
2021-07-14 17:53:43 +02:00
|
|
|
|
2022-01-07 20:02:33 +01:00
|
|
|
{!isMyCollection && (
|
|
|
|
<>
|
|
|
|
{(!claimIsMine || channelIsBlocked) && contentChannelUri ? (
|
|
|
|
!incognitoClaim && (
|
|
|
|
<>
|
|
|
|
<hr className="menu__separator" />
|
|
|
|
<MenuItem className="comment__menu-option" onSelect={handleToggleBlock}>
|
|
|
|
<div className="menu__link">
|
|
|
|
<Icon aria-hidden icon={ICONS.BLOCK} />
|
|
|
|
{channelIsBlocked ? __('Unblock Channel') : __('Block Channel')}
|
|
|
|
</div>
|
|
|
|
</MenuItem>
|
2021-07-14 17:53:43 +02:00
|
|
|
|
2022-01-07 20:02:33 +01:00
|
|
|
{isAdmin && (
|
|
|
|
<MenuItem className="comment__menu-option" onSelect={handleToggleAdminBlock}>
|
|
|
|
<div className="menu__link">
|
|
|
|
<Icon aria-hidden icon={ICONS.GLOBE} />
|
|
|
|
{channelIsAdminBlocked ? __('Global Unblock Channel') : __('Global Block Channel')}
|
|
|
|
</div>
|
|
|
|
</MenuItem>
|
|
|
|
)}
|
2021-08-02 17:04:57 +02:00
|
|
|
|
2022-01-07 20:02:33 +01:00
|
|
|
<MenuItem className="comment__menu-option" onSelect={handleToggleMute}>
|
2021-08-02 17:04:57 +02:00
|
|
|
<div className="menu__link">
|
2022-01-07 20:02:33 +01:00
|
|
|
<Icon aria-hidden icon={ICONS.MUTE} />
|
|
|
|
{channelIsMuted ? __('Unmute Channel') : __('Mute Channel')}
|
|
|
|
</div>
|
|
|
|
</MenuItem>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
) : (
|
|
|
|
<>
|
|
|
|
{!isChannelPage && !repostedClaim && (
|
|
|
|
<MenuItem className="comment__menu-option" onSelect={handleEdit}>
|
|
|
|
<div className="menu__link">
|
|
|
|
<Icon aria-hidden icon={ICONS.EDIT} />
|
|
|
|
{__('Edit')}
|
2021-08-02 17:04:57 +02:00
|
|
|
</div>
|
|
|
|
</MenuItem>
|
|
|
|
)}
|
2021-06-12 12:56:21 +02:00
|
|
|
</>
|
2021-06-11 22:49:18 +02:00
|
|
|
)}
|
2022-01-07 20:02:33 +01:00
|
|
|
|
|
|
|
{showDelete && (
|
|
|
|
<MenuItem className="comment__menu-option" onSelect={handleDelete}>
|
|
|
|
<div className="menu__link">
|
|
|
|
<Icon aria-hidden icon={ICONS.DELETE} />
|
|
|
|
{__('Delete')}
|
|
|
|
</div>
|
|
|
|
</MenuItem>
|
|
|
|
)}
|
2021-03-03 19:50:16 +01:00
|
|
|
</>
|
|
|
|
)}
|
2022-01-07 20:02:33 +01:00
|
|
|
<hr className="menu__separator" />
|
2021-08-03 08:23:33 +02:00
|
|
|
<MenuItem className="comment__menu-option" onSelect={handleCopyLink}>
|
|
|
|
<div className="menu__link">
|
|
|
|
<Icon aria-hidden icon={ICONS.COPY_LINK} />
|
|
|
|
{__('Copy Link')}
|
|
|
|
</div>
|
|
|
|
</MenuItem>
|
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
|
|
|
{!claimIsMine && !isMyCollection && (
|
2021-03-04 22:01:14 +01:00
|
|
|
<MenuItem className="comment__menu-option" onSelect={handleReportContent}>
|
|
|
|
<div className="menu__link">
|
|
|
|
<Icon aria-hidden icon={ICONS.REPORT} />
|
|
|
|
{__('Report Content')}
|
|
|
|
</div>
|
|
|
|
</MenuItem>
|
|
|
|
)}
|
2021-03-03 19:50:16 +01:00
|
|
|
</MenuList>
|
|
|
|
</Menu>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ClaimMenuList;
|