Compare commits
2 Commits
testapi
...
wip/react-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9299bdb781 | ||
|
|
339fbb491f |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -23,12 +23,8 @@ package-lock.json
|
||||
/web/.env.defaults
|
||||
/custom/*
|
||||
/custom/homepages/*
|
||||
/custom/content/*
|
||||
!/custom/content/default.json
|
||||
!/custom/content/test.json
|
||||
!/custom/homepages/.gitkeep
|
||||
!/custom/homepages
|
||||
!/custom/content
|
||||
!/custom/homepage.example.js
|
||||
!/custom/robots.disallowall
|
||||
!/custom/robots.allowall
|
||||
|
||||
@@ -28,7 +28,6 @@ const config = {
|
||||
OG_IMAGE_URL: process.env.OG_IMAGE_URL,
|
||||
YRBL_HAPPY_IMG_URL: process.env.YRBL_HAPPY_IMG_URL,
|
||||
YRBL_SAD_IMG_URL: process.env.YRBL_SAD_IMG_URL,
|
||||
LOGIN_IMG_URL: process.env.LOGIN_IMG_URL,
|
||||
SITE_CANONICAL_URL: process.env.SITE_CANONICAL_URL,
|
||||
DEFAULT_LANGUAGE: process.env.DEFAULT_LANGUAGE,
|
||||
AUTO_FOLLOW_CHANNELS: process.env.AUTO_FOLLOW_CHANNELS,
|
||||
|
||||
38
flow-typed/Comment.js
vendored
38
flow-typed/Comment.js
vendored
@@ -15,14 +15,6 @@ declare type Comment = {
|
||||
support_amount: number,
|
||||
};
|
||||
|
||||
declare type PerChannelSettings = {
|
||||
words?: Array<string>,
|
||||
comments_enabled?: boolean,
|
||||
min_tip_amount_comment?: number,
|
||||
min_tip_amount_super_chat?: number,
|
||||
slow_mode_min_gap?: number,
|
||||
};
|
||||
|
||||
// todo: relate individual comments to their commentId
|
||||
declare type CommentsState = {
|
||||
commentsByUri: { [string]: string },
|
||||
@@ -41,9 +33,6 @@ declare type CommentsState = {
|
||||
fetchingModerationBlockList: boolean,
|
||||
blockingByUri: {},
|
||||
unBlockingByUri: {},
|
||||
settingsByChannelId: { [string]: PerChannelSettings }, // ChannelID -> settings
|
||||
fetchingSettings: boolean,
|
||||
fetchingBlockedWords: boolean,
|
||||
};
|
||||
|
||||
declare type CommentReactParams = {
|
||||
@@ -55,6 +44,7 @@ declare type CommentReactParams = {
|
||||
remove?: boolean,
|
||||
};
|
||||
|
||||
// @flow
|
||||
declare type CommentListParams = {
|
||||
page: number,
|
||||
page_size: number,
|
||||
@@ -86,29 +76,3 @@ declare type CommentCreateParams = {
|
||||
declare type SuperListParams = {};
|
||||
|
||||
declare type ModerationBlockParams = {};
|
||||
|
||||
declare type SettingsParams = {
|
||||
channel_name: string,
|
||||
channel_id: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
};
|
||||
|
||||
declare type UpdateSettingsParams = {
|
||||
channel_name: string,
|
||||
channel_id: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
comments_enabled?: boolean,
|
||||
min_tip_amount_comment?: number,
|
||||
min_tip_amount_super_chat?: number,
|
||||
slow_mode_min_gap?: number,
|
||||
}
|
||||
|
||||
declare type BlockWordParams = {
|
||||
channel_name: string,
|
||||
channel_id: string,
|
||||
signature: string,
|
||||
signing_ts: string,
|
||||
words: string, // CSV list of containing words to block comment on content
|
||||
};
|
||||
|
||||
5
flow-typed/homepage.js
vendored
5
flow-typed/homepage.js
vendored
@@ -4,12 +4,12 @@ declare type HomepageObject = {
|
||||
options: any,
|
||||
route: string,
|
||||
title: string,
|
||||
};
|
||||
}
|
||||
|
||||
declare type HomepageData = {
|
||||
[string]: HomepageObject,
|
||||
default: any => any,
|
||||
};
|
||||
}
|
||||
|
||||
declare type RowDataItem = {
|
||||
title: any,
|
||||
@@ -19,7 +19,6 @@ declare type RowDataItem = {
|
||||
extra?: any,
|
||||
options?: {
|
||||
channelIds?: Array<string>,
|
||||
limitClaimsPerChannel?: number,
|
||||
pageSize: number,
|
||||
},
|
||||
route?: string,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -54,6 +54,7 @@
|
||||
"express": "^4.17.1",
|
||||
"if-env": "^1.0.4",
|
||||
"react-datetime-picker": "^3.2.1",
|
||||
"react-top-loading-bar": "^2.0.1",
|
||||
"remove-markdown": "^0.3.0",
|
||||
"tempy": "^0.6.0",
|
||||
"videojs-logo": "^2.1.4"
|
||||
@@ -143,7 +144,7 @@
|
||||
"imagesloaded": "^4.1.4",
|
||||
"json-loader": "^0.5.4",
|
||||
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
||||
"lbry-redux": "lbryio/lbry-redux#508e8d36fd91106beb7d6b4edb9f726dae0e6264",
|
||||
"lbry-redux": "lbryio/lbry-redux#ecfcc95bebbdbe303b3ea065134457a5e168fb89",
|
||||
"lbryinc": "lbryio/lbryinc#8f9a58bfc8312a65614fd7327661cdcc502c4e59",
|
||||
"lint-staged": "^7.0.2",
|
||||
"localforage": "^1.7.1",
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
"Description of your content": "Description of your content",
|
||||
"Price": "Price",
|
||||
"Free": "Free",
|
||||
"The LBRY URL is the exact address where people find your content (ex. lbry://myvideo).": "The LBRY URL is the exact address where people find your content (ex. lbry://myvideo).",
|
||||
"Learn more": "Learn more",
|
||||
"Name": "Name",
|
||||
"Deposit": "Deposit",
|
||||
@@ -173,6 +174,7 @@
|
||||
"Yes": "Yes",
|
||||
"No": "No",
|
||||
"These search results are provided by LBRY, Inc.": "These search results are provided by LBRY, Inc.",
|
||||
"FILTER": "FILTER",
|
||||
"View file": "View file",
|
||||
"Files": "Files",
|
||||
"Channels": "Channels",
|
||||
@@ -384,11 +386,8 @@
|
||||
"Email Us": "Email Us",
|
||||
"Today": "Today",
|
||||
"All time": "All time",
|
||||
"Share on Reddit": "Share on Reddit",
|
||||
"Share on Facebook": "Share on Facebook",
|
||||
"Share On Twitter": "Share On Twitter",
|
||||
"Share on Telegram": "Share on Telegram",
|
||||
"Share via...": "Share via...",
|
||||
"View on lbry.tv": "View on lbry.tv",
|
||||
"You will receive an SMS text message confirming your phone number is valid. Does not work for Canada and possibly other regions.": "You will receive an SMS text message confirming your phone number is valid. Does not work for Canada and possibly other regions.",
|
||||
"Standard messaging rates apply. LBRY will not text or call you otherwise. Having trouble?": "Standard messaging rates apply. LBRY will not text or call you otherwise. Having trouble?",
|
||||
@@ -451,7 +450,6 @@
|
||||
"Trending": "Trending",
|
||||
"Top": "Top",
|
||||
"New": "New",
|
||||
"New --[clears Publish Form]--": "New",
|
||||
"Loading": "Loading",
|
||||
"This file is in your library.": "This file is in your library.",
|
||||
"'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.": "'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.",
|
||||
@@ -502,7 +500,6 @@
|
||||
"From --[the tip sender]--": "From",
|
||||
"From --[initial time]--": "From",
|
||||
"Not enough Credits": "Not enough Credits",
|
||||
"Decrease amount to account for transaction fee": "Decrease amount to account for transaction fee",
|
||||
"You have %credit_amount% in unclaimed rewards.": "You have %credit_amount% in unclaimed rewards.",
|
||||
"In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this channel from our applications.": "In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this channel from our applications.",
|
||||
"Read More": "Read More",
|
||||
@@ -548,6 +545,7 @@
|
||||
"Extra Verification Needed": "Extra Verification Needed",
|
||||
"We weren't able to auto-approve you for rewards. Please complete one of the steps below to unlock them.": "We weren't able to auto-approve you for rewards. Please complete one of the steps below to unlock them.",
|
||||
"Verify phone number": "Verify phone number",
|
||||
"Verify Phone Number": "Verify Phone Number",
|
||||
"OR": "OR",
|
||||
"Proof via Credit": "Proof via Credit",
|
||||
"If you have a valid credit or debit card, you can use it to instantly prove your humanity. LBRY does not store your credit card information. There is no charge at all for this, now or in the future.": "If you have a valid credit or debit card, you can use it to instantly prove your humanity. LBRY does not store your credit card information. There is no charge at all for this, now or in the future.",
|
||||
@@ -646,7 +644,7 @@
|
||||
"Claim Channels": "Claim Channels",
|
||||
"Say something about this...": "Say something about this...",
|
||||
"Update email preferences": "Update email preferences",
|
||||
"An account allows you to earn rewards and backup your data.": "An account allows you to earn rewards and backup your data.",
|
||||
"An account with lbry.tv allows you to earn rewards and backup your data.": "An account with lbry.tv allows you to earn rewards and backup your data.",
|
||||
"Backup your account and wallet data.": "Backup your account and wallet data.",
|
||||
"Sign in": "Sign in",
|
||||
"We just sent an email to %email% with a link for you to %verify_text%. Remember to check other email folders like spam or promotions.": "We just sent an email to %email% with a link for you to %verify_text%. Remember to check other email folders like spam or promotions.",
|
||||
@@ -879,6 +877,7 @@
|
||||
"Tag selection": "Tag selection",
|
||||
"Select some tags to help us show you interesting things.": "Select some tags to help us show you interesting things.",
|
||||
"You are currently following %followingCount% tags": "You are currently following %followingCount% tags",
|
||||
"You are currently following %followingCount% tag": "You are currently following %followingCount% tag",
|
||||
"Back": "Back",
|
||||
"Experimental Transcoding": "Experimental Transcoding",
|
||||
"A Folder containing FFmpeg": "A Folder containing FFmpeg",
|
||||
@@ -1064,7 +1063,6 @@
|
||||
"download the app": "download the app",
|
||||
"lbry.tv collects usage information for itself only (%more_information%).": "lbry.tv collects usage information for itself only (%more_information%).",
|
||||
"lbry.tv collects usage information for itself only (%more_information%). Want control over this and more?": "lbry.tv collects usage information for itself only (%more_information%). Want control over this and more?",
|
||||
"more --[value for \"more_information\"]--": "more",
|
||||
"%DOMAIN% performance may be degraded. You can try to use it, or wait 5 minutes and refresh. Please no crush us.": "%DOMAIN% performance may be degraded. You can try to use it, or wait 5 minutes and refresh. Please no crush us.",
|
||||
"Please %sign_in_link% to comment.": "Please %sign_in_link% to comment.",
|
||||
"Replying as %reply_channel%": "Replying as %reply_channel%",
|
||||
@@ -1151,7 +1149,6 @@
|
||||
"Update Your Password": "Update Your Password",
|
||||
"Your Wallet is Empty": "Your Wallet is Empty",
|
||||
"Buy Credits": "Buy Credits",
|
||||
"Buy/Swap Credits": "Buy/Swap Credits",
|
||||
"LBRY, Inc. partners with Moonpay to provide the option to purchase LBRY Credits. %learn_more%.": "LBRY, Inc. partners with Moonpay to provide the option to purchase LBRY Credits. %learn_more%.",
|
||||
"Earn Rewards": "Earn Rewards",
|
||||
"Rewards are currently disabled for your account. Turn on diagnostic data sharing, in %settings%, to re-enable them.": "Rewards are currently disabled for your account. Turn on diagnostic data sharing, in %settings%, to re-enable them.",
|
||||
@@ -1199,7 +1196,6 @@
|
||||
"Send a %amount% Tip": "Send a %amount% Tip",
|
||||
"Channel to show support as": "Channel to show support as",
|
||||
"Buy more LBRY Credits": "Buy more LBRY Credits",
|
||||
"Buy or swap more LBRY Credits": "Buy or swap more LBRY Credits",
|
||||
"Support this content": "Support this content",
|
||||
"Custom support amount": "Custom support amount",
|
||||
"(%lbc_balance% Credits available)": "(%lbc_balance% Credits available)",
|
||||
@@ -1385,7 +1381,6 @@
|
||||
"An account with %domain% allows you to earn rewards and backup your data.": "An account with %domain% allows you to earn rewards and backup your data.",
|
||||
"Sync my YouTube channel": "Sync my YouTube channel",
|
||||
"Log in to %SITE_NAME%": "Log in to %SITE_NAME%",
|
||||
"Log in": "Log in",
|
||||
"Not Yet": "Not Yet",
|
||||
"Preparing...": "Preparing...",
|
||||
"Confirm Upload": "Confirm Upload",
|
||||
@@ -1399,7 +1394,7 @@
|
||||
"Skip preview and confirmation": "Skip preview and confirmation",
|
||||
"Upload settings": "Upload settings",
|
||||
"Currently uploading": "Currently uploading",
|
||||
"Your files are currently uploading.": "Your files are currently uploading.",
|
||||
"You files are currently uploading.": "You files are currently uploading.",
|
||||
"Your file is currently uploading.": "Your file is currently uploading.",
|
||||
"Enable Sync": "Enable Sync",
|
||||
"Disable Sync": "Disable Sync",
|
||||
@@ -1427,8 +1422,6 @@
|
||||
"Controversial": "Controversial",
|
||||
"Show Replies": "Show Replies",
|
||||
"Unable to create comment, please try again later.": "Unable to create comment, please try again later.",
|
||||
"Unable to comment. This channel has blocked you.": "Unable to comment. This channel has blocked you.",
|
||||
"The comment contains contents that are blocked by %author%": "The comment contains contents that are blocked by %author%",
|
||||
"Your channel is still being setup, try again in a few moments.": "Your channel is still being setup, try again in a few moments.",
|
||||
"Unable to delete this comment, please try again later.": "Unable to delete this comment, please try again later.",
|
||||
"Unable to edit this comment, please try again later.": "Unable to edit this comment, please try again later.",
|
||||
@@ -1451,7 +1444,6 @@
|
||||
"Never fear though, there are tons of ways to earn %lbc%. You can earn or purchase %lbc%, or you can have your friends send you some.": "Never fear though, there are tons of ways to earn %lbc%. You can earn or purchase %lbc%, or you can have your friends send you some.",
|
||||
"gaming, comedy, educational": "gaming, comedy, educational",
|
||||
"A channel is required to comment on %SITE_NAME%": "A channel is required to comment on %SITE_NAME%",
|
||||
"A channel is required to comment on lbry.tv": "A channel is required to comment on lbry.tv",
|
||||
"A welcome bonus and thank you for your contribution to content freedom.": "A welcome bonus and thank you for your contribution to content freedom.",
|
||||
"You earned %lbc% new user reward.": "You earned %lbc% new user reward.",
|
||||
"Just press play on something. Anything at all. Yep, even that one. Everybody's doing it.": "Just press play on something. Anything at all. Yep, even that one. Everybody's doing it.",
|
||||
@@ -1521,7 +1513,7 @@
|
||||
"Free Credits?": "Free Credits?",
|
||||
"You missed out on the daily view reward, sign up for our rewards program!": "You missed out on the daily view reward, sign up for our rewards program!",
|
||||
"A Welcome 🎁": "A Welcome 🎁",
|
||||
"Receive free Credits just for doing what you're already doing": "Receive free Credits just for doing what you're already doing",
|
||||
"Receive free credits for using LBRY": "Receive free credits for using LBRY",
|
||||
"Watch more content to get to the next level.": "Watch more content to get to the next level.",
|
||||
"Follow more channels to reach the next level.": "Follow more channels to reach the next level.",
|
||||
"You need to improve the cool-aid (gain more followers) to get to the next level.": "You need to improve the cool-aid (gain more followers) to get to the next level.",
|
||||
@@ -1583,8 +1575,6 @@
|
||||
"Search only in this language by default": "Search only in this language by default",
|
||||
"This link leads to an external website.": "This link leads to an external website.",
|
||||
"No Content Found": "No Content Found",
|
||||
"No Lists Found": "No Lists Found",
|
||||
"No Reposts Found": "No Reposts Found",
|
||||
"Publish Something": "Publish Something",
|
||||
"Repost Something": "Repost Something",
|
||||
"Watch on lbry.tv": "Watch on lbry.tv",
|
||||
@@ -1671,7 +1661,8 @@
|
||||
"%balance% available.": "%balance% available.",
|
||||
"Unlock all tips": "Unlock all tips",
|
||||
"Unlock All": "Unlock All",
|
||||
"just like the simulations": "just like the simulations",
|
||||
"i got 99 securities but LBC ain't one.": "i got 99 securities but LBC ain't one.",
|
||||
"i'm a peacock, you gotta let me fly": "i'm a peacock, you gotta let me fly",
|
||||
"Moon cheese is an acquired taste": "Moon cheese is an acquired taste",
|
||||
"Nothing found here. Like big tech ethics.": "Nothing found here. Like big tech ethics.",
|
||||
"Level %current_level%": "Level %current_level%",
|
||||
@@ -1713,7 +1704,6 @@
|
||||
"Stay up to date on the latest content from your favorite creators.": "Stay up to date on the latest content from your favorite creators.",
|
||||
"Receive tutorial emails related to LBRY ": "Receive tutorial emails related to LBRY ",
|
||||
"Create A LiveStream": "Create A LiveStream",
|
||||
"%channel% has disabled chat for this stream. Enjoy the stream!": "%channel% has disabled chat for this stream. Enjoy the stream!",
|
||||
"%channel% isn't live right now, but the chat is! Check back later to watch the stream.": "%channel% isn't live right now, but the chat is! Check back later to watch the stream.",
|
||||
"Right now": "Right now",
|
||||
"%viewer_count% currently watching": "%viewer_count% currently watching",
|
||||
@@ -1870,19 +1860,6 @@
|
||||
"Law URL": "Law URL",
|
||||
"Clarification": "Clarification",
|
||||
"Client name": "Client name",
|
||||
"Creator settings": "Creator settings",
|
||||
"Muted words": "Muted words",
|
||||
"Add words": "Add words",
|
||||
"Suggestions": "Suggestions",
|
||||
"Add words to block": "Add words to block",
|
||||
"Enable comments for channel.": "Enable comments for channel.",
|
||||
"Minimum time gap in seconds for Slow Mode in livestream chat.": "Minimum time gap in seconds for Slow Mode in livestream chat.",
|
||||
"Minimum %lbc% tip amount for comments": "Minimum %lbc% tip amount for comments",
|
||||
"Enabling a minimum amount to comment will force all comments, including livestreams, to have tips associated with them. This can help prevent spam.": "Enabling a minimum amount to comment will force all comments, including livestreams, to have tips associated with them. This can help prevent spam.",
|
||||
"Minimum %lbc% tip amount for hyperchats": "Minimum %lbc% tip amount for hyperchats",
|
||||
"Enabling a minimum amount to hyperchat will force all TIPPED comments to have this value in order to be shown. This still allows regular comments to be posted.": "Enabling a minimum amount to hyperchat will force all TIPPED comments to have this value in order to be shown. This still allows regular comments to be posted.",
|
||||
"Settings unavailable for this channel": "Settings unavailable for this channel",
|
||||
"This channel isn't staking enough LBRY Credits to enable Creator Settings.": "This channel isn't staking enough LBRY Credits to enable Creator Settings.",
|
||||
"We apologize for this inconvenience, but have added this additional step to prevent abuse. Users on VPN or shared connections will continue to see this message and are not eligible for Rewards.": "We apologize for this inconvenience, but have added this additional step to prevent abuse. Users on VPN or shared connections will continue to see this message and are not eligible for Rewards.",
|
||||
"Help LBRY Save Crypto": "Help LBRY Save Crypto",
|
||||
"The US government is attempting to destroy the cryptocurrency industry. Can you help?": "The US government is attempting to destroy the cryptocurrency industry. Can you help?",
|
||||
@@ -1890,8 +1867,6 @@
|
||||
"View claim details": "View claim details",
|
||||
"Publishing...": "Publishing...",
|
||||
"Collection": "Collection",
|
||||
"Enter a name, @username or URL": "Enter a name, @username or URL:",
|
||||
"Recipient search": "Recipient search",
|
||||
"Fetch transaction data for export": "Fetch transaction data for export",
|
||||
"Fetching data": "Fetching data",
|
||||
"Download fetched file": "Download fetched file",
|
||||
@@ -1916,41 +1891,9 @@
|
||||
"Latest": "Latest",
|
||||
"Channel Not Found": "Channel Not Found",
|
||||
"Probably because you didn't make it.": "Probably because you didn't make it.",
|
||||
"Release date": "Release date",
|
||||
"Set custom release date": "Set custom release date",
|
||||
"Now": "Now",
|
||||
"Set to current date and time": "Set to current date and time",
|
||||
"Remove custom release date": "Remove custom release date",
|
||||
"%SITE_NAME% login": "%SITE_NAME% login",
|
||||
"Lists": "Lists",
|
||||
"Watch Later": "Watch Later",
|
||||
"Add to Lists": "Add to Lists",
|
||||
"Nothing in %collection_name%": "Nothing in %collection_name%",
|
||||
"Playlists": "Playlists",
|
||||
"Edit List": "Edit List",
|
||||
"Delete List": "Delete List",
|
||||
"Private": "Private",
|
||||
"View List": "View List",
|
||||
"Delete Collection": "Delete Collection",
|
||||
"Info": "Info",
|
||||
"Publishes": "Publishes",
|
||||
"Add To...": "Add To...",
|
||||
"Unpublished Edits": "Unpublished Edits",
|
||||
"Report channel": "Report channel",
|
||||
"List": "List",
|
||||
"Items": "Items",
|
||||
"Credits": "Credits",
|
||||
"MyAwesomeCollection": "MyAwesomeCollection",
|
||||
"My Awesome Collection": "My Awesome Collection",
|
||||
"This collection has no items.": "This collection has no items.",
|
||||
"Select File": "Select File",
|
||||
"File Selected": "File Selected",
|
||||
"Url": "Url",
|
||||
"URL Selected": "URL Selected",
|
||||
"Keep": "Keep",
|
||||
"Add this claim to a list": "Add this claim to a list",
|
||||
"List is Empty": "List is Empty",
|
||||
"Confirm Collection Unpublish": "Confirm Collection Unpublish",
|
||||
"This will permanently delete the list.": "This will permanently delete the list.",
|
||||
"--end--": "--end--"
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -37,10 +37,8 @@ type Analytics = {
|
||||
tagFollowEvent: (string, boolean, ?string) => void,
|
||||
playerLoadedEvent: (?boolean) => void,
|
||||
playerStartedEvent: (?boolean) => void,
|
||||
videoFetchDuration: (string, number) => void,
|
||||
videoStartEvent: (string, number) => void,
|
||||
adsFetchedEvent: () => void,
|
||||
adsReceivedEvent: (any) => void,
|
||||
adsErrorEvent: (any) => void,
|
||||
videoBufferEvent: (
|
||||
StreamClaim,
|
||||
{
|
||||
@@ -53,6 +51,9 @@ type Analytics = {
|
||||
readyState: number,
|
||||
}
|
||||
) => void,
|
||||
adsFetchedEvent: () => void,
|
||||
adsReceivedEvent: (any) => void,
|
||||
adsErrorEvent: (any) => void,
|
||||
emailProvidedEvent: () => void,
|
||||
emailVerifiedEvent: () => void,
|
||||
rewardEligibleEvent: () => void,
|
||||
@@ -196,6 +197,11 @@ const analytics: Analytics = {
|
||||
}
|
||||
},
|
||||
|
||||
videoFetchDuration: (source, duration) => {
|
||||
sendPromMetric('time_to_fetch', duration);
|
||||
sendMatomoEvent('Media', 'TimeToFetch', source, duration);
|
||||
},
|
||||
|
||||
videoStartEvent: (claimId, duration) => {
|
||||
sendPromMetric('time_to_start', duration);
|
||||
sendMatomoEvent('Media', 'TimeToStart', claimId, duration);
|
||||
|
||||
@@ -11,11 +11,6 @@ const Comments = {
|
||||
comment_list: (params: CommentListParams) => fetchCommentsApi('comment.List', params),
|
||||
comment_abandon: (params: CommentAbandonParams) => fetchCommentsApi('comment.Abandon', params),
|
||||
comment_create: (params: CommentCreateParams) => fetchCommentsApi('comment.Create', params),
|
||||
setting_list: (params: SettingsParams) => fetchCommentsApi('setting.List', params),
|
||||
setting_block_word: (params: BlockWordParams) => fetchCommentsApi('setting.BlockWord', params),
|
||||
setting_unblock_word: (params: BlockWordParams) => fetchCommentsApi('setting.UnBlockWord', params),
|
||||
setting_list_blocked_words: (params: SettingsParams) => fetchCommentsApi('setting.ListBlockedWords', params),
|
||||
setting_update: (params: UpdateSettingsParams) => fetchCommentsApi('setting.Update', params),
|
||||
super_list: (params: SuperListParams) => fetchCommentsApi('comment.SuperChatList', params),
|
||||
};
|
||||
|
||||
@@ -40,12 +35,7 @@ function fetchCommentsApi(method: string, params: {}) {
|
||||
|
||||
return fetch(url, options)
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
if (res.error) {
|
||||
throw new Error(res.error.message);
|
||||
}
|
||||
return res.result;
|
||||
});
|
||||
.then((res) => res.result);
|
||||
}
|
||||
|
||||
export default Comments;
|
||||
|
||||
@@ -5,7 +5,7 @@ import { selectGetSyncErrorMessage, selectSyncFatalError } from 'redux/selectors
|
||||
import { doFetchAccessToken, doUserSetReferrer } from 'redux/actions/user';
|
||||
import { selectUser, selectAccessToken, selectUserVerifiedEmail } from 'redux/selectors/user';
|
||||
import { selectUnclaimedRewards } from 'redux/selectors/rewards';
|
||||
import { doFetchChannelListMine, doFetchCollectionListMine, SETTINGS, selectMyChannelUrls } from 'lbry-redux';
|
||||
import { doFetchChannelListMine, selectMyChannelUrls, SETTINGS } from 'lbry-redux';
|
||||
import {
|
||||
makeSelectClientSetting,
|
||||
selectLanguage,
|
||||
@@ -52,7 +52,6 @@ const select = (state) => ({
|
||||
const perform = (dispatch) => ({
|
||||
fetchAccessToken: () => dispatch(doFetchAccessToken()),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
fetchCollectionListMine: () => dispatch(doFetchCollectionListMine()),
|
||||
setLanguage: (language) => dispatch(doSetLanguage(language)),
|
||||
signIn: () => dispatch(doSignIn()),
|
||||
requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()),
|
||||
|
||||
@@ -17,6 +17,7 @@ import usePrevious from 'effects/use-previous';
|
||||
import Nag from 'component/common/nag';
|
||||
import REWARDS from 'rewards';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
import LoadingBar from 'react-top-loading-bar';
|
||||
import FileDrop from 'component/fileDrop';
|
||||
import NagContinueFirstRun from 'component/nagContinueFirstRun';
|
||||
import Spinner from 'component/spinner';
|
||||
@@ -61,7 +62,6 @@ type Props = {
|
||||
},
|
||||
fetchAccessToken: () => void,
|
||||
fetchChannelListMine: () => void,
|
||||
fetchCollectionListMine: () => void,
|
||||
signIn: () => void,
|
||||
requestDownloadUpgrade: () => void,
|
||||
onSignedIn: () => void,
|
||||
@@ -95,7 +95,6 @@ function App(props: Props) {
|
||||
user,
|
||||
fetchAccessToken,
|
||||
fetchChannelListMine,
|
||||
fetchCollectionListMine,
|
||||
signIn,
|
||||
autoUpdateDownloaded,
|
||||
isUpgradeAvailable,
|
||||
@@ -122,6 +121,7 @@ function App(props: Props) {
|
||||
} = props;
|
||||
|
||||
const appRef = useRef();
|
||||
const loadingBarRef = useRef();
|
||||
const isEnhancedLayout = useKonamiListener();
|
||||
const [hasSignedIn, setHasSignedIn] = useState(false);
|
||||
const [readyForSync, setReadyForSync] = useState(false);
|
||||
@@ -235,9 +235,8 @@ function App(props: Props) {
|
||||
|
||||
// @if TARGET='app'
|
||||
fetchChannelListMine(); // This is fetched after a user is signed in on web
|
||||
fetchCollectionListMine();
|
||||
// @endif
|
||||
}, [appRef, fetchAccessToken, fetchChannelListMine, fetchCollectionListMine]);
|
||||
}, [appRef, fetchAccessToken, fetchChannelListMine]);
|
||||
|
||||
useEffect(() => {
|
||||
// $FlowFixMe
|
||||
@@ -384,7 +383,8 @@ function App(props: Props) {
|
||||
/>
|
||||
) : (
|
||||
<React.Fragment>
|
||||
<Router />
|
||||
<Router loadingBar={loadingBarRef} />
|
||||
{<LoadingBar ref={loadingBarRef} loaderSpeed={10} transitionTime={10} />}
|
||||
<ModalRouter />
|
||||
<FileDrop />
|
||||
<FileRenderFloating />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri, SETTINGS, COLLECTIONS_CONSTS, makeSelectNextUrlForCollectionAndUrl } from 'lbry-redux';
|
||||
import { makeSelectClaimForUri, SETTINGS } from 'lbry-redux';
|
||||
import { withRouter } from 'react-router';
|
||||
import { makeSelectIsPlayerFloating, makeSelectNextUnplayedRecommended } from 'redux/selectors/content';
|
||||
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
||||
@@ -8,24 +8,11 @@ import AutoplayCountdown from './view';
|
||||
import { selectModal } from 'redux/selectors/app';
|
||||
|
||||
/*
|
||||
AutoplayCountdown does not fetch it's own next content to play, it relies on <RecommendedContent> being rendered.
|
||||
This is dumb but I'm just the guy who noticed -kj
|
||||
AutoplayCountdown does not fetch it's own next content to play, it relies on <RecommendedContent> being rendered. This is dumb but I'm just the guy who noticed
|
||||
*/
|
||||
const select = (state, props) => {
|
||||
const { location } = props;
|
||||
const { search } = location;
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const collectionId = urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID);
|
||||
|
||||
let nextRecommendedUri;
|
||||
if (collectionId) {
|
||||
nextRecommendedUri = makeSelectNextUrlForCollectionAndUrl(collectionId, props.uri)(state);
|
||||
} else {
|
||||
nextRecommendedUri = makeSelectNextUnplayedRecommended(props.uri)(state);
|
||||
}
|
||||
|
||||
const nextRecommendedUri = makeSelectNextUnplayedRecommended(props.uri)(state);
|
||||
return {
|
||||
collectionId,
|
||||
nextRecommendedUri,
|
||||
nextRecommendedClaim: makeSelectClaimForUri(nextRecommendedUri)(state),
|
||||
isFloating: makeSelectIsPlayerFloating(props.location)(state),
|
||||
|
||||
@@ -6,19 +6,18 @@ import I18nMessage from 'component/i18nMessage';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { withRouter } from 'react-router';
|
||||
import debounce from 'util/debounce';
|
||||
import { COLLECTIONS_CONSTS } from 'lbry-redux';
|
||||
|
||||
const DEBOUNCE_SCROLL_HANDLER_MS = 150;
|
||||
const CLASSNAME_AUTOPLAY_COUNTDOWN = 'autoplay-countdown';
|
||||
|
||||
type Props = {
|
||||
history: { push: (string) => void },
|
||||
history: { push: string => void },
|
||||
nextRecommendedClaim: ?StreamClaim,
|
||||
nextRecommendedUri: string,
|
||||
isFloating: boolean,
|
||||
doSetPlayingUri: ({ uri: ?string }) => void,
|
||||
doPlayUri: (string) => void,
|
||||
doPlayUri: string => void,
|
||||
modal: { id: string, modalProps: {} },
|
||||
collectionId?: string,
|
||||
};
|
||||
|
||||
function AutoplayCountdown(props: Props) {
|
||||
@@ -30,7 +29,6 @@ function AutoplayCountdown(props: Props) {
|
||||
isFloating,
|
||||
history: { push },
|
||||
modal,
|
||||
collectionId,
|
||||
} = props;
|
||||
const nextTitle = nextRecommendedClaim && nextRecommendedClaim.value && nextRecommendedClaim.value.title;
|
||||
|
||||
@@ -46,11 +44,6 @@ function AutoplayCountdown(props: Props) {
|
||||
let navigateUrl;
|
||||
if (nextTitle) {
|
||||
navigateUrl = formatLbryUrlForWeb(nextRecommendedUri);
|
||||
if (collectionId) {
|
||||
const collectionParams = new URLSearchParams();
|
||||
collectionParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, collectionId);
|
||||
navigateUrl = navigateUrl + `?` + collectionParams.toString();
|
||||
}
|
||||
}
|
||||
|
||||
const doNavigate = useCallback(() => {
|
||||
@@ -78,7 +71,7 @@ function AutoplayCountdown(props: Props) {
|
||||
// Ensure correct 'setTimerPaused' on initial render.
|
||||
setTimerPaused(shouldPauseAutoplay());
|
||||
|
||||
const handleScroll = debounce((e) => {
|
||||
const handleScroll = debounce(e => {
|
||||
setTimerPaused(shouldPauseAutoplay());
|
||||
}, DEBOUNCE_SCROLL_HANDLER_MS);
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ type Props = {
|
||||
uri: string,
|
||||
isBlocked: boolean,
|
||||
isBlockingOrUnBlocking: boolean,
|
||||
doCommentModUnBlock: (string, boolean) => void,
|
||||
doCommentModBlock: (string, boolean) => void,
|
||||
doCommentModUnBlock: (string) => void,
|
||||
doCommentModBlock: (string) => void,
|
||||
};
|
||||
|
||||
function ChannelBlockButton(props: Props) {
|
||||
@@ -15,9 +15,9 @@ function ChannelBlockButton(props: Props) {
|
||||
|
||||
function handleClick() {
|
||||
if (isBlocked) {
|
||||
doCommentModUnBlock(uri, false);
|
||||
doCommentModUnBlock(uri);
|
||||
} else {
|
||||
doCommentModBlock(uri, false);
|
||||
doCommentModBlock(uri);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,8 @@ function ChannelBlockButton(props: Props) {
|
||||
? __('Unblocking...')
|
||||
: __('Unblock')
|
||||
: isBlockingOrUnBlocking
|
||||
? __('Blocking...')
|
||||
: __('Block')
|
||||
? __('Blocking...')
|
||||
: __('Block')
|
||||
}
|
||||
onClick={handleClick}
|
||||
/>
|
||||
|
||||
@@ -26,14 +26,12 @@ type Props = {
|
||||
channelIsBlackListed: boolean,
|
||||
defaultPageSize?: number,
|
||||
defaultInfiniteScroll?: Boolean,
|
||||
claim: Claim,
|
||||
claim: ?Claim,
|
||||
isAuthenticated: boolean,
|
||||
showMature: boolean,
|
||||
tileLayout: boolean,
|
||||
viewHiddenChannels: boolean,
|
||||
doResolveUris: (Array<string>, boolean) => void,
|
||||
claimType: string,
|
||||
empty?: string,
|
||||
};
|
||||
|
||||
function ChannelContent(props: Props) {
|
||||
@@ -51,8 +49,6 @@ function ChannelContent(props: Props) {
|
||||
tileLayout,
|
||||
viewHiddenChannels,
|
||||
doResolveUris,
|
||||
claimType,
|
||||
empty,
|
||||
} = props;
|
||||
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
|
||||
const [searchQuery, setSearchQuery] = React.useState('');
|
||||
@@ -62,7 +58,6 @@ function ChannelContent(props: Props) {
|
||||
} = useHistory();
|
||||
const url = `${pathname}${search}`;
|
||||
const claimId = claim && claim.claim_id;
|
||||
const showFilters = !claimType || claimType === 'stream';
|
||||
|
||||
function handleInputChange(e) {
|
||||
const { value } = e.target;
|
||||
@@ -135,24 +130,19 @@ function ChannelContent(props: Props) {
|
||||
|
||||
{!channelIsMine && claimsInChannel > 0 && <HiddenNsfwClaims uri={uri} />}
|
||||
|
||||
<ClaimListDiscover
|
||||
hideLivestreamClaims
|
||||
showHiddenByUser={viewHiddenChannels}
|
||||
forceShowReposts
|
||||
hideFilters={!showFilters}
|
||||
hideAdvancedFilter={!showFilters}
|
||||
tileLayout={tileLayout}
|
||||
uris={searchResults}
|
||||
streamType={CS.CONTENT_ALL}
|
||||
channelIds={[claim.claim_id]}
|
||||
claimType={claimType}
|
||||
feeAmount={CS.FEE_AMOUNT_ANY}
|
||||
defaultOrderBy={CS.ORDER_BY_NEW}
|
||||
pageSize={defaultPageSize}
|
||||
infiniteScroll={defaultInfiniteScroll}
|
||||
injectedItem={SHOW_ADS && !isAuthenticated && IS_WEB && <Ads type="video" />}
|
||||
meta={
|
||||
showFilters && (
|
||||
{claim && claimsInChannel > 0 ? (
|
||||
<ClaimListDiscover
|
||||
showHiddenByUser={viewHiddenChannels}
|
||||
forceShowReposts
|
||||
tileLayout={tileLayout}
|
||||
uris={searchResults}
|
||||
channelIds={[claim.claim_id]}
|
||||
feeAmount={CS.FEE_AMOUNT_ANY}
|
||||
defaultOrderBy={CS.ORDER_BY_NEW}
|
||||
pageSize={defaultPageSize}
|
||||
infiniteScroll={defaultInfiniteScroll}
|
||||
injectedItem={SHOW_ADS && !isAuthenticated && IS_WEB && <Ads type="video" />}
|
||||
meta={
|
||||
<Form onSubmit={() => {}} className="wunderbar--inline">
|
||||
<Icon icon={ICONS.SEARCH} />
|
||||
<FormField
|
||||
@@ -163,12 +153,13 @@ function ChannelContent(props: Props) {
|
||||
placeholder={__('Search')}
|
||||
/>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
isChannel
|
||||
channelIsMine={channelIsMine}
|
||||
empty={empty}
|
||||
/>
|
||||
}
|
||||
isChannel
|
||||
channelIsMine={channelIsMine}
|
||||
/>
|
||||
) : (
|
||||
<section className="main--empty">{__("This channel hasn't published anything yet")}</section>
|
||||
)}
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import LbcSymbol from 'component/common/lbc-symbol';
|
||||
import SUPPORTED_LANGUAGES from 'constants/supported_languages';
|
||||
import WalletSpendableBalanceHelp from 'component/walletSpendableBalanceHelp';
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
import { sortLanguageMap } from 'util/default-languages';
|
||||
|
||||
const LANG_NONE = 'none';
|
||||
|
||||
@@ -362,7 +361,6 @@ function ChannelForm(props: Props) {
|
||||
<TagsSearch
|
||||
suggestMature={!SIMPLE_SITE}
|
||||
disableAutoFocus
|
||||
disableControlTags
|
||||
limitSelect={MAX_TAG_SELECT}
|
||||
tagsPassedIn={params.tags || []}
|
||||
label={__('Selected Tags')}
|
||||
@@ -417,9 +415,9 @@ function ChannelForm(props: Props) {
|
||||
<option key={'pri-langNone'} value={LANG_NONE}>
|
||||
{__('None selected')}
|
||||
</option>
|
||||
{sortLanguageMap(SUPPORTED_LANGUAGES).map(([langKey, langName]) => (
|
||||
<option key={langKey} value={langKey}>
|
||||
{langName}
|
||||
{Object.keys(SUPPORTED_LANGUAGES).map((language) => (
|
||||
<option key={language} value={language}>
|
||||
{SUPPORTED_LANGUAGES[language]}
|
||||
</option>
|
||||
))}
|
||||
</FormField>
|
||||
@@ -435,11 +433,13 @@ function ChannelForm(props: Props) {
|
||||
<option key={'sec-langNone'} value={LANG_NONE}>
|
||||
{__('None selected')}
|
||||
</option>
|
||||
{sortLanguageMap(SUPPORTED_LANGUAGES).map(([langKey, langName]) => (
|
||||
<option key={langKey} value={langKey} disabled={langKey === languageParam[0]}>
|
||||
{langName}
|
||||
</option>
|
||||
))}
|
||||
{Object.keys(SUPPORTED_LANGUAGES)
|
||||
.filter((lang) => lang !== languageParam[0])
|
||||
.map((language) => (
|
||||
<option key={language} value={language}>
|
||||
{SUPPORTED_LANGUAGES[language]}
|
||||
</option>
|
||||
))}
|
||||
</FormField>
|
||||
</>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doChannelMute, doChannelUnmute } from 'redux/actions/blocked';
|
||||
import { doToggleMuteChannel } from 'redux/actions/blocked';
|
||||
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
||||
import ChannelMuteButton from './view';
|
||||
|
||||
@@ -8,6 +8,5 @@ const select = (state, props) => ({
|
||||
});
|
||||
|
||||
export default connect(select, {
|
||||
doChannelMute,
|
||||
doChannelUnmute,
|
||||
doToggleMuteChannel,
|
||||
})(ChannelMuteButton);
|
||||
|
||||
@@ -6,26 +6,17 @@ type Props = {
|
||||
uri: string,
|
||||
isMuted: boolean,
|
||||
channelClaim: ?ChannelClaim,
|
||||
doChannelMute: (string, boolean) => void,
|
||||
doChannelUnmute: (string, boolean) => void,
|
||||
doToggleMuteChannel: (string) => void,
|
||||
};
|
||||
|
||||
function ChannelBlockButton(props: Props) {
|
||||
const { uri, doChannelMute, doChannelUnmute, isMuted } = props;
|
||||
|
||||
function handleClick() {
|
||||
if (isMuted) {
|
||||
doChannelUnmute(uri, false);
|
||||
} else {
|
||||
doChannelMute(uri, false);
|
||||
}
|
||||
}
|
||||
const { uri, doToggleMuteChannel, isMuted } = props;
|
||||
|
||||
return (
|
||||
<Button
|
||||
button={isMuted ? 'alt' : 'secondary'}
|
||||
label={isMuted ? __('Unmute') : __('Mute')}
|
||||
onClick={handleClick}
|
||||
onClick={() => doToggleMuteChannel(uri)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 120 B |
@@ -2,8 +2,7 @@
|
||||
import React from 'react';
|
||||
import { parseURI } from 'lbry-redux';
|
||||
import classnames from 'classnames';
|
||||
import Spaceman from './spaceman.png';
|
||||
import Transparent from './transparent_1x1.png';
|
||||
import Gerbil from './gerbil.png';
|
||||
import FreezeframeWrapper from 'component/fileThumbnail/FreezeframeWrapper';
|
||||
import ChannelStakedIndicator from 'component/channelStakedIndicator';
|
||||
import { getThumbnailCdnUrl } from 'util/thumbnail';
|
||||
@@ -100,8 +99,7 @@ function ChannelThumbnail(props: Props) {
|
||||
ref={thumbnailRef}
|
||||
alt={__('Channel profile picture')}
|
||||
className="channel-thumbnail__default"
|
||||
data-src={!thumbError && url ? url : Spaceman}
|
||||
src={Transparent}
|
||||
data-src={!thumbError && url ? url : Gerbil}
|
||||
onError={() => setThumbError(true)} // if thumb fails (including due to https replace, show gerbil.
|
||||
/>
|
||||
)}
|
||||
@@ -114,8 +112,7 @@ function ChannelThumbnail(props: Props) {
|
||||
ref={thumbnailRef}
|
||||
alt={__('Channel profile picture')}
|
||||
className="channel-thumbnail__custom"
|
||||
data-src={!thumbError && url ? url : Spaceman}
|
||||
src={Transparent}
|
||||
data-src={!thumbError && url ? url : Gerbil}
|
||||
onError={() => setThumbError(true)} // if thumb fails (including due to https replace, show gerbil.
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -6,22 +6,13 @@ import Button from 'component/button';
|
||||
|
||||
type Props = {
|
||||
doOpenModal: (string, {}) => void,
|
||||
claim: Claim,
|
||||
abandonActionCallback: (any) => void,
|
||||
claim: StreamClaim,
|
||||
abandonActionCallback: any => void,
|
||||
iconSize: number,
|
||||
};
|
||||
|
||||
export default function ClaimAbandonButton(props: Props) {
|
||||
const { doOpenModal, claim, abandonActionCallback } = props;
|
||||
const { value_type } = claim || {};
|
||||
let buttonLabel;
|
||||
if (value_type === 'channel') {
|
||||
buttonLabel = __('Delete Channel');
|
||||
} else if (value_type === 'collection') {
|
||||
buttonLabel = __('Delete List');
|
||||
} else if (value_type === 'stream') {
|
||||
buttonLabel = __('Delete Publish');
|
||||
}
|
||||
|
||||
function abandonClaim() {
|
||||
doOpenModal(MODALS.CONFIRM_CLAIM_REVOKE, { claim: claim, cb: abandonActionCallback });
|
||||
@@ -30,7 +21,7 @@ export default function ClaimAbandonButton(props: Props) {
|
||||
return (
|
||||
<Button
|
||||
disabled={!claim}
|
||||
label={buttonLabel}
|
||||
label={__('Delete Channel')}
|
||||
button="alt"
|
||||
iconColor="red"
|
||||
icon={ICONS.DELETE}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import ClaimCollectionAdd from './view';
|
||||
import { withRouter } from 'react-router';
|
||||
import {
|
||||
makeSelectClaimForUri,
|
||||
doLocalCollectionCreate,
|
||||
selectBuiltinCollections,
|
||||
selectMyPublishedCollections,
|
||||
selectMyUnpublishedCollections,
|
||||
} from 'lbry-redux';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
builtin: selectBuiltinCollections(state),
|
||||
published: selectMyPublishedCollections(state),
|
||||
unpublished: selectMyUnpublishedCollections(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
addCollection: (name, items, type) => dispatch(doLocalCollectionCreate(name, items, type)),
|
||||
});
|
||||
|
||||
export default withRouter(connect(select, perform)(ClaimCollectionAdd));
|
||||
@@ -1,148 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import type { ElementRef } from 'react';
|
||||
import Button from 'component/button';
|
||||
import Card from 'component/common/card';
|
||||
import { FormField } from 'component/common/form';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import CollectionSelectItem from 'component/collectionSelectItem';
|
||||
|
||||
type Props = {
|
||||
claim: Claim,
|
||||
builtin: any,
|
||||
published: any,
|
||||
unpublished: any,
|
||||
addCollection: (string, Array<string>, string) => void,
|
||||
closeModal: () => void,
|
||||
uri: string,
|
||||
};
|
||||
|
||||
const ClaimCollectionAdd = (props: Props) => {
|
||||
const { builtin, published, unpublished, addCollection, claim, closeModal, uri } = props;
|
||||
const buttonref: ElementRef<any> = React.useRef();
|
||||
const permanentUrl = claim && claim.permanent_url;
|
||||
const isChannel = claim && claim.value_type === 'channel';
|
||||
|
||||
const [addNewCollection, setAddNewCollection] = React.useState(false);
|
||||
const [newCollectionName, setNewCollectionName] = React.useState('');
|
||||
|
||||
// TODO: when other collection types added, filter list in context
|
||||
// const isPlayable =
|
||||
// claim &&
|
||||
// claim.value &&
|
||||
// // $FlowFixMe
|
||||
// claim.value.stream_type &&
|
||||
// (claim.value.stream_type === 'audio' || claim.value.stream_type === 'video');
|
||||
|
||||
function handleNameInput(e) {
|
||||
const { value } = e.target;
|
||||
setNewCollectionName(value);
|
||||
}
|
||||
|
||||
function handleAddCollection() {
|
||||
addCollection(newCollectionName, [permanentUrl], isChannel ? 'collection' : 'playlist');
|
||||
setNewCollectionName('');
|
||||
setAddNewCollection(false);
|
||||
}
|
||||
|
||||
function altEnterListener(e: SyntheticKeyboardEvent<*>) {
|
||||
const KEYCODE_ENTER = 13;
|
||||
if (e.keyCode === KEYCODE_ENTER) {
|
||||
e.preventDefault();
|
||||
buttonref.current.click();
|
||||
}
|
||||
}
|
||||
|
||||
function onTextareaFocus() {
|
||||
window.addEventListener('keydown', altEnterListener);
|
||||
}
|
||||
|
||||
function onTextareaBlur() {
|
||||
window.removeEventListener('keydown', altEnterListener);
|
||||
}
|
||||
|
||||
function handleClearNew() {
|
||||
setNewCollectionName('');
|
||||
setAddNewCollection(false);
|
||||
}
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={__('Add To...')}
|
||||
actions={
|
||||
<div className="card__body">
|
||||
{uri && (
|
||||
<fieldset-section>
|
||||
<div className={'card__body-scrollable'}>
|
||||
{(Object.values(builtin): any)
|
||||
// $FlowFixMe
|
||||
.filter((list) => (isChannel ? list.type === 'collection' : list.type === 'playlist'))
|
||||
.map((l) => {
|
||||
const { id } = l;
|
||||
return <CollectionSelectItem claim={claim} collectionId={id} uri={permanentUrl} key={id} category={'builtin'} />;
|
||||
})}
|
||||
{unpublished &&
|
||||
(Object.values(unpublished): any)
|
||||
// $FlowFixMe
|
||||
.filter((list) => (isChannel ? list.type === 'collection' : list.type === 'playlist'))
|
||||
.map((l) => {
|
||||
const { id } = l;
|
||||
return (
|
||||
<CollectionSelectItem claim={claim} collectionId={id} uri={permanentUrl} key={id} category={'unpublished'} />
|
||||
);
|
||||
})}
|
||||
{published &&
|
||||
(Object.values(published): any).map((l) => {
|
||||
// $FlowFixMe
|
||||
const { id } = l;
|
||||
return (
|
||||
<CollectionSelectItem claim={claim} collectionId={id} uri={permanentUrl} key={id} category={'published'} />
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</fieldset-section>
|
||||
)}
|
||||
<fieldset-section>
|
||||
{addNewCollection && (
|
||||
<FormField
|
||||
autoFocus
|
||||
type="text"
|
||||
name="new_collection"
|
||||
value={newCollectionName}
|
||||
label={'New List Title'}
|
||||
onFocus={onTextareaFocus}
|
||||
onBlur={onTextareaBlur}
|
||||
inputButton={
|
||||
<>
|
||||
<Button
|
||||
button={'alt'}
|
||||
icon={ICONS.ADD}
|
||||
className={'button-toggle'}
|
||||
disabled={!newCollectionName.length}
|
||||
onClick={() => handleAddCollection()}
|
||||
ref={buttonref}
|
||||
/>
|
||||
<Button
|
||||
button={'alt'}
|
||||
className={'button-toggle'}
|
||||
icon={ICONS.REMOVE}
|
||||
onClick={() => handleClearNew()}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
onChange={handleNameInput}
|
||||
/>
|
||||
)}
|
||||
{!addNewCollection && (
|
||||
<Button button={'link'} label={'New List'} onClick={() => setAddNewCollection(true)} />
|
||||
)}
|
||||
</fieldset-section>
|
||||
<div className="card__actions">
|
||||
<Button button="secondary" label={__('Done')} disabled={addNewCollection} onClick={closeModal} />
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
);
|
||||
};
|
||||
export default ClaimCollectionAdd;
|
||||
@@ -1,12 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import PlaylistAddButton from './view';
|
||||
import { makeSelectClaimForUri } from 'lbry-redux';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
});
|
||||
|
||||
export default connect(select, {
|
||||
doOpenModal,
|
||||
})(PlaylistAddButton);
|
||||
@@ -1,40 +0,0 @@
|
||||
// @flow
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import classnames from 'classnames';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
doOpenModal: (string, {}) => void,
|
||||
fileAction?: boolean,
|
||||
type?: boolean,
|
||||
claim: Claim,
|
||||
};
|
||||
|
||||
export default function CollectionAddButton(props: Props) {
|
||||
const { doOpenModal, uri, fileAction, type = 'playlist', claim } = props;
|
||||
|
||||
// $FlowFixMe
|
||||
const streamType = (claim && claim.value && claim.value.stream_type) || '';
|
||||
const isPlayable = streamType === 'video' || streamType === 'audio';
|
||||
|
||||
if (!isPlayable) return null;
|
||||
return (
|
||||
<Button
|
||||
button={fileAction ? undefined : 'alt'}
|
||||
className={classnames({ 'button--file-action': fileAction })}
|
||||
icon={fileAction ? ICONS.ADD : ICONS.LIBRARY}
|
||||
iconSize={fileAction ? 22 : undefined}
|
||||
label={uri ? __('Save') : 'New List'}
|
||||
requiresAuth={IS_WEB}
|
||||
title={__('Add this claim to a list')}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
doOpenModal(MODALS.COLLECTION_ADD, { uri, type });
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -9,4 +9,6 @@ const select = (state) => ({
|
||||
claimsByUri: selectClaimsByUri(state),
|
||||
});
|
||||
|
||||
export default connect(select)(ClaimList);
|
||||
const perform = (dispatch) => ({});
|
||||
|
||||
export default connect(select, perform)(ClaimList);
|
||||
|
||||
@@ -44,8 +44,7 @@ type Props = {
|
||||
liveLivestreamsFirst?: boolean,
|
||||
livestreamMap?: { [string]: any },
|
||||
searchOptions?: any,
|
||||
collectionId?: string,
|
||||
hideLivestreamClaims?: boolean,
|
||||
channelIsMine: boolean,
|
||||
};
|
||||
|
||||
export default function ClaimList(props: Props) {
|
||||
@@ -76,8 +75,7 @@ export default function ClaimList(props: Props) {
|
||||
liveLivestreamsFirst,
|
||||
livestreamMap,
|
||||
searchOptions,
|
||||
collectionId,
|
||||
hideLivestreamClaims,
|
||||
channelIsMine,
|
||||
} = props;
|
||||
|
||||
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
|
||||
@@ -136,8 +134,7 @@ export default function ClaimList(props: Props) {
|
||||
showHiddenByUser={showHiddenByUser}
|
||||
properties={renderProperties}
|
||||
live={resolveLive(index)}
|
||||
collectionId={collectionId}
|
||||
hideLivestreamClaims={hideLivestreamClaims}
|
||||
channelIsMine={channelIsMine}
|
||||
/>
|
||||
))}
|
||||
{!timedOut && urisLength === 0 && !loading && <div className="empty main--empty">{empty || noResultMsg}</div>}
|
||||
@@ -197,8 +194,6 @@ export default function ClaimList(props: Props) {
|
||||
renderActions={renderActions}
|
||||
showUserBlocked={showHiddenByUser}
|
||||
showHiddenByUser={showHiddenByUser}
|
||||
collectionId={collectionId}
|
||||
hideLivestreamClaims={hideLivestreamClaims}
|
||||
customShouldHide={(claim: StreamClaim) => {
|
||||
// Hack to hide spee.ch thumbnail publishes
|
||||
// If it meets these requirements, it was probably uploaded here:
|
||||
|
||||
@@ -72,11 +72,8 @@ type Props = {
|
||||
liveLivestreamsFirst?: boolean,
|
||||
livestreamMap?: { [string]: any },
|
||||
hasSource?: boolean,
|
||||
limitClaimsPerChannel?: number,
|
||||
releaseTime?: string,
|
||||
hideLivestreamClaims?: boolean,
|
||||
isChannel?: boolean,
|
||||
empty?: string,
|
||||
channelIsMine?: boolean,
|
||||
};
|
||||
|
||||
function ClaimListDiscover(props: Props) {
|
||||
@@ -106,8 +103,8 @@ function ClaimListDiscover(props: Props) {
|
||||
claimType,
|
||||
pageSize,
|
||||
defaultClaimType,
|
||||
streamType = CS.FILE_VIDEO,
|
||||
defaultStreamType = CS.FILE_VIDEO,
|
||||
streamType,
|
||||
defaultStreamType,
|
||||
freshness,
|
||||
defaultFreshness = CS.FRESH_WEEK,
|
||||
renderProperties,
|
||||
@@ -126,16 +123,13 @@ function ClaimListDiscover(props: Props) {
|
||||
forceShowReposts = false,
|
||||
languageSetting,
|
||||
searchInLanguage,
|
||||
limitClaimsPerChannel,
|
||||
releaseTime,
|
||||
scrollAnchor,
|
||||
showHiddenByUser = false,
|
||||
liveLivestreamsFirst,
|
||||
livestreamMap,
|
||||
hasSource,
|
||||
isChannel = false,
|
||||
hideLivestreamClaims,
|
||||
empty,
|
||||
channelIsMine = false,
|
||||
} = props;
|
||||
const didNavigateForward = history.action === 'PUSH';
|
||||
const { search } = location;
|
||||
@@ -174,12 +168,12 @@ function ClaimListDiscover(props: Props) {
|
||||
const durationParam = urlParams.get(CS.DURATION_KEY) || null;
|
||||
const channelIdsInUrl = urlParams.get(CS.CHANNEL_IDS_KEY);
|
||||
const channelIdsParam = channelIdsInUrl ? channelIdsInUrl.split(',') : channelIds;
|
||||
const feeAmountParam = urlParams.get('fee_amount') || feeAmount || CS.FEE_AMOUNT_ONLY_FREE;
|
||||
const feeAmountParam = urlParams.get('fee_amount') || feeAmount;
|
||||
const originalPageSize = pageSize || CS.PAGE_SIZE;
|
||||
const dynamicPageSize = isLargeScreen ? Math.ceil(originalPageSize * (3 / 2)) : originalPageSize;
|
||||
const historyAction = history.action;
|
||||
|
||||
let orderParam = orderBy || urlParams.get(CS.ORDER_BY_KEY) || defaultOrderBy || orderParamEntry;
|
||||
let orderParam = orderBy || urlParams.get(CS.ORDER_BY_KEY) || defaultOrderBy;
|
||||
|
||||
if (!orderParam) {
|
||||
if (historyAction === 'POP') {
|
||||
@@ -223,7 +217,6 @@ function ClaimListDiscover(props: Props) {
|
||||
fee_amount?: string,
|
||||
has_source?: boolean,
|
||||
has_no_source?: boolean,
|
||||
limit_claims_per_channel?: number,
|
||||
} = {
|
||||
page_size: dynamicPageSize,
|
||||
page,
|
||||
@@ -246,10 +239,6 @@ function ClaimListDiscover(props: Props) {
|
||||
options.has_source = true;
|
||||
}
|
||||
|
||||
if (limitClaimsPerChannel) {
|
||||
options.limit_claims_per_channel = limitClaimsPerChannel;
|
||||
}
|
||||
|
||||
if (feeAmountParam && claimType !== CS.CLAIM_CHANNEL) {
|
||||
options.fee_amount = feeAmountParam;
|
||||
}
|
||||
@@ -279,10 +268,7 @@ function ClaimListDiscover(props: Props) {
|
||||
options.reposted_claim_id = repostedClaimId;
|
||||
}
|
||||
|
||||
// IF release time, set it, else set fallback release times using the hack below.
|
||||
if (releaseTime) {
|
||||
options.release_time = releaseTime;
|
||||
} else if (claimType !== CS.CLAIM_CHANNEL) {
|
||||
if (claimType !== CS.CLAIM_CHANNEL) {
|
||||
if (orderParam === CS.ORDER_BY_TOP && freshnessParam !== CS.FRESH_ALL) {
|
||||
options.release_time = `>${Math.floor(moment().subtract(1, freshnessParam).startOf('hour').unix())}`;
|
||||
} else if (orderParam === CS.ORDER_BY_NEW || orderParam === CS.ORDER_BY_TRENDING) {
|
||||
@@ -360,25 +346,9 @@ function ClaimListDiscover(props: Props) {
|
||||
|
||||
const hasMatureTags = tagsParam && tagsParam.split(',').some((t) => MATURE_TAGS.includes(t));
|
||||
const claimSearchCacheQuery = createNormalizedClaimSearchKey(options);
|
||||
let claimSearchResult = claimSearchByQuery[claimSearchCacheQuery];
|
||||
const claimSearchResult = claimSearchByQuery[claimSearchCacheQuery];
|
||||
const claimSearchResultLastPageReached = claimSearchByQueryLastPageReached[claimSearchCacheQuery];
|
||||
|
||||
// uncomment to fix an item on a page
|
||||
// const fixUri = 'lbry://@corbettreport#0/lbryodysee#5';
|
||||
// if (
|
||||
// orderParam === CS.ORDER_BY_NEW &&
|
||||
// claimSearchResult &&
|
||||
// claimSearchResult.length > 2 &&
|
||||
// window.location.pathname === '/$/rabbithole'
|
||||
// ) {
|
||||
// if (claimSearchResult.indexOf(fixUri) !== -1) {
|
||||
// claimSearchResult.splice(claimSearchResult.indexOf(fixUri), 1);
|
||||
// } else {
|
||||
// claimSearchResult.pop();
|
||||
// }
|
||||
// claimSearchResult.splice(2, 0, fixUri);
|
||||
// }
|
||||
|
||||
const [prevOptions, setPrevOptions] = React.useState(null);
|
||||
|
||||
if (!isJustScrollingToNewPage(prevOptions, options)) {
|
||||
@@ -502,7 +472,7 @@ function ClaimListDiscover(props: Props) {
|
||||
claimType={claimType}
|
||||
streamType={streamType}
|
||||
defaultStreamType={defaultStreamType}
|
||||
// feeAmount={feeAmount}
|
||||
feeAmount={feeAmount}
|
||||
orderBy={orderBy}
|
||||
defaultOrderBy={defaultOrderBy}
|
||||
hideAdvancedFilter={hideAdvancedFilter}
|
||||
@@ -542,8 +512,7 @@ function ClaimListDiscover(props: Props) {
|
||||
liveLivestreamsFirst={liveLivestreamsFirst}
|
||||
livestreamMap={livestreamMap}
|
||||
searchOptions={options}
|
||||
hideLivestreamClaims={hideLivestreamClaims}
|
||||
empty={empty}
|
||||
channelIsMine={channelIsMine}
|
||||
/>
|
||||
{loading && (
|
||||
<div className="claim-grid">
|
||||
@@ -577,8 +546,6 @@ function ClaimListDiscover(props: Props) {
|
||||
liveLivestreamsFirst={liveLivestreamsFirst}
|
||||
livestreamMap={livestreamMap}
|
||||
searchOptions={options}
|
||||
hideLivestreamClaims={hideLivestreamClaims}
|
||||
empty={empty}
|
||||
/>
|
||||
{loading &&
|
||||
new Array(dynamicPageSize)
|
||||
|
||||
@@ -29,7 +29,7 @@ type Props = {
|
||||
channelIds?: Array<string>,
|
||||
tileLayout: boolean,
|
||||
doSetClientSetting: (string, boolean, ?boolean) => void,
|
||||
setPage: (number) => void,
|
||||
setPage: number => void,
|
||||
hideFilters: boolean,
|
||||
searchInLanguage: boolean,
|
||||
languageSetting: string,
|
||||
@@ -74,7 +74,7 @@ function ClaimListHeader(props: Props) {
|
||||
const channelIdsInUrl = urlParams.get(CS.CHANNEL_IDS_KEY);
|
||||
const channelIdsParam = channelIdsInUrl ? channelIdsInUrl.split(',') : channelIds;
|
||||
const feeAmountParam = urlParams.get('fee_amount') || feeAmount || CS.FEE_AMOUNT_ANY;
|
||||
const showDuration = !(claimType && claimType === CS.CLAIM_CHANNEL && claimType === CS.CLAIM_COLLECTION);
|
||||
const showDuration = !(claimType && claimType === CS.CLAIM_CHANNEL);
|
||||
const isFiltered = () =>
|
||||
Boolean(
|
||||
urlParams.get(CS.FRESH_KEY) ||
|
||||
@@ -144,7 +144,7 @@ function ClaimListHeader(props: Props) {
|
||||
|
||||
function buildUrl(delta) {
|
||||
const newUrlParams = new URLSearchParams(location.search);
|
||||
CS.KEYS.forEach((k) => {
|
||||
CS.KEYS.forEach(k => {
|
||||
// $FlowFixMe get() can return null
|
||||
if (urlParams.get(k) !== null) newUrlParams.set(k, urlParams.get(k));
|
||||
});
|
||||
@@ -161,11 +161,7 @@ function ClaimListHeader(props: Props) {
|
||||
}
|
||||
break;
|
||||
case CS.CONTENT_KEY:
|
||||
if (
|
||||
delta.value === CS.CLAIM_CHANNEL ||
|
||||
delta.value === CS.CLAIM_REPOST ||
|
||||
delta.value === CS.CLAIM_COLLECTION
|
||||
) {
|
||||
if (delta.value === CS.CLAIM_CHANNEL || delta.value === CS.CLAIM_REPOST) {
|
||||
newUrlParams.delete(CS.DURATION_KEY);
|
||||
newUrlParams.set(CS.CONTENT_KEY, delta.value);
|
||||
} else if (delta.value === CS.CONTENT_ALL) {
|
||||
@@ -216,13 +212,13 @@ function ClaimListHeader(props: Props) {
|
||||
<>
|
||||
<div className="claim-search__wrapper">
|
||||
<div className="claim-search__top">
|
||||
{!hideFilters && (
|
||||
<div className="claim-search__menu-group">
|
||||
{CS.ORDER_BY_TYPES.map((type) => (
|
||||
<div className="claim-search__menu-group">
|
||||
{!hideFilters &&
|
||||
CS.ORDER_BY_TYPES.map(type => (
|
||||
<Button
|
||||
key={type}
|
||||
button="alt"
|
||||
onClick={(e) =>
|
||||
onClick={e =>
|
||||
handleChange({
|
||||
key: CS.ORDER_BY_KEY,
|
||||
value: type,
|
||||
@@ -237,8 +233,8 @@ function ClaimListHeader(props: Props) {
|
||||
label={__(toCapitalCase(type))}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="claim-search__menu-group">
|
||||
{!hideAdvancedFilter && !SIMPLE_SITE && (
|
||||
<Button
|
||||
@@ -280,23 +276,21 @@ function ClaimListHeader(props: Props) {
|
||||
name="trending_time"
|
||||
label={__('How Fresh')}
|
||||
value={freshnessParam}
|
||||
onChange={(e) =>
|
||||
onChange={e =>
|
||||
handleChange({
|
||||
key: CS.FRESH_KEY,
|
||||
value: e.target.value,
|
||||
})
|
||||
}
|
||||
>
|
||||
{CS.FRESH_TYPES.map((time) => (
|
||||
{CS.FRESH_TYPES.map(time => (
|
||||
<option key={time} value={time}>
|
||||
{/* i18fixme */}
|
||||
{time === CS.FRESH_DAY && __('Today')}
|
||||
{
|
||||
time !== CS.FRESH_ALL &&
|
||||
time !== CS.FRESH_DEFAULT &&
|
||||
time !== CS.FRESH_DAY &&
|
||||
__('This ' + toCapitalCase(time)) /* yes, concat before i18n, since it is read from const */
|
||||
}
|
||||
{time !== CS.FRESH_ALL &&
|
||||
time !== CS.FRESH_DEFAULT &&
|
||||
time !== CS.FRESH_DAY &&
|
||||
__('This ' + toCapitalCase(time)) /* yes, concat before i18n, since it is read from const */}
|
||||
{time === CS.FRESH_ALL && __('All time')}
|
||||
{time === CS.FRESH_DEFAULT && __('Default')}
|
||||
</option>
|
||||
@@ -320,19 +314,18 @@ function ClaimListHeader(props: Props) {
|
||||
name="claimType"
|
||||
label={__('Content Type')}
|
||||
value={contentTypeParam || CS.CONTENT_ALL}
|
||||
onChange={(e) =>
|
||||
onChange={e =>
|
||||
handleChange({
|
||||
key: CS.CONTENT_KEY,
|
||||
value: e.target.value,
|
||||
})
|
||||
}
|
||||
>
|
||||
{CS.CONTENT_TYPES.map((type) => {
|
||||
{CS.CONTENT_TYPES.map(type => {
|
||||
if (type !== CS.CLAIM_CHANNEL || (type === CS.CLAIM_CHANNEL && !channelIdsParam)) {
|
||||
return (
|
||||
<option key={type} value={type}>
|
||||
{/* i18fixme */}
|
||||
{type === CS.CLAIM_COLLECTION && __('List')}
|
||||
{type === CS.CLAIM_CHANNEL && __('Channel')}
|
||||
{type === CS.CLAIM_REPOST && __('Repost')}
|
||||
{type === CS.FILE_VIDEO && __('Video')}
|
||||
@@ -365,7 +358,7 @@ function ClaimListHeader(props: Props) {
|
||||
name="claimType"
|
||||
label={__('Language')}
|
||||
value={languageValue || CS.LANGUAGES_ALL}
|
||||
onChange={(e) =>
|
||||
onChange={e =>
|
||||
handleChange({
|
||||
key: CS.LANGUAGE_KEY,
|
||||
value: e.target.value,
|
||||
@@ -405,14 +398,14 @@ function ClaimListHeader(props: Props) {
|
||||
)
|
||||
}
|
||||
value={durationParam || CS.DURATION_ALL}
|
||||
onChange={(e) =>
|
||||
onChange={e =>
|
||||
handleChange({
|
||||
key: CS.DURATION_KEY,
|
||||
value: e.target.value,
|
||||
})
|
||||
}
|
||||
>
|
||||
{CS.DURATION_TYPES.map((dur) => (
|
||||
{CS.DURATION_TYPES.map(dur => (
|
||||
<option key={dur} value={dur}>
|
||||
{/* i18fixme */}
|
||||
{dur === CS.DURATION_SHORT && __('Short (< 4 minutes)')}
|
||||
@@ -435,7 +428,7 @@ function ClaimListHeader(props: Props) {
|
||||
type="select"
|
||||
name="paidcontent"
|
||||
value={feeAmountParam}
|
||||
onChange={(e) =>
|
||||
onChange={e =>
|
||||
handleChange({
|
||||
key: CS.FEE_AMOUNT_KEY,
|
||||
value: e.target.value,
|
||||
|
||||
@@ -1,65 +1,20 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doCollectionEdit,
|
||||
makeSelectClaimForUri,
|
||||
makeSelectFileInfoForUri,
|
||||
doPrepareEdit,
|
||||
makeSelectCollectionForIdHasClaimUrl,
|
||||
makeSelectNameForCollectionId,
|
||||
makeSelectCollectionIsMine,
|
||||
COLLECTIONS_CONSTS,
|
||||
makeSelectEditedCollectionForId,
|
||||
} from 'lbry-redux';
|
||||
import { makeSelectClaimForUri, makeSelectClaimIsMine } from 'lbry-redux';
|
||||
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
||||
import { doChannelMute, doChannelUnmute } from 'redux/actions/blocked';
|
||||
import { doSetActiveChannel, doSetIncognito, doOpenModal } from 'redux/actions/app';
|
||||
import { doToggleMuteChannel } from 'redux/actions/blocked';
|
||||
import { doCommentModBlock, doCommentModUnBlock } from 'redux/actions/comments';
|
||||
import { makeSelectChannelIsBlocked } from 'redux/selectors/comments';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { makeSelectSigningIsMine } from 'redux/selectors/content';
|
||||
import { doChannelSubscribe, doChannelUnsubscribe } from 'redux/actions/subscriptions';
|
||||
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
||||
import ClaimPreview from './view';
|
||||
import fs from 'fs';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = makeSelectClaimForUri(props.uri, false)(state);
|
||||
const permanentUri = claim && claim.permanent_url;
|
||||
return {
|
||||
claim,
|
||||
claimIsMine: makeSelectSigningIsMine(props.uri)(state),
|
||||
hasClaimInWatchLater: makeSelectCollectionForIdHasClaimUrl(COLLECTIONS_CONSTS.WATCH_LATER_ID, permanentUri)(state),
|
||||
channelIsMuted: makeSelectChannelIsMuted(props.uri)(state),
|
||||
channelIsBlocked: makeSelectChannelIsBlocked(props.uri)(state),
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
isSubscribed: makeSelectIsSubscribed(props.channelUri, true)(state),
|
||||
claimInCollection: makeSelectCollectionForIdHasClaimUrl(props.collectionId, permanentUri)(state),
|
||||
collectionName: makeSelectNameForCollectionId(props.collectionId)(state),
|
||||
isMyCollection: makeSelectCollectionIsMine(props.collectionId)(state),
|
||||
editedCollection: makeSelectEditedCollectionForId(props.collectionId)(state),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
prepareEdit: (publishData, uri, fileInfo) => {
|
||||
if (publishData.signing_channel) {
|
||||
dispatch(doSetIncognito(false));
|
||||
dispatch(doSetActiveChannel(publishData.signing_channel.claim_id));
|
||||
} else {
|
||||
dispatch(doSetIncognito(true));
|
||||
}
|
||||
|
||||
dispatch(doPrepareEdit(publishData, uri, fileInfo, fs));
|
||||
},
|
||||
doToast: (props) => dispatch(doToast(props)),
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
doChannelMute: (channelUri) => dispatch(doChannelMute(channelUri)),
|
||||
doChannelUnmute: (channelUri) => dispatch(doChannelUnmute(channelUri)),
|
||||
doCommentModBlock: (channelUri) => dispatch(doCommentModBlock(channelUri)),
|
||||
doCommentModUnBlock: (channelUri) => dispatch(doCommentModUnBlock(channelUri)),
|
||||
doChannelSubscribe: (subscription) => dispatch(doChannelSubscribe(subscription)),
|
||||
doChannelUnsubscribe: (subscription) => dispatch(doChannelUnsubscribe(subscription)),
|
||||
doCollectionEdit: (collection, props) => dispatch(doCollectionEdit(collection, props)),
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimIsMine: props.channelIsMine ? (props.isRepost ? makeSelectClaimIsMine(props.uri)(state) : true) : makeSelectClaimIsMine(props.uri)(state),
|
||||
channelIsMuted: makeSelectChannelIsMuted(props.uri)(state),
|
||||
channelIsBlocked: makeSelectChannelIsBlocked(props.uri)(state),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ClaimPreview);
|
||||
export default connect(select, {
|
||||
doToggleMuteChannel,
|
||||
doCommentModBlock,
|
||||
doCommentModUnBlock,
|
||||
})(ClaimPreview);
|
||||
|
||||
@@ -2,127 +2,58 @@
|
||||
import { URL, SHARE_DOMAIN_URL } from 'config';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import { Menu, MenuButton, MenuList, MenuItem } from '@reach/menu-button';
|
||||
import Icon from 'component/common/icon';
|
||||
import { generateShareUrl } from 'util/url';
|
||||
import { useHistory } from 'react-router';
|
||||
import { buildURI, parseURI, COLLECTIONS_CONSTS } from 'lbry-redux';
|
||||
|
||||
const SHARE_DOMAIN = SHARE_DOMAIN_URL || URL;
|
||||
const PAGE_VIEW_QUERY = `view`;
|
||||
const EDIT_PAGE = 'edit';
|
||||
|
||||
type SubscriptionArgs = {
|
||||
channelName: string,
|
||||
uri: string,
|
||||
notificationsDisabled?: boolean,
|
||||
};
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
channelUri: string,
|
||||
claim: ?Claim,
|
||||
openModal: (id: string, {}) => void,
|
||||
inline?: boolean,
|
||||
claimIsMine: boolean,
|
||||
channelIsMuted: boolean,
|
||||
channelIsBlocked: boolean,
|
||||
doChannelMute: (string) => void,
|
||||
doChannelUnmute: (string) => void,
|
||||
doToggleMuteChannel: (string) => void,
|
||||
doCommentModBlock: (string) => void,
|
||||
doCommentModUnBlock: (string) => void,
|
||||
channelIsMine: boolean,
|
||||
isRepost: boolean,
|
||||
doCollectionEdit: (string, any) => void,
|
||||
hasClaimInWatchLater: boolean,
|
||||
claimInCollection: boolean,
|
||||
collectionName?: string,
|
||||
collectionId: string,
|
||||
isMyCollection: boolean,
|
||||
doToast: ({ message: string }) => void,
|
||||
claimIsMine: boolean,
|
||||
fileInfo: FileListItem,
|
||||
prepareEdit: ({}, string, {}) => void,
|
||||
isSubscribed: boolean,
|
||||
doChannelSubscribe: (SubscriptionArgs) => void,
|
||||
doChannelUnsubscribe: (SubscriptionArgs) => void,
|
||||
isChannelPage: boolean,
|
||||
editedCollection: Collection,
|
||||
};
|
||||
|
||||
function ClaimMenuList(props: Props) {
|
||||
const {
|
||||
uri,
|
||||
channelUri,
|
||||
claim,
|
||||
openModal,
|
||||
inline = false,
|
||||
doChannelMute,
|
||||
doChannelUnmute,
|
||||
claimIsMine,
|
||||
doToggleMuteChannel,
|
||||
channelIsMuted,
|
||||
channelIsBlocked,
|
||||
doCommentModBlock,
|
||||
doCommentModUnBlock,
|
||||
isRepost,
|
||||
doCollectionEdit,
|
||||
hasClaimInWatchLater,
|
||||
collectionId,
|
||||
collectionName,
|
||||
isMyCollection,
|
||||
doToast,
|
||||
claimIsMine,
|
||||
fileInfo,
|
||||
prepareEdit,
|
||||
isSubscribed,
|
||||
doChannelSubscribe,
|
||||
doChannelUnsubscribe,
|
||||
isChannelPage = false,
|
||||
editedCollection,
|
||||
} = props;
|
||||
const repostedContent = claim && claim.reposted_claim;
|
||||
const contentClaim = repostedContent || claim;
|
||||
const incognitoClaim = channelUri && !channelUri.includes('@');
|
||||
const signingChannel = claim && (claim.signing_channel || claim);
|
||||
const permanentUrl = String(channelUri);
|
||||
const isChannel = !incognitoClaim && signingChannel === claim;
|
||||
const showDelete = claimIsMine || (fileInfo && (fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0));
|
||||
const subscriptionLabel = isSubscribed ? __('Unfollow') : __('Follow');
|
||||
|
||||
const { push, replace } = useHistory();
|
||||
if (!claim) {
|
||||
const { push } = useHistory();
|
||||
|
||||
const channelUri =
|
||||
claim &&
|
||||
(claim.value_type === 'channel'
|
||||
? claim.permanent_url
|
||||
: claim.signing_channel && claim.signing_channel.permanent_url);
|
||||
|
||||
const shareUrl: string = generateShareUrl(SHARE_DOMAIN, uri);
|
||||
|
||||
if (!channelUri || !claim) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const shareUrl: string = generateShareUrl(SHARE_DOMAIN, uri);
|
||||
const isCollectionClaim = claim && claim.value_type === 'collection';
|
||||
// $FlowFixMe
|
||||
const isPlayable =
|
||||
contentClaim &&
|
||||
// $FlowFixMe
|
||||
contentClaim.value &&
|
||||
// $FlowFixMe
|
||||
contentClaim.value.stream_type &&
|
||||
// $FlowFixMe
|
||||
(contentClaim.value.stream_type === 'audio' || contentClaim.value.stream_type === 'video');
|
||||
|
||||
function handleFollow() {
|
||||
const { channelName } = parseURI(permanentUrl);
|
||||
const subscriptionHandler = isSubscribed ? doChannelUnsubscribe : doChannelSubscribe;
|
||||
|
||||
subscriptionHandler({
|
||||
channelName: '@' + channelName,
|
||||
uri: permanentUrl,
|
||||
notificationsDisabled: true,
|
||||
});
|
||||
}
|
||||
|
||||
function handleToggleMute() {
|
||||
if (channelIsMuted) {
|
||||
doChannelUnmute(channelUri);
|
||||
} else {
|
||||
doChannelMute(channelUri);
|
||||
}
|
||||
doToggleMuteChannel(channelUri);
|
||||
}
|
||||
|
||||
function handleToggleBlock() {
|
||||
@@ -133,46 +64,12 @@ function ClaimMenuList(props: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
function handleEdit() {
|
||||
if (!isChannel) {
|
||||
const signingChannelName = signingChannel && signingChannel.name;
|
||||
|
||||
const uriObject: { streamName: string, streamClaimId: string, channelName?: string } = {
|
||||
streamName: claim.name,
|
||||
streamClaimId: claim.claim_id,
|
||||
};
|
||||
if (signingChannelName) {
|
||||
uriObject.channelName = signingChannelName;
|
||||
}
|
||||
const editUri = buildURI(uriObject);
|
||||
|
||||
push(`/$/${PAGES.UPLOAD}`);
|
||||
prepareEdit(claim, editUri, fileInfo);
|
||||
} else {
|
||||
const channelUrl = claim.name + ':' + claim.claim_id;
|
||||
push(`/${channelUrl}?${PAGE_VIEW_QUERY}=${EDIT_PAGE}`);
|
||||
}
|
||||
}
|
||||
|
||||
function handleDelete() {
|
||||
if (!isRepost && !isChannel) {
|
||||
openModal(MODALS.CONFIRM_FILE_REMOVE, { uri });
|
||||
} else {
|
||||
openModal(MODALS.CONFIRM_CLAIM_REVOKE, { claim, cb: !isRepost && (() => replace(`/$/${PAGES.CHANNELS}`)) });
|
||||
}
|
||||
}
|
||||
|
||||
function handleSupport() {
|
||||
openModal(MODALS.SEND_TIP, { uri, isSupport: true });
|
||||
}
|
||||
|
||||
function handleCopyLink() {
|
||||
navigator.clipboard.writeText(shareUrl);
|
||||
}
|
||||
|
||||
function handleReportContent() {
|
||||
// $FlowFixMe
|
||||
push(`/$/${PAGES.REPORT_CONTENT}?claimId=${(repostedContent && repostedContent.claim_id) || claim.claim_id}`);
|
||||
push(`/$/${PAGES.REPORT_CONTENT}?claimId=${claim.claim_id}`);
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -187,143 +84,26 @@ function ClaimMenuList(props: Props) {
|
||||
<Icon size={20} icon={ICONS.MORE_VERTICAL} />
|
||||
</MenuButton>
|
||||
<MenuList className="menu__list">
|
||||
{/* WATCH LATER */}
|
||||
{!claimIsMine && (
|
||||
<>
|
||||
{isPlayable && !collectionId && (
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => {
|
||||
doToast({
|
||||
message: __('Item %action% Watch Later', {
|
||||
action: hasClaimInWatchLater ? __('removed from') : __('added to'),
|
||||
}),
|
||||
});
|
||||
doCollectionEdit(COLLECTIONS_CONSTS.WATCH_LATER_ID, {
|
||||
claims: [contentClaim],
|
||||
remove: hasClaimInWatchLater,
|
||||
type: 'playlist',
|
||||
});
|
||||
}}
|
||||
>
|
||||
<MenuItem className="comment__menu-option" onSelect={handleToggleBlock}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={hasClaimInWatchLater ? ICONS.DELETE : ICONS.TIME} />
|
||||
{hasClaimInWatchLater ? __('In Watch Later') : __('Watch Later')}
|
||||
<Icon aria-hidden icon={ICONS.BLOCK} />
|
||||
{channelIsBlocked ? __('Unblock Channel') : __('Block Channel')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
)}
|
||||
{/* COLLECTION OPERATIONS */}
|
||||
{collectionId && collectionName && isCollectionClaim && (
|
||||
<>
|
||||
{Boolean(editedCollection) && (
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => push(`/$/${PAGES.LIST}/${collectionId}?view=edit`)}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden iconColor={'red'} icon={ICONS.PUBLISH} />
|
||||
{__('Publish')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
)}
|
||||
<MenuItem className="comment__menu-option" onSelect={() => push(`/$/${PAGES.LIST}/${collectionId}`)}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.VIEW} />
|
||||
{__('View List')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => openModal(MODALS.COLLECTION_DELETE, { collectionId })}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.DELETE} />
|
||||
{__('Delete List')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
</>
|
||||
)}
|
||||
{/* CURRENTLY ONLY SUPPORT PLAYLISTS FOR PLAYABLE; LATER DIFFERENT TYPES */}
|
||||
{isPlayable && (
|
||||
<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>
|
||||
)}
|
||||
</>
|
||||
{!isChannelPage && (
|
||||
<>
|
||||
|
||||
<MenuItem className="comment__menu-option" onSelect={handleToggleMute}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.MUTE} />
|
||||
{channelIsMuted ? __('Unmute Channel') : __('Mute Channel')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
|
||||
<hr className="menu__separator" />
|
||||
<MenuItem className="comment__menu-option" onSelect={handleSupport}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.LBC} />
|
||||
{__('Support')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
</>
|
||||
)}
|
||||
|
||||
{!incognitoClaim && !isRepost && !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>
|
||||
</>
|
||||
)}
|
||||
{!isMyCollection && (
|
||||
<>
|
||||
{(!claimIsMine || channelIsBlocked) && channelUri ? (
|
||||
!incognitoClaim &&
|
||||
!isRepost && (
|
||||
<>
|
||||
<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>
|
||||
|
||||
<MenuItem className="comment__menu-option" onSelect={handleToggleMute}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.MUTE} />
|
||||
{channelIsMuted ? __('Unmute Channel') : __('Mute Channel')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
</>
|
||||
)
|
||||
) : (
|
||||
<>
|
||||
{!isChannelPage && !isRepost && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleEdit}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.EDIT} />
|
||||
{__('Edit')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
)}
|
||||
|
||||
{showDelete && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleDelete}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.DELETE} />
|
||||
{__('Delete')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
<hr className="menu__separator" />
|
||||
<MenuItem className="comment__menu-option" onSelect={handleCopyLink}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.SHARE} />
|
||||
@@ -331,7 +111,7 @@ function ClaimMenuList(props: Props) {
|
||||
</div>
|
||||
</MenuItem>
|
||||
|
||||
{!claimIsMine && !isMyCollection && (
|
||||
{!claimIsMine && (
|
||||
<MenuItem className="comment__menu-option" onSelect={handleReportContent}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.REPORT} />
|
||||
|
||||
@@ -11,10 +11,6 @@ import {
|
||||
makeSelectClaimWasPurchased,
|
||||
makeSelectStreamingUrlForUri,
|
||||
makeSelectClaimIsStreamPlaceholder,
|
||||
makeSelectCollectionIsMine,
|
||||
doCollectionEdit,
|
||||
makeSelectUrlsForCollectionId,
|
||||
makeSelectIndexForUrlInCollection,
|
||||
} from 'lbry-redux';
|
||||
import { selectMutedChannels, makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
||||
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
||||
@@ -44,15 +40,11 @@ const select = (state, props) => ({
|
||||
streamingUrl: props.uri && makeSelectStreamingUrlForUri(props.uri)(state),
|
||||
wasPurchased: props.uri && makeSelectClaimWasPurchased(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
isCollectionMine: makeSelectCollectionIsMine(props.collectionId)(state),
|
||||
collectionUris: makeSelectUrlsForCollectionId(props.collectionId)(state),
|
||||
collectionIndex: makeSelectIndexForUrlInCollection(props.uri, props.collectionId)(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
resolveUri: (uri) => dispatch(doResolveUri(uri)),
|
||||
getFile: (uri) => dispatch(doFileGet(uri, false)),
|
||||
editCollection: (id, params) => dispatch(doCollectionEdit(id, params)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(ClaimPreview);
|
||||
|
||||
@@ -3,12 +3,12 @@ import type { Node } from 'react';
|
||||
import React, { useEffect, forwardRef } from 'react';
|
||||
import { NavLink, withRouter } from 'react-router-dom';
|
||||
import classnames from 'classnames';
|
||||
import { parseURI, COLLECTIONS_CONSTS } from 'lbry-redux';
|
||||
import { parseURI } from 'lbry-redux';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { isEmpty } from 'util/object';
|
||||
import FileThumbnail from 'component/fileThumbnail';
|
||||
import UriIndicator from 'component/uriIndicator';
|
||||
import PreviewOverlayProperties from 'component/previewOverlayProperties';
|
||||
import FileProperties from 'component/fileProperties';
|
||||
import ClaimTags from 'component/claimTags';
|
||||
import SubscribeButton from 'component/subscribeButton';
|
||||
import ChannelThumbnail from 'component/channelThumbnail';
|
||||
@@ -25,8 +25,6 @@ import ClaimPreviewLoading from './claim-preview-loading';
|
||||
import ClaimPreviewHidden from './claim-preview-no-mature';
|
||||
import ClaimPreviewNoContent from './claim-preview-no-content';
|
||||
import { ENABLE_NO_SOURCE_CLAIMS } from 'config';
|
||||
import Button from 'component/button';
|
||||
import * as ICONS from 'constants/icons';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
@@ -73,11 +71,6 @@ type Props = {
|
||||
hideMenu?: boolean,
|
||||
isLivestream?: boolean,
|
||||
live?: boolean,
|
||||
collectionId?: string,
|
||||
editCollection: (string, CollectionEditParams) => void,
|
||||
isCollectionMine: boolean,
|
||||
collectionUris: Array<Collection>,
|
||||
collectionIndex?: number,
|
||||
};
|
||||
|
||||
const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
@@ -127,23 +120,15 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
renderActions,
|
||||
hideMenu = false,
|
||||
// repostUrl,
|
||||
isLivestream, // need both? CHECK
|
||||
isLivestream,
|
||||
live,
|
||||
collectionId,
|
||||
collectionIndex,
|
||||
editCollection,
|
||||
isCollectionMine,
|
||||
collectionUris,
|
||||
} = props;
|
||||
const isRepost = claim && claim.repost_channel_url;
|
||||
const WrapperElement = wrapperElement || 'li';
|
||||
const shouldFetch =
|
||||
claim === undefined || (claim !== null && claim.value_type === 'channel' && isEmpty(claim.meta) && !pending);
|
||||
const abandoned = !isResolvingUri && !claim;
|
||||
const isMyCollection = collectionId && (isCollectionMine || collectionId.includes('-'));
|
||||
const shouldHideActions = hideActions || isMyCollection || type === 'small' || type === 'tooltip';
|
||||
const shouldHideActions = hideActions || type === 'small' || type === 'tooltip';
|
||||
const canonicalUrl = claim && claim.canonical_url;
|
||||
const lastCollectionIndex = collectionUris ? collectionUris.length - 1 : 0;
|
||||
let isValid = false;
|
||||
if (uri) {
|
||||
try {
|
||||
@@ -153,16 +138,12 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
const isCollection = claim && claim.value_type === 'collection';
|
||||
const isChannelUri = isValid ? parseURI(uri).isChannel : false;
|
||||
const isRepost = claim && claim.repost_url;
|
||||
|
||||
const contentUri = claim && isRepost ? claim.canonical_url || claim.permanent_url : uri;
|
||||
const isChannelUri = isValid ? parseURI(contentUri).isChannel : false;
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
let navigateUrl = formatLbryUrlForWeb((claim && claim.canonical_url) || uri || '/');
|
||||
if (collectionId) {
|
||||
const collectionParams = new URLSearchParams();
|
||||
collectionParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, collectionId);
|
||||
navigateUrl = navigateUrl + `?` + collectionParams.toString();
|
||||
}
|
||||
const channelUri = claim && (signingChannel ? signingChannel.permanent_url : claim.permanent_url);
|
||||
const navigateUrl = formatLbryUrlForWeb((claim && claim.canonical_url) || uri || '/');
|
||||
const navLinkProps = {
|
||||
to: navigateUrl,
|
||||
onClick: (e) => e.stopPropagation(),
|
||||
@@ -207,7 +188,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
|
||||
// Weird placement warning
|
||||
// Make sure this happens after we figure out if this claim needs to be hidden
|
||||
const thumbnailUrl = useGetThumbnail(uri, claim, streamingUrl, getFile, shouldHide);
|
||||
const thumbnailUrl = useGetThumbnail(contentUri, claim, streamingUrl, getFile, shouldHide);
|
||||
|
||||
function handleOnClick(e) {
|
||||
if (onClick) {
|
||||
@@ -251,10 +232,10 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
return empty || <ClaimPreviewNoContent isChannel={isChannelUri} type={type} />;
|
||||
}
|
||||
|
||||
if (!shouldFetch && showUnresolvedClaim && !isResolvingUri && isChannelUri && claim === null) {
|
||||
return <AbandonedChannelPreview uri={uri} type />;
|
||||
if (!shouldFetch && showUnresolvedClaim && !isResolvingUri && claim === null) {
|
||||
return <AbandonedChannelPreview uri={contentUri} type />;
|
||||
}
|
||||
if (placeholder === 'publish' && !claim && uri.startsWith('lbry://@')) {
|
||||
if (placeholder === 'publish' && !claim && contentUri.startsWith('lbry://@')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -290,8 +271,8 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
})}
|
||||
>
|
||||
{isChannelUri && claim ? (
|
||||
<UriIndicator uri={uri} link>
|
||||
<ChannelThumbnail uri={uri} />
|
||||
<UriIndicator uri={contentUri} link>
|
||||
<ChannelThumbnail uri={contentUri} />
|
||||
</UriIndicator>
|
||||
) : (
|
||||
<>
|
||||
@@ -299,15 +280,15 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
<NavLink {...navLinkProps}>
|
||||
<FileThumbnail thumbnail={thumbnailUrl}>
|
||||
{/* @if TARGET='app' */}
|
||||
{claim && !isCollection && (
|
||||
{claim && (
|
||||
<div className="claim-preview__hover-actions">
|
||||
<FileDownloadLink uri={canonicalUrl} hideOpenButton hideDownloadStatus />
|
||||
</div>
|
||||
)}
|
||||
{/* @endif */}
|
||||
{!isLivestream && (
|
||||
{!isRepost && !isChannelUri && (
|
||||
<div className="claim-preview__file-property-overlay">
|
||||
<PreviewOverlayProperties uri={uri} small={type === 'small'} properties={liveProperty} />
|
||||
<FileProperties uri={contentUri} small properties={liveProperty} />
|
||||
</div>
|
||||
)}
|
||||
</FileThumbnail>
|
||||
@@ -322,7 +303,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
<div className="claim-preview-metadata">
|
||||
<div className="claim-preview-info">
|
||||
{pending ? (
|
||||
<ClaimPreviewTitle uri={uri} />
|
||||
<ClaimPreviewTitle uri={contentUri} />
|
||||
) : (
|
||||
<NavLink {...navLinkProps}>
|
||||
<ClaimPreviewTitle uri={uri} />
|
||||
@@ -337,58 +318,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
{!pending && (
|
||||
<>
|
||||
{renderActions && claim && renderActions(claim)}
|
||||
{Boolean(isMyCollection && collectionId) && (
|
||||
<>
|
||||
<div className="collection-preview__edit-buttons">
|
||||
<div className="collection-preview__edit-group">
|
||||
<Button
|
||||
button="alt"
|
||||
className={'button-collection-order'}
|
||||
disabled={collectionIndex === 0}
|
||||
icon={ICONS.UP}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (editCollection) {
|
||||
// $FlowFixMe
|
||||
editCollection(collectionId, {
|
||||
order: { from: collectionIndex, to: Number(collectionIndex) - 1 },
|
||||
});
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
button="alt"
|
||||
className={'button-collection-order'}
|
||||
icon={ICONS.DOWN}
|
||||
disabled={collectionIndex === lastCollectionIndex}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
if (editCollection) {
|
||||
// $FlowFixMe
|
||||
editCollection(collectionId, {
|
||||
order: { from: collectionIndex, to: Number(collectionIndex + 1) },
|
||||
});
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="collection-preview__edit-group">
|
||||
<Button
|
||||
button="alt"
|
||||
icon={ICONS.DELETE}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
// $FlowFixMe
|
||||
if (editCollection) editCollection(collectionId, { claims: [claim], remove: true });
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{shouldHideActions || renderActions ? null : actions !== undefined ? (
|
||||
actions
|
||||
) : (
|
||||
@@ -400,7 +329,9 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
)}
|
||||
|
||||
{isChannelUri && !channelIsBlocked && !claimIsMine && (
|
||||
<SubscribeButton uri={uri.startsWith('lbry://') ? uri : `lbry://${uri}`} />
|
||||
<SubscribeButton
|
||||
uri={contentUri.startsWith('lbry://') ? contentUri : `lbry://${contentUri}`}
|
||||
/>
|
||||
)}
|
||||
|
||||
{includeSupportAction && <ClaimSupportButton uri={uri} />}
|
||||
@@ -423,7 +354,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{!hideMenu && <ClaimMenuList uri={uri} collectionId={collectionId} channelUri={channelUri} isRepost={isRepost} />}
|
||||
{!hideMenu && <ClaimMenuList uri={uri} />}
|
||||
</>
|
||||
</WrapperElement>
|
||||
);
|
||||
|
||||
@@ -10,12 +10,11 @@ import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import SubscribeButton from 'component/subscribeButton';
|
||||
import useGetThumbnail from 'effects/use-get-thumbnail';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { parseURI, COLLECTIONS_CONSTS } from 'lbry-redux';
|
||||
import PreviewOverlayProperties from 'component/previewOverlayProperties';
|
||||
import { parseURI } from 'lbry-redux';
|
||||
import FileProperties from 'component/fileProperties';
|
||||
import FileDownloadLink from 'component/fileDownloadLink';
|
||||
import ClaimRepostAuthor from 'component/claimRepostAuthor';
|
||||
import ClaimMenuList from 'component/claimMenuList';
|
||||
import CollectionPreviewOverlay from 'component/collectionPreviewOverlay';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
@@ -43,9 +42,7 @@ type Props = {
|
||||
showHiddenByUser?: boolean,
|
||||
properties?: (Claim) => void,
|
||||
live?: boolean,
|
||||
collectionId?: string,
|
||||
hideLivestreamClaims?: boolean,
|
||||
isLivestream: boolean,
|
||||
channelIsMine?: boolean,
|
||||
};
|
||||
|
||||
function ClaimPreviewTile(props: Props) {
|
||||
@@ -68,24 +65,14 @@ function ClaimPreviewTile(props: Props) {
|
||||
showHiddenByUser,
|
||||
properties,
|
||||
live,
|
||||
hideLivestreamClaims,
|
||||
isLivestream,
|
||||
collectionId,
|
||||
channelIsMine,
|
||||
} = props;
|
||||
const isRepost = claim && claim.repost_channel_url;
|
||||
const isCollection = claim && claim.value_type === 'collection';
|
||||
const isStream = claim && claim.value_type === 'stream';
|
||||
const collectionClaimId = isCollection && claim && claim.claim_id;
|
||||
const shouldFetch = claim === undefined;
|
||||
const thumbnailUrl = useGetThumbnail(uri, claim, streamingUrl, getFile, placeholder) || thumbnail;
|
||||
const canonicalUrl = claim && claim.canonical_url;
|
||||
let navigateUrl = formatLbryUrlForWeb(canonicalUrl || uri || '/');
|
||||
const listId = collectionId || collectionClaimId;
|
||||
if (listId) {
|
||||
const collectionParams = new URLSearchParams();
|
||||
collectionParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, listId);
|
||||
navigateUrl = navigateUrl + `?` + collectionParams.toString();
|
||||
}
|
||||
const navigateUrl = formatLbryUrlForWeb(canonicalUrl || uri || '/');
|
||||
|
||||
const navLinkProps = {
|
||||
to: navigateUrl,
|
||||
onClick: (e) => e.stopPropagation(),
|
||||
@@ -102,8 +89,11 @@ function ClaimPreviewTile(props: Props) {
|
||||
}
|
||||
}
|
||||
|
||||
let channelUri;
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
const channelUri = signingChannel && signingChannel.permanent_url;
|
||||
if (signingChannel) {
|
||||
channelUri = signingChannel.permanent_url;
|
||||
}
|
||||
|
||||
function handleClick(e) {
|
||||
if (navigateUrl) {
|
||||
@@ -153,7 +143,7 @@ function ClaimPreviewTile(props: Props) {
|
||||
shouldHide = blockedChannelUris.some((blockedUri) => blockedUri === claim.permanent_url);
|
||||
}
|
||||
|
||||
if (shouldHide || (isLivestream && hideLivestreamClaims)) {
|
||||
if (shouldHide) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -188,22 +178,12 @@ function ClaimPreviewTile(props: Props) {
|
||||
{!isChannel && (
|
||||
<React.Fragment>
|
||||
{/* @if TARGET='app' */}
|
||||
{isStream && (
|
||||
<div className="claim-preview__hover-actions">
|
||||
<FileDownloadLink uri={canonicalUrl} hideOpenButton />
|
||||
</div>
|
||||
)}
|
||||
{/* @endif */}
|
||||
|
||||
<div className="claim-preview__file-property-overlay">
|
||||
<PreviewOverlayProperties uri={uri} properties={liveProperty || properties} />
|
||||
<div className="claim-preview__hover-actions">
|
||||
<FileDownloadLink uri={canonicalUrl} hideOpenButton />
|
||||
</div>
|
||||
</React.Fragment>
|
||||
)}
|
||||
{isCollection && (
|
||||
<React.Fragment>
|
||||
<div className="claim-preview__collection-wrapper">
|
||||
<CollectionPreviewOverlay collectionId={listId} uri={uri} />
|
||||
{/* @endif */}
|
||||
<div className="claim-preview__file-property-overlay">
|
||||
<FileProperties uri={uri} small properties={liveProperty || properties} />
|
||||
</div>
|
||||
</React.Fragment>
|
||||
)}
|
||||
@@ -217,7 +197,7 @@ function ClaimPreviewTile(props: Props) {
|
||||
<UriIndicator uri={uri} />
|
||||
</div>
|
||||
)}
|
||||
<ClaimMenuList uri={uri} collectionId={listId} channelUri={channelUri} isRepost={isRepost} />
|
||||
<ClaimMenuList uri={uri} channelIsMine={channelIsMine} isRepost={isRepost} />
|
||||
</h2>
|
||||
</NavLink>
|
||||
<div>
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
// @flow
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import Icon from 'component/common/icon';
|
||||
import FilePrice from 'component/filePrice';
|
||||
import ClaimType from 'component/claimType';
|
||||
import * as COL from 'constants/collections';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
isSubscribed: boolean,
|
||||
small: boolean,
|
||||
claim: Claim | CollectionClaim,
|
||||
iconOnly: boolean,
|
||||
};
|
||||
export default function ClaimProperties(props: Props) {
|
||||
const { uri, isSubscribed, small = false, claim, iconOnly } = props;
|
||||
const isCollection = claim && claim.value_type === 'collection';
|
||||
const size = small ? COL.ICON_SIZE : undefined;
|
||||
// $FlowFixMe
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classnames('claim-preview__overlay-properties', { 'claim-preview__overlay-properties--small': small })}
|
||||
>
|
||||
{
|
||||
<>
|
||||
<ClaimType uri={uri} small />
|
||||
{/* // $FlowFixMe */}
|
||||
{isCollection && claim && claim.value.claims && !iconOnly && <div>{claim.value.claims.length}</div>}
|
||||
{isSubscribed && <Icon size={size} tooltip icon={ICONS.SUBSCRIBE} />}
|
||||
<FilePrice hideFree uri={uri} />
|
||||
</>
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -52,7 +52,7 @@ export default function ClaimTags(props: Props) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={classnames('claim__tags', { 'claim__tags--large': type === 'large' })}>
|
||||
<div className={classnames('file-properties--small', { 'file-properties--large': type === 'large' })}>
|
||||
{tagsToDisplay.map((tag) => (
|
||||
<Tag key={tag} title={tag} name={tag} />
|
||||
))}
|
||||
|
||||
@@ -37,7 +37,7 @@ export function prioritizeActiveLivestreams(
|
||||
// for that channel actually point to the same source).
|
||||
// 2. 'liveChannelIds' needs to be pruned after being accounted for,
|
||||
// otherwise all livestream-claims will be "live" (we'll only take the
|
||||
// latest one as "live" ).
|
||||
// latest one as "live").
|
||||
return (
|
||||
claim &&
|
||||
claim.value_type === 'stream' &&
|
||||
@@ -145,19 +145,17 @@ function ClaimTilesDiscover(props: Props) {
|
||||
mutedUris,
|
||||
liveLivestreamsFirst,
|
||||
livestreamMap,
|
||||
pin,
|
||||
// pin,
|
||||
prefixUris,
|
||||
} = props;
|
||||
|
||||
const { location } = useHistory();
|
||||
const urlParams = new URLSearchParams(location.search);
|
||||
const feeAmountInUrl = urlParams.get('fee_amount');
|
||||
const feeAmountParam = feeAmountInUrl || feeAmount || CS.FEE_AMOUNT_ONLY_FREE;
|
||||
const feeAmountParam = feeAmountInUrl || feeAmount;
|
||||
const mutedAndBlockedChannelIds = Array.from(new Set(mutedUris.concat(blockedUris).map((uri) => uri.split('#')[1])));
|
||||
const liveUris = [];
|
||||
|
||||
const [prevUris, setPrevUris] = React.useState([]);
|
||||
|
||||
const options: {
|
||||
page_size: number,
|
||||
no_totals: boolean,
|
||||
@@ -231,16 +229,11 @@ function ClaimTilesDiscover(props: Props) {
|
||||
options.claim_ids = claimIds;
|
||||
}
|
||||
|
||||
const mainSearchKey = createNormalizedClaimSearchKey(options);
|
||||
const livestreamSearchKey = liveLivestreamsFirst
|
||||
? createNormalizedClaimSearchKey(getLivestreamOnlyOptions(options))
|
||||
: undefined;
|
||||
const claimSearchCacheQuery = createNormalizedClaimSearchKey(options);
|
||||
const uris = (prefixUris || []).concat(claimSearchByQuery[claimSearchCacheQuery] || []);
|
||||
|
||||
let uris = (prefixUris || []).concat(claimSearchByQuery[mainSearchKey] || []);
|
||||
|
||||
const isLoading = fetchingClaimSearchByQuery[mainSearchKey];
|
||||
// && !isLoading isn't on master, doesn't seem to affect the functionality, don't recall why it was added.
|
||||
if (liveLivestreamsFirst && livestreamMap && !isLoading) {
|
||||
const isLoading = fetchingClaimSearchByQuery[claimSearchCacheQuery];
|
||||
if (liveLivestreamsFirst && livestreamMap) {
|
||||
prioritizeActiveLivestreams(uris, liveUris, livestreamMap, claimsByUri, claimSearchByQuery, options);
|
||||
}
|
||||
|
||||
@@ -248,18 +241,6 @@ function ClaimTilesDiscover(props: Props) {
|
||||
const optionsStringForEffect = JSON.stringify(options);
|
||||
const shouldPerformSearch = !isLoading && uris.length === 0;
|
||||
|
||||
if (
|
||||
prefixUris === undefined &&
|
||||
(claimSearchByQuery[mainSearchKey] === undefined ||
|
||||
(livestreamSearchKey && claimSearchByQuery[livestreamSearchKey] === undefined))
|
||||
) {
|
||||
// This is a new query and we don't have results yet ...
|
||||
if (prevUris.length !== 0) {
|
||||
// ... but we have previous results. Use it until new results are here.
|
||||
uris = prevUris;
|
||||
}
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
if (shouldPerformSearch) {
|
||||
const searchOptions = JSON.parse(optionsStringForEffect);
|
||||
@@ -271,12 +252,6 @@ function ClaimTilesDiscover(props: Props) {
|
||||
}
|
||||
}, [doClaimSearch, shouldPerformSearch, optionsStringForEffect, liveLivestreamsFirst]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (JSON.stringify(prevUris) !== JSON.stringify(uris) && !shouldPerformSearch) {
|
||||
setPrevUris(uris);
|
||||
}
|
||||
}, [shouldPerformSearch, prevUris, uris]);
|
||||
|
||||
const resolveLive = (index) => {
|
||||
if (liveLivestreamsFirst && livestreamMap && index < liveUris.length) {
|
||||
return true;
|
||||
@@ -284,26 +259,10 @@ function ClaimTilesDiscover(props: Props) {
|
||||
return undefined;
|
||||
};
|
||||
|
||||
const modifiedUris = uris ? uris.slice() : [];
|
||||
const fixUris = [
|
||||
'lbry://@AdrianLogan#5/why-i-talk-to-myself#3',
|
||||
];
|
||||
|
||||
if (pin && modifiedUris && modifiedUris.length > 2 && window.location.pathname === '/') {
|
||||
fixUris.forEach((fixUri) => {
|
||||
if (modifiedUris.indexOf(fixUri) !== -1) {
|
||||
modifiedUris.splice(modifiedUris.indexOf(fixUri), 1);
|
||||
} else {
|
||||
modifiedUris.pop();
|
||||
}
|
||||
});
|
||||
modifiedUris.splice(2, 0, ...fixUris);
|
||||
}
|
||||
|
||||
return (
|
||||
<ul className="claim-grid">
|
||||
{modifiedUris && modifiedUris.length
|
||||
? modifiedUris.map((uri, index) => (
|
||||
{uris && uris.length
|
||||
? uris.map((uri, index) => (
|
||||
<ClaimPreviewTile key={uri} uri={uri} properties={renderProperties} live={resolveLive(index)} />
|
||||
))
|
||||
: new Array(pageSize).fill(1).map((x, i) => <ClaimPreviewTile key={i} placeholder />)}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri, makeSelectClaimIsStreamPlaceholder } from 'lbry-redux';
|
||||
import FileType from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
isLivestream: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
});
|
||||
|
||||
export default connect(select)(FileType);
|
||||
@@ -1,29 +0,0 @@
|
||||
// @flow
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import Icon from 'component/common/icon';
|
||||
import * as COL from 'constants/collections';
|
||||
|
||||
type Props = {
|
||||
claim: Claim,
|
||||
small: boolean,
|
||||
};
|
||||
|
||||
function ClaimType(props: Props) {
|
||||
const { claim, small } = props;
|
||||
const { value_type: claimType } = claim || {};
|
||||
|
||||
const size = small ? COL.ICON_SIZE : undefined;
|
||||
|
||||
if (claimType === 'collection') {
|
||||
return <Icon size={size} icon={ICONS.STACK} />;
|
||||
} else if (claimType === 'channel') {
|
||||
return <Icon size={size} icon={ICONS.CHANNEL} />;
|
||||
} else if (claimType === 'repost') {
|
||||
return <Icon size={size} icon={ICONS.REPOST} />;
|
||||
}
|
||||
|
||||
return <Icon icon={ICONS.DOWNLOADABLE} />;
|
||||
}
|
||||
|
||||
export default ClaimType;
|
||||
@@ -1,30 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectClaimIsMine,
|
||||
makeSelectClaimForUri,
|
||||
selectMyChannelClaims,
|
||||
makeSelectClaimIsPending,
|
||||
makeSelectCollectionIsMine,
|
||||
makeSelectEditedCollectionForId,
|
||||
} from 'lbry-redux';
|
||||
import { makeSelectCostInfoForUri } from 'lbryinc';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import CollectionActions from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||
myChannels: selectMyChannelClaims(state),
|
||||
claimIsPending: makeSelectClaimIsPending(props.uri)(state),
|
||||
isMyCollection: makeSelectCollectionIsMine(props.collectionId)(state),
|
||||
collectionHasEdits: Boolean(makeSelectEditedCollectionForId(props.collectionId)(state)),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
doToast: (options) => dispatch(doToast(options)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CollectionActions);
|
||||
@@ -1,130 +0,0 @@
|
||||
// @flow
|
||||
import * as PAGES from 'constants/pages';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import { useIsMobile } from 'effects/use-screensize';
|
||||
import ClaimSupportButton from 'component/claimSupportButton';
|
||||
import FileReactions from 'component/fileReactions';
|
||||
import { useHistory } from 'react-router';
|
||||
import { EDIT_PAGE, PAGE_VIEW_QUERY } from 'page/collection/view';
|
||||
import classnames from 'classnames';
|
||||
import { ENABLE_FILE_REACTIONS } from 'config';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
claim: StreamClaim,
|
||||
openModal: (id: string, { uri: string, claimIsMine?: boolean, isSupport?: boolean }) => void,
|
||||
myChannels: ?Array<ChannelClaim>,
|
||||
doToast: ({ message: string }) => void,
|
||||
claimIsPending: boolean,
|
||||
isMyCollection: boolean,
|
||||
collectionId: string,
|
||||
showInfo: boolean,
|
||||
setShowInfo: (boolean) => void,
|
||||
collectionHasEdits: boolean,
|
||||
};
|
||||
|
||||
function CollectionActions(props: Props) {
|
||||
const {
|
||||
uri,
|
||||
openModal,
|
||||
claim,
|
||||
claimIsPending,
|
||||
isMyCollection,
|
||||
collectionId,
|
||||
showInfo,
|
||||
setShowInfo,
|
||||
collectionHasEdits,
|
||||
} = props;
|
||||
const { push } = useHistory();
|
||||
const isMobile = useIsMobile();
|
||||
const claimId = claim && claim.claim_id;
|
||||
const webShareable = true; // collections have cost?
|
||||
const lhsSection = (
|
||||
<>
|
||||
{ENABLE_FILE_REACTIONS && uri && <FileReactions uri={uri} />}
|
||||
{uri && <ClaimSupportButton uri={uri} fileAction />}
|
||||
{/* TODO Add ClaimRepostButton component */}
|
||||
{uri && (
|
||||
<Button
|
||||
className="button--file-action"
|
||||
icon={ICONS.SHARE}
|
||||
label={__('Share')}
|
||||
title={__('Share')}
|
||||
onClick={() => openModal(MODALS.SOCIAL_SHARE, { uri, webShareable })}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
const rhsSection = (
|
||||
<>
|
||||
{isMyCollection && (
|
||||
<Button
|
||||
title={uri ? __('Update') : __('Publish')}
|
||||
label={uri ? __('Update') : __('Publish')}
|
||||
className={classnames('button--file-action')}
|
||||
onClick={() => push(`?${PAGE_VIEW_QUERY}=${EDIT_PAGE}`)}
|
||||
icon={ICONS.PUBLISH}
|
||||
iconColor={collectionHasEdits && 'red'}
|
||||
iconSize={18}
|
||||
disabled={claimIsPending}
|
||||
/>
|
||||
)}
|
||||
{isMyCollection && (
|
||||
<Button
|
||||
className={classnames('button--file-action')}
|
||||
title={__('Delete List')}
|
||||
onClick={() => openModal(MODALS.COLLECTION_DELETE, { uri, collectionId, redirect: `/$/${PAGES.LISTS}` })}
|
||||
icon={ICONS.DELETE}
|
||||
iconSize={18}
|
||||
description={__('Delete List')}
|
||||
disabled={claimIsPending}
|
||||
/>
|
||||
)}
|
||||
{!isMyCollection && (
|
||||
<Button
|
||||
title={__('Report content')}
|
||||
className="button--file-action"
|
||||
icon={ICONS.REPORT}
|
||||
navigate={`/$/${PAGES.REPORT_CONTENT}?claimId=${claimId}`}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
const infoButton = (
|
||||
<Button
|
||||
title={__('Info')}
|
||||
className={classnames('button-toggle', {
|
||||
'button-toggle--active': showInfo,
|
||||
})}
|
||||
icon={ICONS.MORE}
|
||||
onClick={() => setShowInfo(!showInfo)}
|
||||
/>
|
||||
);
|
||||
|
||||
if (isMobile) {
|
||||
return (
|
||||
<div className="media__actions">
|
||||
{lhsSection}
|
||||
{rhsSection}
|
||||
{uri && <span>{infoButton}</span>}
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<div className="media__subtitle--between">
|
||||
<div className="section__actions">
|
||||
{lhsSection}
|
||||
{rhsSection}
|
||||
</div>
|
||||
{uri && <>{infoButton}</>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default CollectionActions;
|
||||
@@ -1,24 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import CollectionContent from './view';
|
||||
import {
|
||||
makeSelectUrlsForCollectionId,
|
||||
makeSelectNameForCollectionId,
|
||||
makeSelectCollectionForId,
|
||||
makeSelectClaimForClaimId,
|
||||
makeSelectClaimIsMine,
|
||||
} from 'lbry-redux';
|
||||
|
||||
const select = (state, props) => {
|
||||
const claim = makeSelectClaimForClaimId(props.id)(state);
|
||||
const url = claim && claim.permanent_url;
|
||||
|
||||
return {
|
||||
collection: makeSelectCollectionForId(props.id)(state),
|
||||
collectionUrls: makeSelectUrlsForCollectionId(props.id)(state),
|
||||
collectionName: makeSelectNameForCollectionId(props.id)(state),
|
||||
claim,
|
||||
isMine: makeSelectClaimIsMine(url)(state),
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(select)(CollectionContent);
|
||||
@@ -1,42 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import ClaimList from 'component/claimList';
|
||||
import Card from 'component/common/card';
|
||||
import Button from 'component/button';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import Icon from 'component/common/icon';
|
||||
import * as ICONS from 'constants/icons';
|
||||
|
||||
type Props = {
|
||||
collectionUrls: Array<Claim>,
|
||||
collectionName: string,
|
||||
collection: any,
|
||||
createUnpublishedCollection: (string, Array<any>, ?string) => void,
|
||||
id: string,
|
||||
claim: Claim,
|
||||
isMine: boolean,
|
||||
};
|
||||
|
||||
export default function CollectionContent(props: Props) {
|
||||
const { collectionUrls, collectionName, id } = props;
|
||||
|
||||
return (
|
||||
<Card
|
||||
isBodyList
|
||||
className="file-page__recommended"
|
||||
title={
|
||||
<span>
|
||||
<Icon icon={ICONS.STACK} className="icon--margin-right" />
|
||||
{collectionName}
|
||||
</span>
|
||||
}
|
||||
titleActions={
|
||||
<>
|
||||
{/* TODO: BUTTON TO SAVE COLLECTION - Probably save/copy modal */}
|
||||
<Button label={'View List'} button="link" navigate={`/$/${PAGES.LIST}/${id}`} />
|
||||
</>
|
||||
}
|
||||
body={<ClaimList isCardBody type="small" uris={collectionUrls} collectionId={id} empty={__('List is Empty')} />}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectTitleForUri,
|
||||
makeSelectThumbnailForUri,
|
||||
makeSelectMetadataItemForUri,
|
||||
doCollectionPublish,
|
||||
doCollectionPublishUpdate,
|
||||
makeSelectAmountForUri,
|
||||
makeSelectClaimForUri,
|
||||
selectUpdateCollectionError,
|
||||
selectUpdatingCollection,
|
||||
selectCreateCollectionError,
|
||||
selectBalance,
|
||||
doClearCollectionErrors,
|
||||
selectCreatingCollection,
|
||||
makeSelectCollectionForId,
|
||||
makeSelectUrlsForCollectionId,
|
||||
makeSelectClaimIdsForCollectionId,
|
||||
} from 'lbry-redux';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
|
||||
import CollectionPage from './view';
|
||||
import { selectActiveChannelClaim, selectIncognito } from 'redux/selectors/app';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
title: makeSelectTitleForUri(props.uri)(state),
|
||||
thumbnailUrl: makeSelectThumbnailForUri(props.uri)(state),
|
||||
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
|
||||
tags: makeSelectMetadataItemForUri(props.uri, 'tags')(state),
|
||||
locations: makeSelectMetadataItemForUri(props.uri, 'locations')(state),
|
||||
languages: makeSelectMetadataItemForUri(props.uri, 'languages')(state),
|
||||
amount: makeSelectAmountForUri(props.uri)(state),
|
||||
updateError: selectUpdateCollectionError(state),
|
||||
updatingCollection: selectUpdatingCollection(state),
|
||||
createError: selectCreateCollectionError(state),
|
||||
creatingCollection: selectCreatingCollection(state),
|
||||
balance: selectBalance(state),
|
||||
activeChannelClaim: selectActiveChannelClaim(state),
|
||||
incognito: selectIncognito(state),
|
||||
collection: makeSelectCollectionForId(props.collectionId)(state),
|
||||
collectionUrls: makeSelectUrlsForCollectionId(props.collectionId)(state),
|
||||
collectionClaimIds: makeSelectClaimIdsForCollectionId(props.collectionId)(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
publishCollectionUpdate: (params) => dispatch(doCollectionPublishUpdate(params)),
|
||||
publishCollection: (params, collectionId) => dispatch(doCollectionPublish(params, collectionId)),
|
||||
clearCollectionErrors: () => dispatch(doClearCollectionErrors()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CollectionPage);
|
||||
@@ -1,441 +0,0 @@
|
||||
// @flow
|
||||
import { DOMAIN } from 'config';
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import Button from 'component/button';
|
||||
import TagsSearch from 'component/tagsSearch';
|
||||
import ErrorText from 'component/common/error-text';
|
||||
import ClaimAbandonButton from 'component/claimAbandonButton';
|
||||
import ChannelSelector from 'component/channelSelector';
|
||||
import ClaimList from 'component/claimList';
|
||||
import Card from 'component/common/card';
|
||||
import LbcSymbol from 'component/common/lbc-symbol';
|
||||
import ThumbnailPicker from 'component/thumbnailPicker';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import { isNameValid, regexInvalidURI } from 'lbry-redux';
|
||||
import { Tabs, TabList, Tab, TabPanels, TabPanel } from 'component/common/tabs';
|
||||
import { FormField } from 'component/common/form';
|
||||
import { handleBidChange } from 'util/publish';
|
||||
import { FF_MAX_CHARS_IN_DESCRIPTION } from 'constants/form-field';
|
||||
import { INVALID_NAME_ERROR } from 'constants/claim';
|
||||
import SUPPORTED_LANGUAGES from 'constants/supported_languages';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import analytics from 'analytics';
|
||||
const LANG_NONE = 'none';
|
||||
const MAX_TAG_SELECT = 5;
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
claim: CollectionClaim,
|
||||
balance: number,
|
||||
disabled: boolean,
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
incognito: boolean,
|
||||
// params
|
||||
title: string,
|
||||
amount: number,
|
||||
thumbnailUrl: string,
|
||||
description: string,
|
||||
tags: Array<string>,
|
||||
locations: Array<string>,
|
||||
languages: Array<string>,
|
||||
|
||||
collectionId: string,
|
||||
collection: Collection,
|
||||
collectionClaimIds: Array<string>,
|
||||
collectionUrls: Array<string>,
|
||||
publishCollectionUpdate: (CollectionUpdateParams) => Promise<any>,
|
||||
updatingCollection: boolean,
|
||||
updateError: string,
|
||||
publishCollection: (CollectionPublishParams, string) => Promise<any>,
|
||||
createError: string,
|
||||
creatingCollection: boolean,
|
||||
clearCollectionErrors: () => void,
|
||||
onDone: (string) => void,
|
||||
openModal: (
|
||||
id: string,
|
||||
{ onUpdate: (string) => void, assetName: string, helpText: string, currentValue: string, title: string }
|
||||
) => void,
|
||||
};
|
||||
|
||||
function CollectionForm(props: Props) {
|
||||
const {
|
||||
uri, // collection uri
|
||||
claim,
|
||||
balance,
|
||||
// publish params
|
||||
amount,
|
||||
title,
|
||||
description,
|
||||
thumbnailUrl,
|
||||
tags,
|
||||
locations,
|
||||
languages = [],
|
||||
// rest
|
||||
onDone,
|
||||
publishCollectionUpdate,
|
||||
updateError,
|
||||
updatingCollection,
|
||||
publishCollection,
|
||||
creatingCollection,
|
||||
createError,
|
||||
disabled,
|
||||
activeChannelClaim,
|
||||
incognito,
|
||||
collectionId,
|
||||
collection,
|
||||
collectionUrls,
|
||||
collectionClaimIds,
|
||||
} = props;
|
||||
const activeChannelName = activeChannelClaim && activeChannelClaim.name;
|
||||
let prefix = IS_WEB ? `${DOMAIN}/` : 'lbry://';
|
||||
if (activeChannelName && !incognito) {
|
||||
prefix += `${activeChannelName}/`;
|
||||
}
|
||||
const activeChannelId = activeChannelClaim && activeChannelClaim.claim_id;
|
||||
const collectionName = (claim && claim.name) || (collection && collection.name);
|
||||
|
||||
const [nameError, setNameError] = React.useState(undefined);
|
||||
const [bidError, setBidError] = React.useState('');
|
||||
const [params, setParams]: [any, (any) => void] = React.useState(getCollectionParams());
|
||||
const name = params.name;
|
||||
const isNewCollection = !uri;
|
||||
const { replace } = useHistory();
|
||||
const languageParam = params.languages;
|
||||
const primaryLanguage = Array.isArray(languageParam) && languageParam.length && languageParam[0];
|
||||
const secondaryLanguage = Array.isArray(languageParam) && languageParam.length >= 2 && languageParam[1];
|
||||
|
||||
const collectionClaimIdsString = JSON.stringify(collectionClaimIds);
|
||||
|
||||
function parseName(newName) {
|
||||
let INVALID_URI_CHARS = new RegExp(regexInvalidURI, 'gu');
|
||||
return newName.replace(INVALID_URI_CHARS, '-');
|
||||
}
|
||||
|
||||
function setParam(paramObj) {
|
||||
setParams({ ...params, ...paramObj });
|
||||
}
|
||||
|
||||
function getCollectionParams() {
|
||||
const collectionParams: {
|
||||
thumbnail_url?: string,
|
||||
name?: string,
|
||||
description?: string,
|
||||
title?: string,
|
||||
bid: string,
|
||||
languages?: ?Array<string>,
|
||||
locations?: ?Array<string>,
|
||||
tags?: ?Array<{ name: string }>,
|
||||
claim_id?: string,
|
||||
channel_id?: string,
|
||||
claims: ?Array<string>,
|
||||
} = {
|
||||
thumbnail_url: thumbnailUrl,
|
||||
description,
|
||||
bid: String(amount || 0.001),
|
||||
languages: languages || [],
|
||||
locations: locations || [],
|
||||
tags: tags
|
||||
? tags.map((tag) => {
|
||||
return { name: tag };
|
||||
})
|
||||
: [],
|
||||
claims: collectionClaimIds,
|
||||
};
|
||||
collectionParams['name'] = parseName(collectionName);
|
||||
|
||||
if (activeChannelId) {
|
||||
collectionParams['channel_id'] = activeChannelId;
|
||||
}
|
||||
|
||||
if (!claim) {
|
||||
collectionParams['title'] = collectionName;
|
||||
}
|
||||
|
||||
if (claim) {
|
||||
collectionParams['claim_id'] = claim.claim_id;
|
||||
collectionParams['title'] = title;
|
||||
}
|
||||
|
||||
return collectionParams;
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
const collectionClaimIds = JSON.parse(collectionClaimIdsString);
|
||||
setParams({ ...params, claims: collectionClaimIds });
|
||||
}, [collectionClaimIdsString, setParams]);
|
||||
|
||||
function handleLanguageChange(index, code) {
|
||||
let langs = [...languageParam];
|
||||
if (index === 0) {
|
||||
if (code === LANG_NONE) {
|
||||
// clear all
|
||||
langs = [];
|
||||
} else {
|
||||
langs[0] = code;
|
||||
}
|
||||
} else {
|
||||
if (code === LANG_NONE || code === langs[0]) {
|
||||
langs.splice(1, 1);
|
||||
} else {
|
||||
langs[index] = code;
|
||||
}
|
||||
}
|
||||
setParams({ ...params, languages: langs });
|
||||
}
|
||||
|
||||
function handleThumbnailChange(thumbnailUrl: string) {
|
||||
setParams({ ...params, thumbnail_url: thumbnailUrl });
|
||||
}
|
||||
|
||||
function handleSubmit() {
|
||||
if (uri) {
|
||||
publishCollectionUpdate(params).then((pendingClaim) => {
|
||||
if (pendingClaim) {
|
||||
const claimId = pendingClaim.claim_id;
|
||||
analytics.apiLogPublish(pendingClaim);
|
||||
onDone(claimId);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
publishCollection(params, collectionId).then((pendingClaim) => {
|
||||
if (pendingClaim) {
|
||||
const claimId = pendingClaim.claim_id;
|
||||
analytics.apiLogPublish(pendingClaim);
|
||||
onDone(claimId);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
React.useEffect(() => {
|
||||
let nameError;
|
||||
if (!name && name !== undefined) {
|
||||
nameError = __('A name is required for your url');
|
||||
} else if (!isNameValid(name, false)) {
|
||||
nameError = INVALID_NAME_ERROR;
|
||||
}
|
||||
|
||||
setNameError(nameError);
|
||||
}, [name]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (incognito) {
|
||||
const newParams = Object.assign({}, params);
|
||||
delete newParams.channel_id;
|
||||
setParams(newParams);
|
||||
} else if (activeChannelId) {
|
||||
setParams({ ...params, channel_id: activeChannelId });
|
||||
}
|
||||
}, [activeChannelId, incognito, setParams]);
|
||||
const itemError = !params.claims.length ? __('Cannot publish empty collection') : '';
|
||||
const submitError = nameError || bidError || itemError || updateError || createError;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={classnames('main--contained', { 'card--disabled': disabled })}>
|
||||
<Tabs>
|
||||
<TabList className="tabs__list--collection-edit-page">
|
||||
<Tab>{__('General')}</Tab>
|
||||
<Tab>{__('Items')}</Tab>
|
||||
<Tab>{__('Credits')}</Tab>
|
||||
<Tab>{__('Tags')}</Tab>
|
||||
<Tab>{__('Other')}</Tab>
|
||||
</TabList>
|
||||
<TabPanels>
|
||||
<TabPanel>
|
||||
<div className={'card-stack'}>
|
||||
<ChannelSelector disabled={disabled} />
|
||||
<Card
|
||||
body={
|
||||
<>
|
||||
<fieldset-group className="fieldset-group--smushed fieldset-group--disabled-prefix">
|
||||
<fieldset-section>
|
||||
<label htmlFor="channel_name">{__('Channel')}</label>
|
||||
</fieldset-section>
|
||||
</fieldset-group>
|
||||
<fieldset-group class="fieldset-group--smushed fieldset-group--disabled-prefix">
|
||||
<fieldset-section>
|
||||
<label htmlFor="channel_name">{__('Name')}</label>
|
||||
<div className="form-field__prefix">{prefix}</div>
|
||||
</fieldset-section>
|
||||
|
||||
<FormField
|
||||
autoFocus={isNewCollection}
|
||||
type="text"
|
||||
name="channel_name"
|
||||
placeholder={__('MyAwesomeCollection')}
|
||||
value={params.name}
|
||||
error={nameError}
|
||||
disabled={!isNewCollection}
|
||||
onChange={(e) => setParams({ ...params, name: e.target.value || '' })}
|
||||
/>
|
||||
</fieldset-group>
|
||||
{!isNewCollection && (
|
||||
<span className="form-field__help">{__('This field cannot be changed.')}</span>
|
||||
)}
|
||||
|
||||
<FormField
|
||||
type="text"
|
||||
name="channel_title2"
|
||||
label={__('Title')}
|
||||
placeholder={__('My Awesome Collection')}
|
||||
value={params.title}
|
||||
onChange={(e) => setParams({ ...params, title: e.target.value })}
|
||||
/>
|
||||
<ThumbnailPicker
|
||||
inline
|
||||
thumbnailParam={params.thumbnail_url}
|
||||
updateThumbnailParam={handleThumbnailChange}
|
||||
/>
|
||||
<FormField
|
||||
type="markdown"
|
||||
name="content_description2"
|
||||
label={__('Description')}
|
||||
placeholder={__('Description of your content')}
|
||||
value={params.description}
|
||||
onChange={(text) => setParams({ ...params, description: text })}
|
||||
textAreaMaxLength={FF_MAX_CHARS_IN_DESCRIPTION}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<ClaimList
|
||||
uris={collectionUrls}
|
||||
collectionId={collectionId}
|
||||
empty={__('This collection has no items.')}
|
||||
/>
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<Card
|
||||
body={
|
||||
<FormField
|
||||
className="form-field--price-amount"
|
||||
type="number"
|
||||
name="content_bid2"
|
||||
step="any"
|
||||
label={<LbcSymbol postfix={__('Deposit')} size={14} />}
|
||||
value={params.bid}
|
||||
error={bidError}
|
||||
min="0.0"
|
||||
disabled={false}
|
||||
onChange={(event) =>
|
||||
handleBidChange(parseFloat(event.target.value), amount, balance, setBidError, setParam)
|
||||
}
|
||||
placeholder={0.1}
|
||||
helper={__('Increasing your deposit can help your channel be discovered more easily.')}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<Card
|
||||
body={
|
||||
<TagsSearch
|
||||
suggestMature
|
||||
disableAutoFocus
|
||||
limitSelect={MAX_TAG_SELECT}
|
||||
tagsPassedIn={params.tags || []}
|
||||
label={__('Selected Tags')}
|
||||
onRemove={(clickedTag) => {
|
||||
const newTags = params.tags.slice().filter((tag) => tag.name !== clickedTag.name);
|
||||
setParams({ ...params, tags: newTags });
|
||||
}}
|
||||
onSelect={(newTags) => {
|
||||
newTags.forEach((newTag) => {
|
||||
if (!params.tags.map((savedTag) => savedTag.name).includes(newTag.name)) {
|
||||
setParams({ ...params, tags: [...params.tags, newTag] });
|
||||
} else {
|
||||
// If it already exists and the user types it in, remove it
|
||||
setParams({ ...params, tags: params.tags.filter((tag) => tag.name !== newTag.name) });
|
||||
}
|
||||
});
|
||||
}}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</TabPanel>
|
||||
<TabPanel>
|
||||
<Card
|
||||
body={
|
||||
<>
|
||||
<FormField
|
||||
name="language_select"
|
||||
type="select"
|
||||
label={__('Primary Language')}
|
||||
onChange={(event) => handleLanguageChange(0, event.target.value)}
|
||||
value={primaryLanguage}
|
||||
helper={__('Your main content language')}
|
||||
>
|
||||
<option key={'pri-langNone'} value={LANG_NONE}>
|
||||
{__('None selected')}
|
||||
</option>
|
||||
{Object.keys(SUPPORTED_LANGUAGES).map((language) => (
|
||||
<option key={language} value={language}>
|
||||
{SUPPORTED_LANGUAGES[language]}
|
||||
</option>
|
||||
))}
|
||||
</FormField>
|
||||
<FormField
|
||||
name="language_select2"
|
||||
type="select"
|
||||
label={__('Secondary Language')}
|
||||
onChange={(event) => handleLanguageChange(1, event.target.value)}
|
||||
value={secondaryLanguage}
|
||||
disabled={!languageParam[0]}
|
||||
helper={__('Your other content language')}
|
||||
>
|
||||
<option key={'sec-langNone'} value={LANG_NONE}>
|
||||
{__('None selected')}
|
||||
</option>
|
||||
{Object.keys(SUPPORTED_LANGUAGES)
|
||||
.filter((lang) => lang !== languageParam[0])
|
||||
.map((language) => (
|
||||
<option key={language} value={language}>
|
||||
{SUPPORTED_LANGUAGES[language]}
|
||||
</option>
|
||||
))}
|
||||
</FormField>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</TabPanel>
|
||||
</TabPanels>
|
||||
</Tabs>
|
||||
<Card
|
||||
className="card--after-tabs"
|
||||
actions={
|
||||
<>
|
||||
<div className="section__actions">
|
||||
<Button
|
||||
button="primary"
|
||||
disabled={creatingCollection || updatingCollection || nameError || bidError || !params.claims.length}
|
||||
label={creatingCollection || updatingCollection ? __('Submitting') : __('Submit')}
|
||||
onClick={handleSubmit}
|
||||
/>
|
||||
<Button button="link" label={__('Cancel')} onClick={() => onDone(collectionId)} />
|
||||
</div>
|
||||
{submitError ? (
|
||||
<ErrorText>{submitError}</ErrorText>
|
||||
) : (
|
||||
<p className="help">
|
||||
{__('After submitting, it will take a few minutes for your changes to be live for everyone.')}
|
||||
</p>
|
||||
)}
|
||||
{!isNewCollection && (
|
||||
<div className="section__actions">
|
||||
<ClaimAbandonButton uri={uri} abandonActionCallback={() => replace(`/$/${PAGES.LIBRARY}`)} />
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default CollectionForm;
|
||||
@@ -1,16 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { doCollectionEdit, makeSelectNameForCollectionId, doCollectionDelete } from 'lbry-redux';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import CollectionMenuList from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
return {
|
||||
collectionName: makeSelectNameForCollectionId(props.collectionId)(state),
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(select, {
|
||||
doCollectionEdit,
|
||||
doOpenModal,
|
||||
doCollectionDelete,
|
||||
})(CollectionMenuList);
|
||||
@@ -1,68 +0,0 @@
|
||||
// @flow
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import { Menu, MenuButton, MenuList, MenuItem } from '@reach/menu-button';
|
||||
import Icon from 'component/common/icon';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import { useHistory } from 'react-router';
|
||||
|
||||
type Props = {
|
||||
inline?: boolean,
|
||||
doOpenModal: (string, {}) => void,
|
||||
collectionName?: string,
|
||||
collectionId: string,
|
||||
};
|
||||
|
||||
function ClaimMenuList(props: Props) {
|
||||
const { inline = false, collectionId, collectionName, doOpenModal } = props;
|
||||
|
||||
const { push } = useHistory();
|
||||
|
||||
return (
|
||||
<Menu>
|
||||
<MenuButton
|
||||
className={classnames('menu__button', { 'claim__menu-button': !inline, 'claim__menu-button--inline': inline })}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}}
|
||||
>
|
||||
<Icon size={20} icon={ICONS.MORE_VERTICAL} />
|
||||
</MenuButton>
|
||||
<MenuList className="menu__list">
|
||||
{collectionId && collectionName && (
|
||||
<>
|
||||
<MenuItem className="comment__menu-option" onSelect={() => push(`/$/${PAGES.LIST}/${collectionId}`)}>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.VIEW} />
|
||||
{__('View List')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => push(`/$/${PAGES.LIST}/${collectionId}?view=edit`)}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.PUBLISH} />
|
||||
{__('Publish List')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
className="comment__menu-option"
|
||||
onSelect={() => doOpenModal(MODALS.COLLECTION_DELETE, { collectionId })}
|
||||
>
|
||||
<div className="menu__link">
|
||||
<Icon aria-hidden icon={ICONS.DELETE} />
|
||||
{__('Delete List')}
|
||||
</div>
|
||||
</MenuItem>
|
||||
</>
|
||||
)}
|
||||
</MenuList>
|
||||
</Menu>
|
||||
);
|
||||
}
|
||||
|
||||
export default ClaimMenuList;
|
||||
@@ -1,30 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
makeSelectIsUriResolving,
|
||||
makeSelectClaimIdForUri,
|
||||
makeSelectClaimForClaimId,
|
||||
makeSelectUrlsForCollectionId,
|
||||
makeSelectNameForCollectionId,
|
||||
makeSelectPendingCollectionForId,
|
||||
makeSelectCountForCollectionId,
|
||||
} from 'lbry-redux';
|
||||
import CollectionPreviewOverlay from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const collectionId = props.collectionId || (props.uri && makeSelectClaimIdForUri(props.uri));
|
||||
const claim = props.collectionId && makeSelectClaimForClaimId(props.collectionId)(state);
|
||||
const collectionUri = props.uri || (claim && (claim.canonical_url || claim.permanent_url)) || null;
|
||||
|
||||
return {
|
||||
collectionId,
|
||||
uri: collectionUri,
|
||||
collectionCount: makeSelectCountForCollectionId(collectionId)(state),
|
||||
collectionName: makeSelectNameForCollectionId(collectionId)(state),
|
||||
collectionItemUrls: makeSelectUrlsForCollectionId(collectionId)(state), // ForId || ForUri
|
||||
pendingCollection: makeSelectPendingCollectionForId(collectionId)(state),
|
||||
claim,
|
||||
isResolvingUri: collectionUri && makeSelectIsUriResolving(collectionUri)(state),
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(select)(CollectionPreviewOverlay);
|
||||
@@ -1,42 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import FileThumbnail from 'component/fileThumbnail';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
collectionId: string,
|
||||
collectionName: string,
|
||||
collectionCount: number,
|
||||
editedCollection?: Collection,
|
||||
pendingCollection?: Collection,
|
||||
claim: ?Claim,
|
||||
collectionItemUrls: Array<string>,
|
||||
};
|
||||
|
||||
function CollectionPreviewTileOverlay(props: Props) {
|
||||
const { collectionItemUrls } = props;
|
||||
|
||||
if (collectionItemUrls && collectionItemUrls.length > 0) {
|
||||
return (
|
||||
<div className="collection-preview__overlay-thumbs">
|
||||
<div className="collection-preview__overlay-side" />
|
||||
<div className="collection-preview__overlay-grid">
|
||||
{collectionItemUrls &&
|
||||
collectionItemUrls.map((item, index) => {
|
||||
if (index < 2) {
|
||||
return (
|
||||
<div className="collection-preview__overlay-grid-items">
|
||||
<FileThumbnail uri={item} key={item} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export default withRouter(CollectionPreviewTileOverlay);
|
||||
@@ -1,19 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import Icon from 'component/common/icon';
|
||||
type Props = {
|
||||
count: number,
|
||||
};
|
||||
|
||||
export default function collectionCount(props: Props) {
|
||||
const { count = 0 } = props;
|
||||
|
||||
return (
|
||||
<div className={classnames('claim-preview__overlay-properties', 'claim-preview__overlay-properties--small')}>
|
||||
<Icon icon={ICONS.STACK} />
|
||||
<div>{count}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import Icon from 'component/common/icon';
|
||||
|
||||
export default function collectionCount() {
|
||||
return (
|
||||
<div className={classnames('claim-preview__overlay-properties', 'claim-preview__overlay-properties--small')}>
|
||||
<Icon icon={ICONS.LOCK} />
|
||||
<div>{__('Private')}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doResolveUri,
|
||||
makeSelectIsUriResolving,
|
||||
makeSelectThumbnailForUri,
|
||||
makeSelectTitleForUri,
|
||||
makeSelectChannelForClaimUri,
|
||||
makeSelectClaimIsNsfw,
|
||||
makeSelectClaimIdForUri,
|
||||
makeSelectClaimForClaimId,
|
||||
makeSelectUrlsForCollectionId,
|
||||
makeSelectNameForCollectionId,
|
||||
doLocalCollectionDelete,
|
||||
doFetchItemsInCollection,
|
||||
makeSelectEditedCollectionForId,
|
||||
makeSelectPendingCollectionForId,
|
||||
makeSelectCountForCollectionId,
|
||||
makeSelectIsResolvingCollectionForId,
|
||||
} from 'lbry-redux';
|
||||
import { selectMutedChannels } from 'redux/selectors/blocked';
|
||||
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
|
||||
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||
import CollectionPreviewTile from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
const collectionId = props.collectionId || (props.uri && makeSelectClaimIdForUri(props.uri));
|
||||
const claim = props.collectionId && makeSelectClaimForClaimId(props.collectionId)(state);
|
||||
const collectionUri = props.uri || (claim && (claim.canonical_url || claim.permanent_url)) || null;
|
||||
|
||||
return {
|
||||
collectionId,
|
||||
uri: collectionUri,
|
||||
collectionCount: makeSelectCountForCollectionId(collectionId)(state),
|
||||
collectionName: makeSelectNameForCollectionId(collectionId)(state),
|
||||
collectionItemUrls: makeSelectUrlsForCollectionId(collectionId)(state), // ForId || ForUri
|
||||
editedCollection: makeSelectEditedCollectionForId(collectionId)(state),
|
||||
pendingCollection: makeSelectPendingCollectionForId(collectionId)(state),
|
||||
claim,
|
||||
isResolvingCollectionClaims: makeSelectIsResolvingCollectionForId(collectionId)(state),
|
||||
channelClaim: collectionUri && makeSelectChannelForClaimUri(collectionUri)(state),
|
||||
isResolvingUri: collectionUri && makeSelectIsUriResolving(collectionUri)(state),
|
||||
thumbnail: collectionUri && makeSelectThumbnailForUri(collectionUri)(state),
|
||||
title: collectionUri && makeSelectTitleForUri(collectionUri)(state),
|
||||
blackListedOutpoints: selectBlackListedOutpoints(state),
|
||||
filteredOutpoints: selectFilteredOutpoints(state),
|
||||
blockedChannelUris: selectMutedChannels(state),
|
||||
showMature: selectShowMatureContent(state),
|
||||
isMature: makeSelectClaimIsNsfw(collectionUri)(state),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
resolveUri: (uri) => dispatch(doResolveUri(uri)),
|
||||
resolveCollectionItems: (options) => doFetchItemsInCollection(options),
|
||||
deleteCollection: (id) => dispatch(doLocalCollectionDelete(id)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CollectionPreviewTile);
|
||||
@@ -1,171 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import { NavLink, useHistory } from 'react-router-dom';
|
||||
import ClaimPreviewTile from 'component/claimPreviewTile';
|
||||
import TruncatedText from 'component/common/truncated-text';
|
||||
import CollectionCount from './collectionCount';
|
||||
import CollectionPrivate from './collectionPrivate';
|
||||
import CollectionMenuList from 'component/collectionMenuList';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { COLLECTIONS_CONSTS } from 'lbry-redux';
|
||||
import FileThumbnail from 'component/fileThumbnail';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
collectionId: string,
|
||||
collectionName: string,
|
||||
collectionCount: number,
|
||||
editedCollection?: Collection,
|
||||
pendingCollection?: Collection,
|
||||
claim: ?Claim,
|
||||
channelClaim: ?ChannelClaim,
|
||||
collectionItemUrls: Array<string>,
|
||||
resolveUri: (string) => void,
|
||||
isResolvingUri: boolean,
|
||||
thumbnail?: string,
|
||||
title?: string,
|
||||
placeholder: boolean,
|
||||
blackListedOutpoints: Array<{
|
||||
txid: string,
|
||||
nout: number,
|
||||
}>,
|
||||
filteredOutpoints: Array<{
|
||||
txid: string,
|
||||
nout: number,
|
||||
}>,
|
||||
blockedChannelUris: Array<string>,
|
||||
isMature?: boolean,
|
||||
showMature: boolean,
|
||||
collectionId: string,
|
||||
deleteCollection: (string) => void,
|
||||
resolveCollectionItems: (any) => void,
|
||||
isResolvingCollectionClaims: boolean,
|
||||
};
|
||||
|
||||
function CollectionPreviewTile(props: Props) {
|
||||
const {
|
||||
uri,
|
||||
collectionId,
|
||||
collectionName,
|
||||
collectionCount,
|
||||
isResolvingUri,
|
||||
isResolvingCollectionClaims,
|
||||
collectionItemUrls,
|
||||
claim,
|
||||
resolveCollectionItems,
|
||||
} = props;
|
||||
|
||||
const { push } = useHistory();
|
||||
const hasClaim = Boolean(claim);
|
||||
React.useEffect(() => {
|
||||
if (collectionId && hasClaim && resolveCollectionItems) {
|
||||
resolveCollectionItems({ collectionId, page_size: 5 });
|
||||
}
|
||||
}, [collectionId, hasClaim]);
|
||||
|
||||
// const signingChannel = claim && claim.signing_channel;
|
||||
|
||||
let navigateUrl = formatLbryUrlForWeb(collectionItemUrls[0] || '/');
|
||||
if (collectionId) {
|
||||
const collectionParams = new URLSearchParams();
|
||||
collectionParams.set(COLLECTIONS_CONSTS.COLLECTION_ID, collectionId);
|
||||
navigateUrl = navigateUrl + `?` + collectionParams.toString();
|
||||
}
|
||||
|
||||
function handleClick(e) {
|
||||
if (navigateUrl) {
|
||||
push(navigateUrl);
|
||||
}
|
||||
}
|
||||
|
||||
const navLinkProps = {
|
||||
to: navigateUrl,
|
||||
onClick: (e) => e.stopPropagation(),
|
||||
};
|
||||
|
||||
/* REMOVE IF WORKS
|
||||
let shouldHide = false;
|
||||
|
||||
if (isMature && !showMature) {
|
||||
// Unfortunately needed until this is resolved
|
||||
// https://github.com/lbryio/lbry-sdk/issues/2785
|
||||
shouldHide = true;
|
||||
}
|
||||
|
||||
// This will be replaced once blocking is done at the wallet server level
|
||||
if (claim && !shouldHide && blackListedOutpoints) {
|
||||
shouldHide = blackListedOutpoints.some(
|
||||
(outpoint) =>
|
||||
(signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) ||
|
||||
(outpoint.txid === claim.txid && outpoint.nout === claim.nout)
|
||||
);
|
||||
}
|
||||
// We're checking to see if the stream outpoint
|
||||
// or signing channel outpoint is in the filter list
|
||||
if (claim && !shouldHide && filteredOutpoints) {
|
||||
shouldHide = filteredOutpoints.some(
|
||||
(outpoint) =>
|
||||
(signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) ||
|
||||
(outpoint.txid === claim.txid && outpoint.nout === claim.nout)
|
||||
);
|
||||
}
|
||||
|
||||
// block stream claims
|
||||
if (claim && !shouldHide && blockedChannelUris.length && signingChannel) {
|
||||
shouldHide = blockedChannelUris.some((blockedUri) => blockedUri === signingChannel.permanent_url);
|
||||
}
|
||||
// block channel claims if we can't control for them in claim search
|
||||
// e.g. fetchRecommendedSubscriptions
|
||||
|
||||
if (shouldHide) {
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
|
||||
if (isResolvingUri || isResolvingCollectionClaims) {
|
||||
return (
|
||||
<li className={classnames('claim-preview--tile', {})}>
|
||||
<div className="placeholder media__thumb" />
|
||||
<div className="placeholder__wrapper">
|
||||
<div className="placeholder claim-tile__title" />
|
||||
<div className="placeholder claim-tile__info" />
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
if (uri) {
|
||||
return <ClaimPreviewTile uri={uri} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<li role="link" onClick={handleClick} className={'card claim-preview--tile'}>
|
||||
<NavLink {...navLinkProps}>
|
||||
<FileThumbnail uri={collectionItemUrls && collectionItemUrls.length && collectionItemUrls[0]}>
|
||||
<React.Fragment>
|
||||
<div className="claim-preview__claim-property-overlay">
|
||||
<CollectionCount count={collectionCount} />
|
||||
</div>
|
||||
</React.Fragment>
|
||||
</FileThumbnail>
|
||||
</NavLink>
|
||||
<NavLink {...navLinkProps}>
|
||||
<h2 className="claim-tile__title">
|
||||
<TruncatedText text={collectionName} lines={1} />
|
||||
<CollectionMenuList collectionId={collectionId} />
|
||||
</h2>
|
||||
</NavLink>
|
||||
<div>
|
||||
<div className="claim-tile__info">
|
||||
<React.Fragment>
|
||||
<div className="claim-tile__about">
|
||||
<CollectionPrivate />
|
||||
</div>
|
||||
</React.Fragment>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
export default CollectionPreviewTile;
|
||||
@@ -1,22 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doCollectionEdit,
|
||||
makeSelectCollectionForId,
|
||||
makeSelectClaimIsPending,
|
||||
makeSelectCollectionForIdHasClaimUrl,
|
||||
} from 'lbry-redux';
|
||||
import CollectionSelectItem from './view';
|
||||
|
||||
const select = (state, props) => {
|
||||
return {
|
||||
collection: makeSelectCollectionForId(props.collectionId)(state),
|
||||
hasClaim: makeSelectCollectionForIdHasClaimUrl(props.collectionId, props.uri)(state),
|
||||
collectionPending: makeSelectClaimIsPending(props.collectionId)(state),
|
||||
};
|
||||
};
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
editCollection: (id, params) => dispatch(doCollectionEdit(id, params)),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(CollectionSelectItem);
|
||||
@@ -1,59 +0,0 @@
|
||||
// @flow
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import { FormField } from 'component/common/form';
|
||||
import Icon from 'component/common/icon';
|
||||
import { COLLECTIONS_CONSTS } from 'lbry-redux';
|
||||
|
||||
type Props = {
|
||||
collection: Collection,
|
||||
hasClaim: boolean,
|
||||
category: string,
|
||||
edited: boolean,
|
||||
editCollection: (string, CollectionEditParams) => void,
|
||||
claim: Claim,
|
||||
collectionPending: Collection,
|
||||
};
|
||||
|
||||
function CollectionSelectItem(props: Props) {
|
||||
const { collection, hasClaim, category, editCollection, claim, collectionPending } = props;
|
||||
const { name, id } = collection;
|
||||
const handleChange = (e) => {
|
||||
editCollection(id, { claims: [claim], remove: hasClaim });
|
||||
};
|
||||
|
||||
let icon;
|
||||
switch (category) {
|
||||
case 'builtin':
|
||||
icon = id === COLLECTIONS_CONSTS.WATCH_LATER_ID ? ICONS.TIME : ICONS.STACK;
|
||||
break;
|
||||
case 'published':
|
||||
icon = ICONS.STACK;
|
||||
break;
|
||||
default:
|
||||
// 'unpublished'
|
||||
icon = ICONS.LOCK;
|
||||
break;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={'collection-select__item'}>
|
||||
<FormField
|
||||
checked={hasClaim}
|
||||
disabled={collectionPending}
|
||||
icon={icon}
|
||||
type="checkbox"
|
||||
name={`select-${id}`}
|
||||
onChange={handleChange} // edit the collection
|
||||
label={
|
||||
<span>
|
||||
<Icon icon={icon} className={'icon-collection-select'} />
|
||||
{`${name}`}
|
||||
</span>
|
||||
} // the collection name
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default CollectionSelectItem;
|
||||
@@ -1,17 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
selectBuiltinCollections,
|
||||
selectMyPublishedPlaylistCollections,
|
||||
selectMyUnpublishedCollections, // should probably distinguish types
|
||||
// selectSavedCollections,
|
||||
} from 'lbry-redux';
|
||||
import CollectionsListMine from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
builtinCollections: selectBuiltinCollections(state),
|
||||
publishedPlaylists: selectMyPublishedPlaylistCollections(state),
|
||||
unpublishedCollections: selectMyUnpublishedCollections(state),
|
||||
// savedCollections: selectSavedCollections(state),
|
||||
});
|
||||
|
||||
export default connect(select)(CollectionsListMine);
|
||||
@@ -1,141 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import CollectionPreviewTile from 'component/collectionPreviewTile';
|
||||
import ClaimList from 'component/claimList';
|
||||
import Button from 'component/button';
|
||||
import { COLLECTIONS_CONSTS } from 'lbry-redux';
|
||||
import Icon from 'component/common/icon';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import Yrbl from 'component/yrbl';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
import Card from 'component/common/card';
|
||||
import classnames from 'classnames';
|
||||
|
||||
type Props = {
|
||||
builtinCollections: CollectionGroup,
|
||||
publishedCollections: CollectionGroup,
|
||||
publishedPlaylists: CollectionGroup,
|
||||
unpublishedCollections: CollectionGroup,
|
||||
// savedCollections: CollectionGroup,
|
||||
};
|
||||
|
||||
export default function CollectionsListMine(props: Props) {
|
||||
const {
|
||||
builtinCollections,
|
||||
publishedPlaylists,
|
||||
unpublishedCollections,
|
||||
// savedCollections, these are resolved on startup from sync'd claimIds or urls
|
||||
} = props;
|
||||
|
||||
const builtinCollectionsList = (Object.values(builtinCollections || {}): any);
|
||||
const unpublishedCollectionsList = (Object.keys(unpublishedCollections || {}): any);
|
||||
const publishedList = (Object.keys(publishedPlaylists || {}): any);
|
||||
const hasCollections = unpublishedCollectionsList.length || publishedList.length;
|
||||
|
||||
const watchLater = builtinCollectionsList.find((list) => list.id === COLLECTIONS_CONSTS.WATCH_LATER_ID);
|
||||
const favorites = builtinCollectionsList.find((list) => list.id === COLLECTIONS_CONSTS.FAVORITES_ID);
|
||||
const builtin = [watchLater, favorites];
|
||||
const [showHelp, setShowHelp] = usePersistedState('livestream-help-seen', true);
|
||||
|
||||
const helpText = (
|
||||
<div className="section__subtitle">
|
||||
<p>{__(`Everyone starts with 2 private lists - Watch Later and Favorites.`)}</p>
|
||||
<p>{__(`Add content to existing lists or new lists from content pages or content previews.`)}</p>
|
||||
<p>
|
||||
{__(
|
||||
`By default, lists are private. You can edit them and later publish them from the Lists page or the Publish context menu on this page. Similar to uploads, small blockchain fees apply.`
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
{builtin.map((list: Collection) => {
|
||||
const { items: itemUrls } = list;
|
||||
return (
|
||||
<div className="claim-grid__wrapper" key={list.name}>
|
||||
<>
|
||||
{Boolean(itemUrls && itemUrls.length) && (
|
||||
<>
|
||||
<h1 className="claim-grid__header">
|
||||
<Button
|
||||
className="claim-grid__title"
|
||||
button="link"
|
||||
navigate={`/$/${PAGES.LIST}/${list.id}`}
|
||||
label={
|
||||
<span className="claim-grid__title-span">
|
||||
{list.name}
|
||||
<div className="claim-grid__title--empty">
|
||||
<Icon className="icon--margin-right" icon={ICONS.STACK} />
|
||||
{itemUrls.length}
|
||||
</div>
|
||||
</span>
|
||||
}
|
||||
/>
|
||||
</h1>
|
||||
<ClaimList tileLayout key={list.name} uris={itemUrls.slice(0, 6)} collectionId={list.id} />
|
||||
</>
|
||||
)}
|
||||
{!(itemUrls && itemUrls.length) && (
|
||||
<h1 className="claim-grid__header claim-grid__title">
|
||||
{__('%collection_name%', { collection_name: list.name })}{' '}
|
||||
<div className="claim-grid__title--empty">(Empty)</div>
|
||||
</h1>
|
||||
)}
|
||||
</>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<div className="claim-grid__wrapper">
|
||||
<div className="claim-grid__header claim-grid__header--between section">
|
||||
<h1 className="claim-grid__title">
|
||||
{__('Playlists')}
|
||||
{!hasCollections && <div className="claim-grid__title--empty">(Empty)</div>}
|
||||
</h1>
|
||||
<Button button="link" onClick={() => setShowHelp(!showHelp)} label={__('How does this work?')} />
|
||||
</div>
|
||||
{showHelp && (
|
||||
<Card
|
||||
titleActions={<Button button="close" icon={ICONS.REMOVE} onClick={() => setShowHelp(false)} />}
|
||||
title={__('Introducing Lists')}
|
||||
actions={helpText}
|
||||
/>
|
||||
)}
|
||||
{Boolean(hasCollections) && (
|
||||
<div
|
||||
className={classnames({
|
||||
section: showHelp,
|
||||
})}
|
||||
>
|
||||
{/* TODO: fix above spacing hack */}
|
||||
<div className="claim-grid">
|
||||
{unpublishedCollectionsList &&
|
||||
unpublishedCollectionsList.length > 0 &&
|
||||
unpublishedCollectionsList.map((key) => (
|
||||
<CollectionPreviewTile tileLayout collectionId={key} key={key} />
|
||||
))}
|
||||
{publishedList &&
|
||||
publishedList.length > 0 &&
|
||||
publishedList.map((key) => <CollectionPreviewTile tileLayout collectionId={key} key={key} />)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{!hasCollections && (
|
||||
<div className="main--empty">
|
||||
<Yrbl
|
||||
type={'sad'}
|
||||
title={__('You have no lists yet. Better start hoarding!')}
|
||||
// actions={
|
||||
// <div className="section__actions">
|
||||
// <Button button="primary" label={__('View Content')} onClick={() => setViewBlockedChannel(true)} />
|
||||
// </div>
|
||||
// }
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -31,15 +31,11 @@ type Props = {
|
||||
isReply: boolean,
|
||||
activeChannel: string,
|
||||
activeChannelClaim: ?ChannelClaim,
|
||||
bottom: boolean,
|
||||
onSubmit: (string, string) => void,
|
||||
livestream: boolean,
|
||||
embed?: boolean,
|
||||
livestream?: boolean,
|
||||
toast: (string) => void,
|
||||
claimIsMine: boolean,
|
||||
sendTip: ({}, (any) => void, (any) => void) => void,
|
||||
justCommented: Array<string>,
|
||||
commentingEnabled: boolean,
|
||||
};
|
||||
|
||||
export function CommentCreate(props: Props) {
|
||||
@@ -54,14 +50,10 @@ export function CommentCreate(props: Props) {
|
||||
isReply,
|
||||
parentId,
|
||||
activeChannelClaim,
|
||||
onSubmit,
|
||||
bottom,
|
||||
livestream,
|
||||
embed,
|
||||
toast,
|
||||
claimIsMine,
|
||||
sendTip,
|
||||
commentingEnabled,
|
||||
justCommented,
|
||||
} = props;
|
||||
const buttonref: ElementRef<any> = React.useRef();
|
||||
@@ -70,8 +62,6 @@ export function CommentCreate(props: Props) {
|
||||
location: { pathname },
|
||||
} = useHistory();
|
||||
const [isSubmitting, setIsSubmitting] = React.useState(false);
|
||||
const [commentFailure, setCommentFailure] = React.useState(false);
|
||||
const [successTip, setSuccessTip] = React.useState({ txid: undefined, tipAmount: undefined });
|
||||
const { claim_id: claimId } = claim;
|
||||
const [isSupportComment, setIsSupportComment] = React.useState();
|
||||
const [isReviewingSupportComment, setIsReviewingSupportComment] = React.useState();
|
||||
@@ -96,7 +86,7 @@ export function CommentCreate(props: Props) {
|
||||
|
||||
function altEnterListener(e: SyntheticKeyboardEvent<*>) {
|
||||
const KEYCODE_ENTER = 13;
|
||||
if ((livestream || e.ctrlKey || e.metaKey) && e.keyCode === KEYCODE_ENTER) {
|
||||
if ((e.ctrlKey || e.metaKey) && e.keyCode === KEYCODE_ENTER) {
|
||||
e.preventDefault();
|
||||
buttonref.current.click();
|
||||
}
|
||||
@@ -130,13 +120,6 @@ export function CommentCreate(props: Props) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (commentFailure && tipAmount === successTip.tipAmount) {
|
||||
handleCreateComment(successTip.txid);
|
||||
return;
|
||||
} else {
|
||||
setSuccessTip({ txid: undefined, tipAmount: undefined });
|
||||
}
|
||||
|
||||
const params = {
|
||||
amount: tipAmount,
|
||||
claim_id: claimId,
|
||||
@@ -152,7 +135,6 @@ export function CommentCreate(props: Props) {
|
||||
setTimeout(() => {
|
||||
handleCreateComment(txid);
|
||||
}, 1500);
|
||||
setSuccessTip({ txid, tipAmount });
|
||||
},
|
||||
() => {
|
||||
setIsSubmitting(false);
|
||||
@@ -171,13 +153,8 @@ export function CommentCreate(props: Props) {
|
||||
setLastCommentTime(Date.now());
|
||||
setIsReviewingSupportComment(false);
|
||||
setIsSupportComment(false);
|
||||
setCommentFailure(false);
|
||||
justCommented.push(res.comment_id);
|
||||
|
||||
if (onSubmit) {
|
||||
onSubmit(commentValue, activeChannelClaim.name);
|
||||
}
|
||||
|
||||
if (onDoneReplying) {
|
||||
onDoneReplying();
|
||||
}
|
||||
@@ -185,7 +162,6 @@ export function CommentCreate(props: Props) {
|
||||
})
|
||||
.catch(() => {
|
||||
setIsSubmitting(false);
|
||||
setCommentFailure(true);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -193,16 +169,11 @@ export function CommentCreate(props: Props) {
|
||||
setAdvancedEditor(!advancedEditor);
|
||||
}
|
||||
|
||||
if (!commentingEnabled || !hasChannels) {
|
||||
if (!hasChannels) {
|
||||
return (
|
||||
<div
|
||||
role="button"
|
||||
onClick={() => {
|
||||
if (embed) {
|
||||
window.open(`https://odysee.com/$/${PAGES.AUTH}?redirect=/$/${PAGES.LIVESTREAM}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const pathPlusRedirect = `/$/${PAGES.CHANNEL_NEW}?redirect=${pathname}`;
|
||||
if (livestream) {
|
||||
window.open(pathPlusRedirect);
|
||||
@@ -241,7 +212,7 @@ export function CommentCreate(props: Props) {
|
||||
autoFocus
|
||||
button="primary"
|
||||
disabled={disabled}
|
||||
label={isSubmitting ? __('Sending...') : (commentFailure && tipAmount === successTip.tipAmount) ? __('Re-submit') : __('Send')}
|
||||
label={isSubmitting ? __('Sending...') : __('Send')}
|
||||
onClick={handleSupportComment}
|
||||
/>
|
||||
<Button button="link" label={__('Cancel')} onClick={() => setIsReviewingSupportComment(false)} />
|
||||
@@ -256,7 +227,6 @@ export function CommentCreate(props: Props) {
|
||||
className={classnames('comment__create', {
|
||||
'comment__create--reply': isReply,
|
||||
'comment__create--nested-reply': isNested,
|
||||
'comment__create--bottom': bottom,
|
||||
})}
|
||||
>
|
||||
<FormField
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectChannelPermUrlForClaimUri, makeSelectClaimIsMine, makeSelectClaimForUri } from 'lbry-redux';
|
||||
import { doCommentAbandon, doCommentPin, doCommentList, doCommentModBlock } from 'redux/actions/comments';
|
||||
import { doChannelMute } from 'redux/actions/blocked';
|
||||
import { doToggleMuteChannel } from 'redux/actions/blocked';
|
||||
// import { doSetActiveChannel } from 'redux/actions/app';
|
||||
import { doSetPlayingUri } from 'redux/actions/content';
|
||||
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
||||
@@ -19,7 +19,7 @@ const select = (state, props) => ({
|
||||
const perform = (dispatch) => ({
|
||||
clearPlayingUri: () => dispatch(doSetPlayingUri({ uri: null })),
|
||||
deleteComment: (commentId, creatorChannelUrl) => dispatch(doCommentAbandon(commentId, creatorChannelUrl)),
|
||||
muteChannel: (channelUri) => dispatch(doChannelMute(channelUri)),
|
||||
blockChannel: (channelUri) => dispatch(doToggleMuteChannel(channelUri)),
|
||||
pinComment: (commentId, remove) => dispatch(doCommentPin(commentId, remove)),
|
||||
fetchComments: (uri) => dispatch(doCommentList(uri)),
|
||||
// setActiveChannel: channelId => dispatch(doSetActiveChannel(channelId)),
|
||||
|
||||
@@ -15,7 +15,7 @@ type Props = {
|
||||
linkedComment?: any,
|
||||
isPinned: boolean,
|
||||
pinComment: (string, boolean) => Promise<any>,
|
||||
muteChannel: (string) => void,
|
||||
blockChannel: (string) => void,
|
||||
fetchComments: (string) => void,
|
||||
handleEditComment: () => void,
|
||||
contentChannelPermanentUrl: any,
|
||||
@@ -34,7 +34,7 @@ function CommentMenuList(props: Props) {
|
||||
commentIsMine,
|
||||
commentId,
|
||||
deleteComment,
|
||||
muteChannel,
|
||||
blockChannel,
|
||||
pinComment,
|
||||
clearPlayingUri,
|
||||
activeChannelClaim,
|
||||
@@ -66,7 +66,7 @@ function CommentMenuList(props: Props) {
|
||||
}
|
||||
|
||||
function handleCommentMute() {
|
||||
muteChannel(authorUri);
|
||||
blockChannel(authorUri);
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -77,7 +77,7 @@ export default function CommentReactions(props: Props) {
|
||||
<Button
|
||||
requiresAuth={IS_WEB}
|
||||
title={__('Upvote')}
|
||||
icon={myReacts.includes(REACTION_TYPES.LIKE) ? ICONS.FIRE_ACTIVE : ICONS.FIRE}
|
||||
icon={ICONS.UPVOTE}
|
||||
className={classnames('comment__action', {
|
||||
'comment__action--active': myReacts && myReacts.includes(REACTION_TYPES.LIKE),
|
||||
})}
|
||||
@@ -87,7 +87,7 @@ export default function CommentReactions(props: Props) {
|
||||
<Button
|
||||
requiresAuth={IS_WEB}
|
||||
title={__('Downvote')}
|
||||
icon={myReacts.includes(REACTION_TYPES.DISLIKE) ? ICONS.SLIME_ACTIVE : ICONS.SLIME}
|
||||
icon={ICONS.DOWNVOTE}
|
||||
className={classnames('comment__action', {
|
||||
'comment__action--active': myReacts && myReacts.includes(REACTION_TYPES.DISLIKE),
|
||||
})}
|
||||
|
||||
@@ -22,7 +22,6 @@ type Props = {
|
||||
smallTitle?: boolean,
|
||||
onClick?: () => void,
|
||||
children?: Node,
|
||||
secondPane?: Node,
|
||||
};
|
||||
|
||||
export default function Card(props: Props) {
|
||||
@@ -42,7 +41,6 @@ export default function Card(props: Props) {
|
||||
nag,
|
||||
onClick,
|
||||
children,
|
||||
secondPane,
|
||||
} = props;
|
||||
const [expanded, setExpanded] = useState(defaultExpand);
|
||||
const expandable = defaultExpand !== undefined;
|
||||
@@ -50,9 +48,7 @@ export default function Card(props: Props) {
|
||||
return (
|
||||
<section
|
||||
role={onClick ? 'button' : undefined}
|
||||
className={classnames(className, 'card', {
|
||||
'card__multi-pane': Boolean(secondPane),
|
||||
})}
|
||||
className={classnames(className, 'card')}
|
||||
onClick={(e) => {
|
||||
if (onClick) {
|
||||
onClick();
|
||||
@@ -60,71 +56,69 @@ export default function Card(props: Props) {
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div>
|
||||
{(title || subtitle) && (
|
||||
{(title || subtitle) && (
|
||||
<div
|
||||
className={classnames('card__header--between', {
|
||||
'card__header--nowrap': noTitleWrap,
|
||||
})}
|
||||
>
|
||||
<div
|
||||
className={classnames('card__header--between', {
|
||||
'card__header--nowrap': noTitleWrap,
|
||||
className={classnames('card__title-section', {
|
||||
'card__title-section--body-list': isBodyList,
|
||||
'card__title-section--small': smallTitle,
|
||||
})}
|
||||
>
|
||||
<div
|
||||
className={classnames('card__title-section', {
|
||||
'card__title-section--body-list': isBodyList,
|
||||
'card__title-section--small': smallTitle,
|
||||
})}
|
||||
>
|
||||
{icon && <Icon sectionIcon icon={icon} />}
|
||||
<div>
|
||||
{isPageTitle && <h1 className="card__title">{title}</h1>}
|
||||
{!isPageTitle && (
|
||||
<h2 className={classnames('card__title', { 'card__title--small': smallTitle })}>{title}</h2>
|
||||
)}
|
||||
{subtitle && <div className="card__subtitle">{subtitle}</div>}
|
||||
</div>
|
||||
</div>
|
||||
<div className="card__title-actions-container">
|
||||
{titleActions && (
|
||||
<div
|
||||
className={classnames('card__title-actions', {
|
||||
'card__title-actions--small': smallTitle,
|
||||
})}
|
||||
>
|
||||
{titleActions}
|
||||
</div>
|
||||
)}
|
||||
{expandable && (
|
||||
<div className="card__title-actions">
|
||||
<Button
|
||||
button="alt"
|
||||
aria-expanded={expanded}
|
||||
aria-label={expanded ? __('Less') : __('More')}
|
||||
icon={expanded ? ICONS.SUBTRACT : ICONS.ADD}
|
||||
onClick={() => setExpanded(!expanded)}
|
||||
/>
|
||||
</div>
|
||||
{icon && <Icon sectionIcon icon={icon} />}
|
||||
<div>
|
||||
{isPageTitle && <h1 className="card__title">{title}</h1>}
|
||||
{!isPageTitle && (
|
||||
<h2 className={classnames('card__title', { 'card__title--small': smallTitle })}>{title}</h2>
|
||||
)}
|
||||
{subtitle && <div className="card__subtitle">{subtitle}</div>}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{(!expandable || (expandable && expanded)) && (
|
||||
<>
|
||||
{body && (
|
||||
<div>
|
||||
{titleActions && (
|
||||
<div
|
||||
className={classnames('card__body', {
|
||||
'card__body--no-title': !title && !subtitle,
|
||||
'card__body--list': isBodyList,
|
||||
className={classnames('card__title-actions', {
|
||||
'card__title-actions--small': smallTitle,
|
||||
})}
|
||||
>
|
||||
{body}
|
||||
{titleActions}
|
||||
</div>
|
||||
)}
|
||||
{actions && <div className="card__main-actions">{actions}</div>}
|
||||
{children && <div className="card__main-actions">{children}</div>}
|
||||
</>
|
||||
)}
|
||||
{nag}
|
||||
</div>
|
||||
{secondPane && <div className="card__second-pane">{secondPane}</div>}
|
||||
{expandable && (
|
||||
<div className="card__title-actions">
|
||||
<Button
|
||||
button="alt"
|
||||
aria-expanded={expanded}
|
||||
aria-label={expanded ? __('Less') : __('More')}
|
||||
icon={expanded ? ICONS.SUBTRACT : ICONS.ADD}
|
||||
onClick={() => setExpanded(!expanded)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{(!expandable || (expandable && expanded)) && (
|
||||
<>
|
||||
{body && (
|
||||
<div
|
||||
className={classnames('card__body', {
|
||||
'card__body--no-title': !title && !subtitle,
|
||||
'card__body--list': isBodyList,
|
||||
})}
|
||||
>
|
||||
{body}
|
||||
</div>
|
||||
)}
|
||||
{actions && <div className="card__main-actions">{actions}</div>}
|
||||
{children && <div className="card__main-actions">{children}</div>}
|
||||
</>
|
||||
)}
|
||||
|
||||
{nag}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -555,13 +555,6 @@ export const icons = {
|
||||
<circle cx="12" cy="19" r="1" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.MORE]: buildIcon(
|
||||
<g transform="rotate(90 12 12)">
|
||||
<circle cx="12" cy="5" r="1" />
|
||||
<circle cx="12" cy="12" r="1" />
|
||||
<circle cx="12" cy="19" r="1" />
|
||||
</g>
|
||||
),
|
||||
[ICONS.VALIDATED]: buildIcon(
|
||||
<g>
|
||||
<polyline points="20 6 9 17 4 12" />
|
||||
@@ -750,6 +743,22 @@ export const icons = {
|
||||
viewBox: '0 0 60 60',
|
||||
}
|
||||
),
|
||||
[ICONS.MORE]: buildIcon(
|
||||
<g>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M0 30C0 13.4315 13.4315 0 30 0C46.5685 0 60 13.4315 60 30C60 46.5685 46.5685 60 30 60C13.4315 60 0 46.5685 0 30Z"
|
||||
fill="#eee"
|
||||
/>
|
||||
<circle cx="20" cy="30" r="2" stroke="black" fill="black" />
|
||||
<circle cx="30" cy="30" r="2" stroke="black" fill="black" />
|
||||
<circle cx="40" cy="30" r="2" stroke="black" fill="black" />
|
||||
</g>,
|
||||
{
|
||||
viewBox: '0 0 60 60',
|
||||
}
|
||||
),
|
||||
[ICONS.SHARE_LINK]: buildIcon(
|
||||
<g>
|
||||
<path
|
||||
@@ -1777,8 +1786,7 @@ export const icons = {
|
||||
d="M-506.9,1532.1c1.8-1.8,2.9-4.3,2.9-7.1c0-2.6-1-4.9-2.5-6.7L-506.9,1532.1z"
|
||||
/>
|
||||
</g>
|
||||
<rect id="XMLID_125_" x="0" y="0" fill="none" width="36" height="36" stroke="none" />
|
||||
{/* }//fill="#FFFFFF" */}
|
||||
<rect id="XMLID_125_" x="0" y="0" fill="none" width="36" height="36" stroke="none" /> {/* }//fill="#FFFFFF" */}
|
||||
<linearGradient
|
||||
id="XMLID_421_"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
@@ -2040,8 +2048,7 @@ export const icons = {
|
||||
d="M-506.9,1532.1c1.8-1.8,2.9-4.3,2.9-7.1c0-2.6-1-4.9-2.5-6.7L-506.9,1532.1z"
|
||||
/>
|
||||
</g>
|
||||
<rect id="XMLID_125_" x="0" y="0" fill="none" width="36" height="36" stroke="none" />
|
||||
{/* }//fill="#FFFFFF" */}
|
||||
<rect id="XMLID_125_" x="0" y="0" fill="none" width="36" height="36" stroke="none" /> {/* }//fill="#FFFFFF" */}
|
||||
<linearGradient
|
||||
id="XMLID_421_"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
@@ -2252,44 +2259,4 @@ export const icons = {
|
||||
/>
|
||||
</svg>
|
||||
),
|
||||
[ICONS.STACK]: (props: CustomProps) => (
|
||||
<svg
|
||||
{...props}
|
||||
viewBox="0 0 24 24"
|
||||
width={props.size || '18'}
|
||||
height={props.size || '18'}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
stroke="currentColor"
|
||||
fill="none"
|
||||
>
|
||||
<g transform="matrix(1,0,0,1,0,0)">
|
||||
<path d="M22.91,6.953,12.7,1.672a1.543,1.543,0,0,0-1.416,0L1.076,6.953a.615.615,0,0,0,0,1.094l10.209,5.281a1.543,1.543,0,0,0,1.416,0L22.91,8.047a.616.616,0,0,0,0-1.094Z" />
|
||||
<path d="M.758,12.75l10.527,5.078a1.543,1.543,0,0,0,1.416,0L23.258,12.75" />
|
||||
<path d="M.758,17.25l10.527,5.078a1.543,1.543,0,0,0,1.416,0L23.258,17.25" />
|
||||
</g>
|
||||
</svg>
|
||||
),
|
||||
[ICONS.TIME]: (props: CustomProps) => (
|
||||
<svg
|
||||
{...props}
|
||||
viewBox="0 0 24 24"
|
||||
width={props.size || '18'}
|
||||
height={props.size || '18'}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
stroke="currentColor"
|
||||
fill="none"
|
||||
>
|
||||
<g transform="matrix(1,0,0,1,0,0)">
|
||||
<path d="M1.500 12.000 A10.500 10.500 0 1 0 22.500 12.000 A10.500 10.500 0 1 0 1.500 12.000 Z" />
|
||||
<path d="M12 12L12 8.25" />
|
||||
<path d="M12 12L16.687 16.688" />
|
||||
</g>
|
||||
</svg>
|
||||
),
|
||||
};
|
||||
|
||||
@@ -71,7 +71,7 @@ class IconComponent extends React.PureComponent<Props> {
|
||||
<Icon
|
||||
title={tooltipText}
|
||||
size={size || (sectionIcon ? 20 : 16)}
|
||||
className={classnames(`icon icon--${icon}`, className, { 'color-override': iconColor })}
|
||||
className={classnames(`icon icon--${icon}`, className)}
|
||||
color={color}
|
||||
{...rest}
|
||||
/>
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
import React from 'react';
|
||||
import debounce from 'util/debounce';
|
||||
|
||||
const DEBOUNCE_SCROLL_HANDLER_MS = 25;
|
||||
const DEBOUNCE_SCROLL_HANDLER_MS = 300;
|
||||
|
||||
type Props = {
|
||||
children: any,
|
||||
lastUpdateDate?: any,
|
||||
skipWait?: boolean,
|
||||
placeholder?: any,
|
||||
};
|
||||
|
||||
export default function WaitUntilOnPage(props: Props) {
|
||||
@@ -15,17 +15,21 @@ export default function WaitUntilOnPage(props: Props) {
|
||||
const [shouldRender, setShouldRender] = React.useState(false);
|
||||
|
||||
React.useEffect(() => {
|
||||
const handleDisplayingRef = debounce((e) => {
|
||||
setShouldRender(false);
|
||||
}, [props.lastUpdateDate]);
|
||||
|
||||
React.useEffect(() => {
|
||||
const handleDisplayingRef = debounce(e => {
|
||||
const element = ref && ref.current;
|
||||
if (element) {
|
||||
const bounding = element.getBoundingClientRect();
|
||||
if (
|
||||
bounding.bottom >= 0 &&
|
||||
bounding.right >= 0 &&
|
||||
bounding.top >= 0 &&
|
||||
bounding.left >= 0 &&
|
||||
// $FlowFixMe
|
||||
bounding.top <= (window.innerHeight || document.documentElement.clientHeight) &&
|
||||
bounding.right <= (window.innerWidth || document.documentElement.clientWidth) &&
|
||||
// $FlowFixMe
|
||||
bounding.left <= (window.innerWidth || document.documentElement.clientWidth)
|
||||
bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight)
|
||||
) {
|
||||
setShouldRender(true);
|
||||
}
|
||||
@@ -42,12 +46,5 @@ export default function WaitUntilOnPage(props: Props) {
|
||||
}
|
||||
}, [ref, setShouldRender, shouldRender]);
|
||||
|
||||
const render = props.skipWait || shouldRender;
|
||||
|
||||
return (
|
||||
<div ref={ref}>
|
||||
{render && props.children}
|
||||
{!render && props.placeholder !== undefined && props.placeholder}
|
||||
</div>
|
||||
);
|
||||
return <div ref={ref}>{(props.skipWait || shouldRender) && props.children}</div>;
|
||||
}
|
||||
|
||||
@@ -2,29 +2,15 @@
|
||||
import React from 'react';
|
||||
import moment from 'moment';
|
||||
|
||||
const DEFAULT_MIN_UPDATE_DELTA_MS = 60 * 1000;
|
||||
|
||||
type Props = {
|
||||
date?: any,
|
||||
timeAgo?: boolean,
|
||||
formatOptions?: {},
|
||||
formatOptions: {},
|
||||
show?: string,
|
||||
clock24h?: boolean,
|
||||
minUpdateDeltaMs?: number,
|
||||
clock24h: boolean,
|
||||
};
|
||||
|
||||
type State = {
|
||||
lastRenderTime: Date,
|
||||
};
|
||||
|
||||
class DateTime extends React.Component<Props, State> {
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
lastRenderTime: new Date(),
|
||||
};
|
||||
}
|
||||
|
||||
class DateTime extends React.PureComponent<Props> {
|
||||
static SHOW_DATE = 'date';
|
||||
static SHOW_TIME = 'time';
|
||||
|
||||
@@ -59,38 +45,6 @@ class DateTime extends React.Component<Props, State> {
|
||||
return __(strId, { duration });
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps: Props): boolean {
|
||||
if (
|
||||
moment(this.props.date).diff(moment(nextProps.date)) !== 0 ||
|
||||
this.props.clock24h !== nextProps.clock24h ||
|
||||
this.props.timeAgo !== nextProps.timeAgo ||
|
||||
this.props.minUpdateDeltaMs !== nextProps.minUpdateDeltaMs ||
|
||||
this.props.show !== nextProps.show
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.props.timeAgo && nextProps.timeAgo) {
|
||||
const minUpdateDeltaMs = this.props.minUpdateDeltaMs || DEFAULT_MIN_UPDATE_DELTA_MS;
|
||||
const prev = moment(this.state.lastRenderTime);
|
||||
const curr = moment(new Date());
|
||||
const deltaMs = curr.diff(prev);
|
||||
|
||||
if (deltaMs > minUpdateDeltaMs) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const { timeAgo } = this.props;
|
||||
if (timeAgo) {
|
||||
this.setState({ lastRenderTime: new Date() });
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { date, timeAgo, show, clock24h } = this.props;
|
||||
|
||||
|
||||
@@ -6,9 +6,7 @@ import {
|
||||
doPrepareEdit,
|
||||
selectMyChannelClaims,
|
||||
makeSelectClaimIsStreamPlaceholder,
|
||||
makeSelectTagInClaimOrChannelForUri,
|
||||
} from 'lbry-redux';
|
||||
import { DISABLE_COMMENTS_TAG } from 'constants/tags';
|
||||
import { makeSelectCostInfoForUri } from 'lbryinc';
|
||||
import { doSetPlayingUri } from 'redux/actions/content';
|
||||
import { doToast } from 'redux/actions/notifications';
|
||||
@@ -25,7 +23,6 @@ const select = (state, props) => ({
|
||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||
myChannels: selectMyChannelClaims(state),
|
||||
isLivestreamClaim: makeSelectClaimIsStreamPlaceholder(props.uri)(state),
|
||||
reactionsDisabled: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_COMMENTS_TAG)(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
|
||||
@@ -6,11 +6,10 @@ import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import FileDownloadLink from 'component/fileDownloadLink';
|
||||
import { buildURI, COLLECTIONS_CONSTS } from 'lbry-redux';
|
||||
import { buildURI } from 'lbry-redux';
|
||||
import * as RENDER_MODES from 'constants/file_render_modes';
|
||||
import { useIsMobile } from 'effects/use-screensize';
|
||||
import ClaimSupportButton from 'component/claimSupportButton';
|
||||
import ClaimCollectionAddButton from 'component/claimCollectionAddButton';
|
||||
import { useHistory } from 'react-router';
|
||||
import FileReactions from 'component/fileReactions';
|
||||
|
||||
@@ -26,9 +25,7 @@ type Props = {
|
||||
myChannels: ?Array<ChannelClaim>,
|
||||
doToast: ({ message: string }) => void,
|
||||
clearPlayingUri: () => void,
|
||||
hideRepost?: boolean,
|
||||
isLivestreamClaim: boolean,
|
||||
reactionsDisabled: boolean,
|
||||
};
|
||||
|
||||
function FileActions(props: Props) {
|
||||
@@ -44,13 +41,11 @@ function FileActions(props: Props) {
|
||||
myChannels,
|
||||
clearPlayingUri,
|
||||
doToast,
|
||||
hideRepost,
|
||||
isLivestreamClaim,
|
||||
reactionsDisabled,
|
||||
} = props;
|
||||
const {
|
||||
push,
|
||||
location: { pathname, search },
|
||||
location: { pathname },
|
||||
} = useHistory();
|
||||
const isMobile = useIsMobile();
|
||||
const webShareable = costInfo && costInfo.cost === 0 && RENDER_MODES.WEB_SHAREABLE_MODES.includes(renderMode);
|
||||
@@ -75,9 +70,6 @@ function FileActions(props: Props) {
|
||||
editUri = buildURI(uriObject);
|
||||
}
|
||||
|
||||
const urlParams = new URLSearchParams(search);
|
||||
const collectionId = urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID);
|
||||
|
||||
function handleRepostClick() {
|
||||
if (!hasChannels) {
|
||||
clearPlayingUri();
|
||||
@@ -90,28 +82,25 @@ function FileActions(props: Props) {
|
||||
|
||||
const lhsSection = (
|
||||
<>
|
||||
{ENABLE_FILE_REACTIONS && !reactionsDisabled && <FileReactions uri={uri} livestream={isLivestreamClaim} />}
|
||||
{ENABLE_FILE_REACTIONS && <FileReactions uri={uri} />}
|
||||
<ClaimSupportButton uri={uri} fileAction />
|
||||
<ClaimCollectionAddButton uri={uri} fileAction />
|
||||
{!hideRepost && (
|
||||
<Button
|
||||
button="alt"
|
||||
className="button--file-action"
|
||||
icon={ICONS.REPOST}
|
||||
label={
|
||||
claim.meta.reposted > 1 ? __(`%repost_total% Reposts`, { repost_total: claim.meta.reposted }) : __('Repost')
|
||||
}
|
||||
description={__('Repost')}
|
||||
requiresAuth={IS_WEB}
|
||||
onClick={handleRepostClick}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
button="alt"
|
||||
className="button--file-action"
|
||||
icon={ICONS.REPOST}
|
||||
label={
|
||||
claim.meta.reposted > 1 ? __(`%repost_total% Reposts`, { repost_total: claim.meta.reposted }) : __('Repost')
|
||||
}
|
||||
description={__('Repost')}
|
||||
requiresAuth={IS_WEB}
|
||||
onClick={handleRepostClick}
|
||||
/>
|
||||
<Button
|
||||
className="button--file-action"
|
||||
icon={ICONS.SHARE}
|
||||
label={isMobile ? undefined : __('Share')}
|
||||
label={__('Share')}
|
||||
title={__('Share')}
|
||||
onClick={() => openModal(MODALS.SOCIAL_SHARE, { uri, webShareable, collectionId })}
|
||||
onClick={() => openModal(MODALS.SOCIAL_SHARE, { uri, webShareable })}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectChannelForClaimUri } from 'lbry-redux';
|
||||
import ClaimAuthor from './view';
|
||||
import FileAuthor from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
channelUri: makeSelectChannelForClaimUri(props.uri)(state),
|
||||
});
|
||||
|
||||
export default connect(select)(ClaimAuthor);
|
||||
export default connect(select)(FileAuthor);
|
||||
@@ -7,7 +7,7 @@ type Props = {
|
||||
hideActions?: boolean,
|
||||
};
|
||||
|
||||
function ClaimAuthor(props: Props) {
|
||||
function FileAuthor(props: Props) {
|
||||
const { channelUri, hideActions } = props;
|
||||
|
||||
return channelUri ? (
|
||||
@@ -17,4 +17,4 @@ function ClaimAuthor(props: Props) {
|
||||
);
|
||||
}
|
||||
|
||||
export default ClaimAuthor;
|
||||
export default FileAuthor;
|
||||
@@ -20,11 +20,10 @@ type Props = {
|
||||
pendingAmount: number,
|
||||
doOpenModal: (id: string, {}) => void,
|
||||
claimIsMine: boolean,
|
||||
expandOverride: boolean,
|
||||
};
|
||||
|
||||
function FileDescription(props: Props) {
|
||||
const { uri, claim, metadata, pendingAmount, doOpenModal, claimIsMine, expandOverride } = props;
|
||||
const { uri, claim, metadata, pendingAmount, doOpenModal, claimIsMine } = props;
|
||||
const [expanded, setExpanded] = React.useState(false);
|
||||
const [showCreditDetails, setShowCreditDetails] = React.useState(false);
|
||||
const amount = parseFloat(claim.amount) + parseFloat(pendingAmount || claim.meta.support_amount);
|
||||
@@ -41,9 +40,9 @@ function FileDescription(props: Props) {
|
||||
<div>
|
||||
<div
|
||||
className={classnames({
|
||||
'media__info-text--contracted': !expanded && !expandOverride,
|
||||
'media__info-text--contracted': !expanded,
|
||||
'media__info-text--expanded': expanded,
|
||||
'media__info-text--fade': !expanded && !expandOverride,
|
||||
'media__info-text--fade': !expanded,
|
||||
})}
|
||||
>
|
||||
{description && <MarkdownPreview className="markdown-preview--description" content={description} simpleLinks />}
|
||||
@@ -52,14 +51,10 @@ function FileDescription(props: Props) {
|
||||
</div>
|
||||
|
||||
<div className="card__bottom-actions">
|
||||
{!expandOverride && (
|
||||
<>
|
||||
{expanded ? (
|
||||
<Button button="link" label={__('Less')} onClick={() => setExpanded(!expanded)} />
|
||||
) : (
|
||||
<Button button="link" label={__('More')} onClick={() => setExpanded(!expanded)} />
|
||||
)}
|
||||
</>
|
||||
{expanded ? (
|
||||
<Button button="link" label={__('Less')} onClick={() => setExpanded(!expanded)} />
|
||||
) : (
|
||||
<Button button="link" label={__('More')} onClick={() => setExpanded(!expanded)} />
|
||||
)}
|
||||
|
||||
<div className="section__actions--no-margin">
|
||||
|
||||
@@ -9,7 +9,7 @@ type Props = {
|
||||
claim: StreamClaim,
|
||||
fileInfo: FileListItem,
|
||||
metadata: StreamMetadata,
|
||||
openFolder: (string) => void,
|
||||
openFolder: string => void,
|
||||
contentType: string,
|
||||
user: ?any,
|
||||
};
|
||||
@@ -58,7 +58,7 @@ class FileDetails extends PureComponent<Props> {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{mediaType && (
|
||||
{languages && (
|
||||
<div className="media__details">
|
||||
<span>{__('Media Type')}</span>
|
||||
<span>{mediaType}</span>
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimIsMine, makeSelectClaimForUri } from 'lbry-redux';
|
||||
import { makeSelectFilePartlyDownloaded, makeSelectClaimIsMine, makeSelectClaimForUri } from 'lbry-redux';
|
||||
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
|
||||
import ClaimProperties from './view';
|
||||
import FileProperties from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
downloaded: makeSelectFilePartlyDownloaded(props.uri)(state),
|
||||
isSubscribed: makeSelectIsSubscribed(props.uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
||||
});
|
||||
|
||||
export default connect(select, null)(ClaimProperties);
|
||||
export default connect(select, null)(FileProperties);
|
||||
44
ui/component/fileProperties/view.jsx
Normal file
44
ui/component/fileProperties/view.jsx
Normal file
@@ -0,0 +1,44 @@
|
||||
// @flow
|
||||
import type { Node } from 'react';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import * as React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import Icon from 'component/common/icon';
|
||||
import FilePrice from 'component/filePrice';
|
||||
import VideoDuration from 'component/videoDuration';
|
||||
import FileType from 'component/fileType';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
downloaded: boolean,
|
||||
claimIsMine: boolean,
|
||||
isSubscribed: boolean,
|
||||
small: boolean,
|
||||
claim: Claim,
|
||||
properties?: (Claim) => ?Node,
|
||||
};
|
||||
|
||||
export default function FileProperties(props: Props) {
|
||||
const { uri, downloaded, claimIsMine, isSubscribed, small = false, properties, claim } = props;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={classnames('file-properties', {
|
||||
'file-properties--small': small,
|
||||
})}
|
||||
>
|
||||
{typeof properties === 'function' ? (
|
||||
properties(claim)
|
||||
) : (
|
||||
<>
|
||||
<VideoDuration uri={uri} />
|
||||
<FileType uri={uri} />
|
||||
{isSubscribed && <Icon tooltip icon={ICONS.SUBSCRIBE} />}
|
||||
{!claimIsMine && downloaded && <Icon tooltip icon={ICONS.LIBRARY} />}
|
||||
|
||||
<FilePrice hideFree uri={uri} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
// @flow
|
||||
import * as REACTION_TYPES from 'constants/reactions';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
@@ -9,55 +8,29 @@ import NudgeFloating from 'component/nudgeFloating';
|
||||
|
||||
type Props = {
|
||||
claim: StreamClaim,
|
||||
doFetchReactions: (string) => void,
|
||||
doReactionLike: (string) => void,
|
||||
doReactionDislike: (string) => void,
|
||||
doFetchReactions: string => void,
|
||||
doReactionLike: string => void,
|
||||
doReactionDislike: string => void,
|
||||
uri: string,
|
||||
likeCount: number,
|
||||
dislikeCount: number,
|
||||
myReaction: ?string,
|
||||
livestream?: boolean,
|
||||
};
|
||||
|
||||
function FileReactions(props: Props) {
|
||||
const {
|
||||
claim,
|
||||
uri,
|
||||
doFetchReactions,
|
||||
doReactionLike,
|
||||
doReactionDislike,
|
||||
myReaction,
|
||||
likeCount,
|
||||
dislikeCount,
|
||||
livestream,
|
||||
} = props;
|
||||
const { claim, uri, doFetchReactions, doReactionLike, doReactionDislike, likeCount, dislikeCount } = props;
|
||||
const claimId = claim && claim.claim_id;
|
||||
const channel = claim && claim.signing_channel && claim.signing_channel.name;
|
||||
const isCollection = claim && claim.value_type === 'collection'; // hack because nudge gets cut off by card on cols.
|
||||
|
||||
React.useEffect(() => {
|
||||
function fetchReactions() {
|
||||
if (claimId) {
|
||||
doFetchReactions(claimId);
|
||||
}
|
||||
|
||||
let fetchInterval;
|
||||
if (claimId) {
|
||||
fetchReactions();
|
||||
|
||||
if (livestream) {
|
||||
fetchInterval = setInterval(fetchReactions, 45000);
|
||||
}
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (fetchInterval) {
|
||||
clearInterval(fetchInterval);
|
||||
}
|
||||
};
|
||||
}, [claimId, doFetchReactions, livestream]);
|
||||
}, [claimId, doFetchReactions]);
|
||||
|
||||
return (
|
||||
<>
|
||||
{channel && !isCollection && (
|
||||
{channel && (
|
||||
<NudgeFloating
|
||||
name="nudge:support-acknowledge"
|
||||
text={__('Let %channel% know you enjoyed this!', { channel })}
|
||||
@@ -68,46 +41,20 @@ function FileReactions(props: Props) {
|
||||
title={__('I like this')}
|
||||
requiresAuth={IS_WEB}
|
||||
authSrc="filereaction_like"
|
||||
className={classnames('button--file-action', { 'button--fire': myReaction === REACTION_TYPES.LIKE })}
|
||||
label={
|
||||
<>
|
||||
{myReaction === REACTION_TYPES.LIKE && (
|
||||
<>
|
||||
<div className="button__fire-glow" />
|
||||
<div className="button__fire-particle1" />
|
||||
<div className="button__fire-particle2" />
|
||||
<div className="button__fire-particle3" />
|
||||
<div className="button__fire-particle4" />
|
||||
<div className="button__fire-particle5" />
|
||||
<div className="button__fire-particle6" />
|
||||
</>
|
||||
)}
|
||||
{formatNumberWithCommas(likeCount, 0)}
|
||||
</>
|
||||
}
|
||||
className={classnames('button--file-action')}
|
||||
label={formatNumberWithCommas(likeCount, 0)}
|
||||
iconSize={18}
|
||||
icon={myReaction === REACTION_TYPES.LIKE ? ICONS.FIRE_ACTIVE : ICONS.FIRE}
|
||||
icon={ICONS.UPVOTE}
|
||||
onClick={() => doReactionLike(uri)}
|
||||
/>
|
||||
<Button
|
||||
requiresAuth={IS_WEB}
|
||||
authSrc={'filereaction_dislike'}
|
||||
title={__('I dislike this')}
|
||||
className={classnames('button--file-action', { 'button--slime': myReaction === REACTION_TYPES.DISLIKE })}
|
||||
label={
|
||||
<>
|
||||
{myReaction === REACTION_TYPES.DISLIKE && (
|
||||
<>
|
||||
<div className="button__slime-stain" />
|
||||
<div className="button__slime-drop1" />
|
||||
<div className="button__slime-drop2" />
|
||||
</>
|
||||
)}
|
||||
{formatNumberWithCommas(dislikeCount, 0)}
|
||||
</>
|
||||
}
|
||||
className={classnames('button--file-action')}
|
||||
label={formatNumberWithCommas(dislikeCount, 0)}
|
||||
iconSize={18}
|
||||
icon={myReaction === REACTION_TYPES.DISLIKE ? ICONS.SLIME_ACTIVE : ICONS.SLIME}
|
||||
icon={ICONS.DOWNVOTE}
|
||||
onClick={() => doReactionDislike(uri)}
|
||||
/>
|
||||
</>
|
||||
|
||||
@@ -39,11 +39,11 @@ const select = (state, props) => ({
|
||||
authenticated: selectUserVerifiedEmail(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
play: (uri) => {
|
||||
const perform = dispatch => ({
|
||||
play: uri => {
|
||||
dispatch(doSetPrimaryUri(uri));
|
||||
dispatch(doSetPlayingUri({ uri }));
|
||||
dispatch(doPlayUri(uri, undefined, undefined, (fileInfo) => dispatch(doAnaltyicsPurchaseEvent(fileInfo))));
|
||||
dispatch(doPlayUri(uri, undefined, undefined, fileInfo => dispatch(doAnaltyicsPurchaseEvent(fileInfo))));
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -107,22 +107,17 @@ export default function FileRenderInitiator(props: Props) {
|
||||
|
||||
useEffect(() => {
|
||||
const videoOnPage = document.querySelector('video');
|
||||
if (
|
||||
(isFree || claimWasPurchased) &&
|
||||
((autoplay && !videoOnPage && isPlayable) || RENDER_MODES.AUTO_RENDER_MODES.includes(renderMode))
|
||||
) {
|
||||
if (isFree && ((autoplay && !videoOnPage && isPlayable) || RENDER_MODES.AUTO_RENDER_MODES.includes(renderMode))) {
|
||||
viewFile();
|
||||
}
|
||||
}, [autoplay, viewFile, isFree, renderMode, isPlayable, claimWasPurchased]);
|
||||
}, [autoplay, viewFile, isFree, renderMode, isPlayable]);
|
||||
|
||||
/*
|
||||
once content is playing, let the appropriate <FileRender> take care of it...
|
||||
but for playables, always render so area can be used to fill with floating player
|
||||
*/
|
||||
if (isPlaying && !isPlayable) {
|
||||
if (isFree || claimWasPurchased) {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
const showAppNag = IS_WEB && RENDER_MODES.UNSUPPORTED_IN_THIS_APP.includes(renderMode);
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectFileInfoForUri, makeSelectStreamingUrlForUri, makeSelectClaimWasPurchased } from 'lbry-redux';
|
||||
import { makeSelectFileInfoForUri, makeSelectStreamingUrlForUri } from 'lbry-redux';
|
||||
import { doClaimEligiblePurchaseRewards } from 'redux/actions/rewards';
|
||||
import { makeSelectFileRenderModeForUri, selectPrimaryUri } from 'redux/selectors/content';
|
||||
import { withRouter } from 'react-router';
|
||||
import { doAnalyticsView } from 'redux/actions/app';
|
||||
import FileRenderInline from './view';
|
||||
import { makeSelectCostInfoForUri } from 'lbryinc';
|
||||
|
||||
const select = (state, props) => ({
|
||||
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
||||
isPlaying: selectPrimaryUri(state) === props.uri,
|
||||
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
|
||||
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
|
||||
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
||||
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
|
||||
@@ -12,24 +12,11 @@ type Props = {
|
||||
streamingUrl?: string,
|
||||
triggerAnalyticsView: (string, number) => Promise<any>,
|
||||
claimRewards: () => void,
|
||||
costInfo: any,
|
||||
claimWasPurchased: boolean,
|
||||
};
|
||||
|
||||
export default function FileRenderInline(props: Props) {
|
||||
const {
|
||||
isPlaying,
|
||||
fileInfo,
|
||||
uri,
|
||||
streamingUrl,
|
||||
triggerAnalyticsView,
|
||||
claimRewards,
|
||||
renderMode,
|
||||
costInfo,
|
||||
claimWasPurchased,
|
||||
} = props;
|
||||
const { isPlaying, fileInfo, uri, streamingUrl, triggerAnalyticsView, claimRewards, renderMode } = props;
|
||||
const [playTime, setPlayTime] = useState();
|
||||
const isFree = !costInfo || (costInfo.cost !== undefined && costInfo.cost === 0);
|
||||
const isReadyToView = fileInfo && fileInfo.completed;
|
||||
const isReadyToPlay = streamingUrl || isReadyToView;
|
||||
|
||||
@@ -65,9 +52,5 @@ export default function FileRenderInline(props: Props) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!isFree && !claimWasPurchased) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return renderContent ? <FileRender uri={uri} /> : <LoadingScreen isDocument />;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ function FileSubtitle(props: Props) {
|
||||
|
||||
<FileViewCount uri={uri} livestream={livestream} activeViewers={activeViewers} isLive={isLive} />
|
||||
</div>
|
||||
{/* did I need these params? */}
|
||||
<FileActions uri={uri} hideRepost={livestream} livestream={livestream} />
|
||||
|
||||
<FileActions uri={uri} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import classnames from 'classnames';
|
||||
import type { Node } from 'react';
|
||||
import useLazyLoading from 'effects/use-lazy-loading';
|
||||
|
||||
type Props = {
|
||||
thumb: string,
|
||||
children?: Node,
|
||||
};
|
||||
|
||||
const Thumb = (props: Props) => {
|
||||
const { thumb, children } = props;
|
||||
const thumbnailRef = React.useRef(null);
|
||||
useLazyLoading(thumbnailRef);
|
||||
|
||||
return (
|
||||
<div ref={thumbnailRef} data-background-image={thumb} className={classnames('media__thumb')}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Thumb;
|
||||
@@ -5,7 +5,7 @@ import React from 'react';
|
||||
import FreezeframeWrapper from './FreezeframeWrapper';
|
||||
import Placeholder from './placeholder.png';
|
||||
import classnames from 'classnames';
|
||||
import Thumb from './thumb';
|
||||
import useLazyLoading from 'effects/use-lazy-loading';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
@@ -24,6 +24,7 @@ function FileThumbnail(props: Props) {
|
||||
uri && claim && claim.value && claim.value.thumbnail ? claim.value.thumbnail.url : undefined;
|
||||
const thumbnail = passedThumbnail || thumbnailFromClaim;
|
||||
const hasResolvedClaim = claim !== undefined;
|
||||
const thumbnailRef = React.useRef(null);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!hasResolvedClaim && uri) {
|
||||
@@ -31,6 +32,8 @@ function FileThumbnail(props: Props) {
|
||||
}
|
||||
}, [hasResolvedClaim, uri, doResolveUri]);
|
||||
|
||||
useLazyLoading(thumbnailRef);
|
||||
|
||||
if (!allowGifs && thumbnail && thumbnail.endsWith('gif')) {
|
||||
return (
|
||||
<FreezeframeWrapper src={thumbnail} className={classnames('media__thumb', className)}>
|
||||
@@ -49,11 +52,10 @@ function FileThumbnail(props: Props) {
|
||||
|
||||
const thumnailUrl = url ? url.replace(/'/g, "\\'") : '';
|
||||
|
||||
if (hasResolvedClaim || thumnailUrl) {
|
||||
return <Thumb thumb={thumnailUrl}>{children}</Thumb>;
|
||||
}
|
||||
return (
|
||||
<div
|
||||
ref={thumbnailRef}
|
||||
data-background-image={thumnailUrl}
|
||||
className={classnames('media__thumb', className, {
|
||||
'media__thumb--resolving': !hasResolvedClaim,
|
||||
})}
|
||||
|
||||
@@ -4,12 +4,13 @@ import { normalizeURI } from 'lbry-redux';
|
||||
import FilePrice from 'component/filePrice';
|
||||
import ClaimInsufficientCredits from 'component/claimInsufficientCredits';
|
||||
import FileSubtitle from 'component/fileSubtitle';
|
||||
import ClaimAuthor from 'component/claimAuthor';
|
||||
import FileAuthor from 'component/fileAuthor';
|
||||
import Card from 'component/common/card';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import Icon from 'component/common/icon';
|
||||
import I18nMessage from 'component/i18nMessage';
|
||||
import Button from 'component/button';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import FileDescription from 'component/fileDescription';
|
||||
import usePersistedState from 'effects/use-persisted-state';
|
||||
|
||||
@@ -64,22 +65,23 @@ function FileTitleSection(props: Props) {
|
||||
<div className="main--empty">
|
||||
<h2>
|
||||
<Icon className="icon--hidden" icon={ICONS.EYE_OFF} />
|
||||
{__('Mature content is not supported on Odysee.')}
|
||||
{__('Mature content blocked.')}
|
||||
</h2>
|
||||
<div>
|
||||
<I18nMessage
|
||||
tokens={{
|
||||
download_url: <Button label={__('lbry.com')} button="link" href="https://lbry.com/get" />,
|
||||
content_settings: (
|
||||
<Button button="link" label={__('content settings')} navigate={`/$/${PAGES.SETTINGS}`} />
|
||||
),
|
||||
}}
|
||||
>
|
||||
You can download the LBRY Desktop or Android app on %download_url% and enable mature content in
|
||||
Settings.
|
||||
Change this in your %content_settings%.
|
||||
</I18nMessage>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="section">
|
||||
<ClaimAuthor uri={uri} />
|
||||
<FileAuthor uri={uri} />
|
||||
<FileDescription uri={uri} />
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -2,27 +2,24 @@
|
||||
import * as ICONS from 'constants/icons';
|
||||
import React from 'react';
|
||||
import Icon from 'component/common/icon';
|
||||
import * as COL from 'constants/collections';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
mediaType: string,
|
||||
isLivestream: boolean,
|
||||
small: boolean,
|
||||
};
|
||||
|
||||
function FileType(props: Props) {
|
||||
const { mediaType, isLivestream, small } = props;
|
||||
const size = small ? COL.ICON_SIZE : undefined;
|
||||
const { mediaType, isLivestream } = props;
|
||||
|
||||
if (mediaType === 'image') {
|
||||
return <Icon size={size} icon={ICONS.IMAGE} />;
|
||||
return <Icon icon={ICONS.IMAGE} />;
|
||||
} else if (mediaType === 'audio') {
|
||||
return <Icon size={size} icon={ICONS.AUDIO} />;
|
||||
return <Icon icon={ICONS.AUDIO} />;
|
||||
} else if (mediaType === 'video' || isLivestream) {
|
||||
return <Icon size={size} icon={ICONS.VIDEO} />;
|
||||
return <Icon icon={ICONS.VIDEO} />;
|
||||
} else if (mediaType === 'text') {
|
||||
return <Icon size={size} icon={ICONS.TEXT} />;
|
||||
return <Icon icon={ICONS.TEXT} />;
|
||||
}
|
||||
|
||||
return <Icon icon={ICONS.DOWNLOADABLE} />;
|
||||
|
||||
@@ -5,8 +5,7 @@ import FilePrice from 'component/filePrice';
|
||||
import { formatLbryUrlForWeb } from 'util/url';
|
||||
import { withRouter } from 'react-router';
|
||||
import { URL } from 'config';
|
||||
import OdyseeLogo from 'component/header/odysee_logo.png';
|
||||
import OdyseeLogoWithText from 'component/header/odysee_white.png';
|
||||
import * as ICONS from 'constants/icons';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
@@ -37,10 +36,7 @@ function FileViewerEmbeddedTitle(props: Props) {
|
||||
{...contentLinkProps}
|
||||
/>
|
||||
<div className="file-viewer__embedded-info">
|
||||
<Button className="file-viewer__overlay-logo" aria-label={__('Home')} {...lbryLinkProps}>
|
||||
<img src={OdyseeLogo} className=" mobile-only" />
|
||||
<img src={OdyseeLogoWithText} className=" mobile-hidden" />
|
||||
</Button>
|
||||
<Button className="file-viewer__overlay-logo" icon={ICONS.LBRY} aria-label={__('Home')} {...lbryLinkProps} />
|
||||
{isInApp && <FilePrice uri={uri} />}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// @flow
|
||||
import { ENABLE_NO_SOURCE_CLAIMS, CHANNEL_STAKED_LEVEL_LIVESTREAM } from 'config';
|
||||
import { LOGO_TITLE, ENABLE_NO_SOURCE_CLAIMS, CHANNEL_STAKED_LEVEL_LIVESTREAM } from 'config';
|
||||
import * as ICONS from 'constants/icons';
|
||||
import { SETTINGS } from 'lbry-redux';
|
||||
import * as PAGES from 'constants/pages';
|
||||
@@ -19,8 +19,6 @@ import ChannelThumbnail from 'component/channelThumbnail';
|
||||
import { remote } from 'electron';
|
||||
import { IS_MAC } from 'component/app/view';
|
||||
// @endif
|
||||
import OdyseeLogoWithWhiteText from './odysee_white.png';
|
||||
import OdyseeLogoWithText from './odysee.png';
|
||||
|
||||
type Props = {
|
||||
user: ?User,
|
||||
@@ -89,8 +87,8 @@ const Header = (props: Props) => {
|
||||
sidebarOpen,
|
||||
setSidebarOpen,
|
||||
isAbsoluteSideNavHidden,
|
||||
hideCancel,
|
||||
user,
|
||||
hideCancel,
|
||||
activeChannelClaim,
|
||||
activeChannelStakedLevel,
|
||||
} = props;
|
||||
@@ -102,7 +100,7 @@ const Header = (props: Props) => {
|
||||
const isPwdResetPage = history.location.pathname.includes(PAGES.AUTH_PASSWORD_RESET);
|
||||
const hasBackout = Boolean(backout);
|
||||
const { backLabel, backNavDefault, title: backTitle, simpleTitle: simpleBackTitle } = backout || {};
|
||||
// const notificationsEnabled = (user && user.experimental_ui) || false;
|
||||
const notificationsEnabled = (user && user.experimental_ui) || false;
|
||||
const livestreamEnabled = Boolean(
|
||||
ENABLE_NO_SOURCE_CLAIMS &&
|
||||
user &&
|
||||
@@ -242,12 +240,19 @@ const Header = (props: Props) => {
|
||||
icon={ICONS.MENU}
|
||||
onClick={() => setSidebarOpen(!sidebarOpen)}
|
||||
>
|
||||
{isAbsoluteSideNavHidden && isMobile && <NotificationBubble />}
|
||||
{isAbsoluteSideNavHidden && isMobile && notificationsEnabled && <NotificationBubble />}
|
||||
</Button>
|
||||
</span>
|
||||
)}
|
||||
<Button
|
||||
className="header__navigation-item header__navigation-item--lbry header__navigation-item--button-mobile"
|
||||
className="header__navigation-item header__navigation-item--lbry"
|
||||
// @if TARGET='app'
|
||||
label={'LBRY'}
|
||||
// @endif
|
||||
// @if TARGET='web'
|
||||
label={LOGO_TITLE} // eslint-disable-line
|
||||
// @endif
|
||||
icon={ICONS.LBRY}
|
||||
onClick={() => {
|
||||
if (history.location.pathname === '/') window.location.reload();
|
||||
}}
|
||||
@@ -257,12 +262,7 @@ const Header = (props: Props) => {
|
||||
}}
|
||||
// @endif
|
||||
{...homeButtonNavigationProps}
|
||||
>
|
||||
<img
|
||||
src={currentTheme === 'light' ? OdyseeLogoWithText : OdyseeLogoWithWhiteText}
|
||||
className="header__odysee"
|
||||
/>
|
||||
</Button>
|
||||
/>
|
||||
|
||||
{!authHeader && (
|
||||
<div className="header__center">
|
||||
@@ -279,7 +279,7 @@ const Header = (props: Props) => {
|
||||
|
||||
<HeaderMenuButtons
|
||||
authenticated={authenticated}
|
||||
notificationsEnabled
|
||||
notificationsEnabled={notificationsEnabled}
|
||||
history={history}
|
||||
handleThemeToggle={handleThemeToggle}
|
||||
currentTheme={currentTheme}
|
||||
@@ -432,10 +432,6 @@ function HeaderMenuButtons(props: HeaderMenuButtonProps) {
|
||||
<Icon aria-hidden icon={ICONS.CHANNEL} />
|
||||
{__('New Channel')}
|
||||
</MenuItem>
|
||||
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.YOUTUBE_SYNC}`)}>
|
||||
<Icon aria-hidden icon={ICONS.YOUTUBE} />
|
||||
{__('Sync YouTube Channel')}
|
||||
</MenuItem>
|
||||
|
||||
{livestreamEnabled && (
|
||||
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.LIVESTREAM}`)}>
|
||||
|
||||
@@ -10,7 +10,7 @@ import { doUserInviteNew } from 'redux/actions/user';
|
||||
import { selectMyChannelClaims, selectFetchingMyChannels, doFetchChannelListMine } from 'lbry-redux';
|
||||
import InviteNew from './view';
|
||||
|
||||
const select = (state) => ({
|
||||
const select = state => ({
|
||||
errorMessage: selectUserInviteNewErrorMessage(state),
|
||||
invitesRemaining: selectUserInvitesRemaining(state),
|
||||
referralLink: selectUserInviteReferralLink(state),
|
||||
@@ -20,8 +20,8 @@ const select = (state) => ({
|
||||
fetchingChannels: selectFetchingMyChannels(state),
|
||||
});
|
||||
|
||||
const perform = (dispatch) => ({
|
||||
inviteNew: (email) => dispatch(doUserInviteNew(email)),
|
||||
const perform = dispatch => ({
|
||||
inviteNew: email => dispatch(doUserInviteNew(email)),
|
||||
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
|
||||
});
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri } from 'lbry-redux';
|
||||
import LivestreamFeed from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
});
|
||||
|
||||
export default connect(select)(LivestreamFeed);
|
||||
@@ -1,38 +0,0 @@
|
||||
// @flow
|
||||
import { BITWAVE_USERNAME, BITWAVE_EMBED_URL } from 'constants/livestream';
|
||||
import React from 'react';
|
||||
import FileTitleSection from 'component/fileTitleSection';
|
||||
import LivestreamComments from 'component/livestreamComments';
|
||||
|
||||
type Props = {
|
||||
uri: string,
|
||||
claim: ?StreamClaim,
|
||||
activeViewers: number,
|
||||
};
|
||||
|
||||
export default function LivestreamFeed(props: Props) {
|
||||
const { claim, uri, activeViewers } = props;
|
||||
|
||||
if (!claim) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="section card-stack">
|
||||
<div className="file-render file-render--video livestream">
|
||||
<div className="file-viewer">
|
||||
<iframe
|
||||
src={`${BITWAVE_EMBED_URL}/${BITWAVE_USERNAME}?skin=odysee&autoplay=1`}
|
||||
scrolling="no"
|
||||
allowFullScreen
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<FileTitleSection uri={uri} livestream activeViewers={activeViewers} />
|
||||
</div>
|
||||
<LivestreamComments uri={uri} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
import { connect } from 'react-redux';
|
||||
import { makeSelectClaimForUri, makeSelectTagInClaimOrChannelForUri, makeSelectThumbnailForUri } from 'lbry-redux';
|
||||
import { makeSelectClaimForUri, makeSelectThumbnailForUri } from 'lbry-redux';
|
||||
import LivestreamLayout from './view';
|
||||
import { DISABLE_COMMENTS_TAG } from 'constants/tags';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
|
||||
chatDisabled: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_COMMENTS_TAG)(state),
|
||||
});
|
||||
|
||||
export default connect(select)(LivestreamLayout);
|
||||
|
||||
@@ -10,11 +10,10 @@ type Props = {
|
||||
claim: ?StreamClaim,
|
||||
isLive: boolean,
|
||||
activeViewers: number,
|
||||
chatDisabled: boolean,
|
||||
};
|
||||
|
||||
export default function LivestreamLayout(props: Props) {
|
||||
const { claim, uri, isLive, activeViewers, chatDisabled } = props;
|
||||
const { claim, uri, isLive, activeViewers } = props;
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
if (!claim || !claim.signing_channel) {
|
||||
@@ -37,14 +36,6 @@ export default function LivestreamLayout(props: Props) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{Boolean(chatDisabled) && (
|
||||
<div className="help--notice">
|
||||
{__('%channel% has disabled chat for this stream. Enjoy the stream!', {
|
||||
channel: channelName || __('This channel'),
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!isLive && (
|
||||
<div className="help--notice">
|
||||
{__("%channel% isn't live right now, but the chat is! Check back later to watch the stream.", {
|
||||
|
||||
@@ -17,7 +17,7 @@ export default function LivestreamLink(props: Props) {
|
||||
const { push } = useHistory();
|
||||
const [livestreamClaim, setLivestreamClaim] = React.useState(false);
|
||||
const [isLivestreaming, setIsLivestreaming] = React.useState(false);
|
||||
const livestreamChannelId = (channelClaim && channelClaim.claim_id) || ''; // TODO: fail in a safer way, probably
|
||||
const livestreamChannelId = channelClaim.claim_id || ''; // TODO: fail in a safer way, probably
|
||||
|
||||
React.useEffect(() => {
|
||||
if (livestreamChannelId) {
|
||||
@@ -29,7 +29,7 @@ export default function LivestreamLink(props: Props) {
|
||||
})
|
||||
.then((res) => {
|
||||
if (res && res.items && res.items.length > 0) {
|
||||
const claim = res.items[0];
|
||||
const claim = res.items[res.items.length - 1];
|
||||
setLivestreamClaim(claim);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import { SITE_NAME, LOGIN_IMG_URL } from 'config';
|
||||
import { getThumbnailCdnUrl } from 'util/thumbnail';
|
||||
|
||||
function LoginGraphic(props: any) {
|
||||
const [error, setError] = React.useState(false);
|
||||
const [src, setSrc] = React.useState('---');
|
||||
const containerRef = React.useRef<any>();
|
||||
const imgUrl = LOGIN_IMG_URL;
|
||||
|
||||
React.useEffect(() => {
|
||||
if (containerRef.current && containerRef.current.parentElement && containerRef.current.parentElement.offsetWidth) {
|
||||
const newWidth = containerRef.current.parentElement.offsetWidth;
|
||||
|
||||
let newSrc = imgUrl && imgUrl.trim().replace(/^http:\/\//i, 'https://');
|
||||
// @if TARGET='web'
|
||||
// Pass image urls through a compression proxy, except for GIFs.
|
||||
newSrc = getThumbnailCdnUrl({ thumbnail: newSrc, width: newWidth, height: newWidth * 2 });
|
||||
// @endif
|
||||
|
||||
setSrc(newSrc);
|
||||
} else {
|
||||
setSrc(imgUrl);
|
||||
}
|
||||
}, []);
|
||||
|
||||
if (error || !imgUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="signup-image" ref={containerRef}>
|
||||
<img alt={__('%SITE_NAME% login', { SITE_NAME })} src={src} onError={() => setError(true)} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default LoginGraphic;
|
||||
@@ -45,7 +45,6 @@ export default function Notification(props: Props) {
|
||||
notificationTarget = `/$/${PAGES.CHANNELS_FOLLOWING}`;
|
||||
break;
|
||||
case NOTIFICATIONS.MISSED_OUT:
|
||||
case NOTIFICATIONS.REWARDS_APPROVAL_PROMPT:
|
||||
notificationTarget = `/$/${PAGES.REWARDS_VERIFY}?redirect=/$/${PAGES.REWARDS}`;
|
||||
break;
|
||||
default:
|
||||
@@ -88,7 +87,6 @@ export default function Notification(props: Props) {
|
||||
case NOTIFICATIONS.DAILY_WATCH_AVAILABLE:
|
||||
case NOTIFICATIONS.DAILY_WATCH_REMIND:
|
||||
case NOTIFICATIONS.MISSED_OUT:
|
||||
case NOTIFICATIONS.REWARDS_APPROVAL_PROMPT:
|
||||
icon = <Icon icon={ICONS.LBC} sectionIcon />;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -5,12 +5,14 @@ import classnames from 'classnames';
|
||||
type Props = {
|
||||
unseenCount: number,
|
||||
inline: boolean,
|
||||
user: ?User,
|
||||
};
|
||||
|
||||
export default function NotificationHeaderButton(props: Props) {
|
||||
const { unseenCount, inline = false } = props;
|
||||
const { unseenCount, inline = false, user } = props;
|
||||
const notificationsEnabled = user && user.experimental_ui;
|
||||
|
||||
if (unseenCount === 0) {
|
||||
if (unseenCount === 0 || !notificationsEnabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,9 @@ export default function NotificationHeaderButton(props: Props) {
|
||||
// notifications,
|
||||
// fetching,
|
||||
doSeeAllNotifications,
|
||||
// user,
|
||||
user,
|
||||
} = props;
|
||||
const notificationsEnabled = user && user.experimental_ui;
|
||||
const { push } = useHistory();
|
||||
|
||||
function handleMenuClick() {
|
||||
@@ -31,6 +32,10 @@ export default function NotificationHeaderButton(props: Props) {
|
||||
push(`/$/${PAGES.NOTIFICATIONS}`);
|
||||
}
|
||||
|
||||
if (!notificationsEnabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Button
|
||||
onClick={handleMenuClick}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// @flow
|
||||
import type { Node } from 'react';
|
||||
import * as PAGES from 'constants/pages';
|
||||
import React, { Fragment } from 'react';
|
||||
import classnames from 'classnames';
|
||||
import SideNavigation from 'component/sideNavigation';
|
||||
@@ -13,6 +12,7 @@ import usePersistedState from 'effects/use-persisted-state';
|
||||
import { useHistory } from 'react-router';
|
||||
import { useIsMobile, useIsMediumScreen } from 'effects/use-screensize';
|
||||
import { parseURI } from 'lbry-redux';
|
||||
import { SIMPLE_SITE } from 'config';
|
||||
|
||||
export const MAIN_CLASS = 'main';
|
||||
type Props = {
|
||||
@@ -22,6 +22,7 @@ type Props = {
|
||||
isUpgradeAvailable: boolean,
|
||||
authPage: boolean,
|
||||
filePage: boolean,
|
||||
homePage: boolean,
|
||||
noHeader: boolean,
|
||||
noFooter: boolean,
|
||||
noSideNavigation: boolean,
|
||||
@@ -29,7 +30,6 @@ type Props = {
|
||||
videoTheaterMode: boolean,
|
||||
isMarkdown?: boolean,
|
||||
livestream?: boolean,
|
||||
chatDisabled: boolean,
|
||||
rightSide?: Node,
|
||||
backout: {
|
||||
backLabel?: string,
|
||||
@@ -54,13 +54,12 @@ function Page(props: Props) {
|
||||
isMarkdown = false,
|
||||
livestream,
|
||||
rightSide,
|
||||
chatDisabled,
|
||||
} = props;
|
||||
|
||||
const {
|
||||
location: { pathname },
|
||||
} = useHistory();
|
||||
const [sidebarOpen, setSidebarOpen] = usePersistedState('sidebar', false);
|
||||
const [sidebarOpen, setSidebarOpen] = usePersistedState('sidebar', !SIMPLE_SITE);
|
||||
const isMediumScreen = useIsMediumScreen();
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
@@ -114,7 +113,7 @@ function Page(props: Props) {
|
||||
'main--file-page': filePage,
|
||||
'main--markdown': isMarkdown,
|
||||
'main--theater-mode': isOnFilePage && videoTheaterMode && !livestream,
|
||||
'main--livestream': livestream && !chatDisabled,
|
||||
'main--livestream': livestream,
|
||||
})}
|
||||
>
|
||||
{children}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user