Compare commits

..
Author SHA1 Message Date
DispatchCommit fc9df70771 disable pointer events while animating 2021-01-29 20:50:19 -05:00
258 changed files with 3235 additions and 7172 deletions

No files matched your search

-3
View File
@@ -9,7 +9,6 @@ WEB_SERVER_PORT=1337
LBRY_WEB_API=https://api.lbry.tv
LBRY_WEB_STREAMING_API=https://cdn.lbryplayer.xyz
LBRY_WEB_BUFFER_API=https://collector-service.api.lbry.tv/api/v1/events/video
COMMENT_SERVER_API=https://comments.lbry.com/api/v2
WELCOME_VERSION=1.0
# Custom Site info
@@ -21,7 +20,6 @@ THUMBNAIL_CDN_URL=https://image-optimizer.vanwanet.com/?address=
SITE_TITLE=lbry.tv
SITE_NAME=lbry.tv
SITE_DESCRIPTION=Meet LBRY, an open, free, and community-controlled content wonderland.
SITE_HELP_EMAIL=help@lbry.com
LOGO_TITLE=lbry.tv
SIMPLE_SITE=false
SHOW_ADS=true
@@ -30,7 +28,6 @@ YRBL_SAD_IMG_URL=https://cdn.lbryplayer.xyz/api/v3/streams/free/yrbl-sad/c2d9649
ENABLE_COMMENT_REACTIONS=true
ENABLE_FILE_REACTIONS=false
ENABLE_CREATOR_REACTIONS=false
CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS=4
# OG
OG_TITLE_SUFFIX=| lbry.tv
-1
View File
@@ -33,7 +33,6 @@ module.name_mapper='^analytics\(.*\)$' -> '<PROJECT_ROOT>/ui/analytics\1'
module.name_mapper='^rewards\(.*\)$' -> '<PROJECT_ROOT>/ui/rewards\1'
module.name_mapper='^i18n\(.*\)$' -> '<PROJECT_ROOT>/ui/i18n\1'
module.name_mapper='^effects\(.*\)$' -> '<PROJECT_ROOT>/ui/effects\1'
module.name_mapper='^comments\(.*\)$' -> '<PROJECT_ROOT>/ui/comments\1'
module.name_mapper='^config\(.*\)$' -> '<PROJECT_ROOT>/config\1'
module.name_mapper='^web\/component\(.*\)$' -> '<PROJECT_ROOT>/web/component\1'
module.name_mapper='^web\/effects\(.*\)$' -> '<PROJECT_ROOT>/web/effects\1'
+1 -2
View File
@@ -20,7 +20,7 @@ jobs:
name: 'build'
strategy:
matrix:
node-version: [14.x]
node-version: [12.x]
os:
- ubuntu-latest
- macos-latest
@@ -74,7 +74,6 @@ jobs:
ENABLE_COMMENT_REACTIONS: true
DEFAULT_LANGUAGE: en
KNOWN_APP_DOMAINS: lbry.tv,lbry.lat,odysee.com
CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS: 0
- uses: actions/upload-artifact@v2
if: |
+1 -18
View File
@@ -8,31 +8,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
- Wallet balance UI improvements ([#5276](https://github.com/lbryio/lbry-desktop/pull/5387))
- Mass tip unlock ([#5409](https://github.com/lbryio/lbry-desktop/pull/5387))
- Zoomable image viewer in Markdown (posts and comments) _community pr!_ ([#5387](https://github.com/lbryio/lbry-desktop/pull/5387))
- Enable PDF Viewer in App _community pr!_ ([#2903](https://github.com/lbryio/lbry-desktop/issues/2903))
- The search bar now handles both lbry.tv and Odysee links regardless of which site the user is in ([#5604](https://github.com/lbryio/lbry-desktop/issues/5604))
- The video/audio player's control tooltip is now localized and includes hints for keyboard shortcuts ([#5584](https://github.com/lbryio/lbry-desktop/issues/5584))
- Finnish and Norwegian language support ([#5532](https://github.com/lbryio/lbry-desktop/issues/5532))
### Changed
- Re-enable PDF Viewer in desktop app _community pr!_ ([#5420](https://github.com/lbryio/lbry-desktop/issues/5420))
### Fixed
- Player doesn't stop playing when editing a comment that includes a video url _community pr!_ ([#5384](https://github.com/lbryio/lbry-desktop/pull/5384))
- Main video/audio playback stopped every time a comment is edited or deleted ([#5606](https://github.com/lbryio/lbry-desktop/pull/5606))
- Winning search result not working correctly with mature content enabled _community pr!_ ([#5388](https://github.com/lbryio/lbry-desktop/pull/5388))
- Home/End key not working as expected in Search Bar ([#5642](https://github.com/lbryio/lbry-desktop/pull/5642))
- Fixes to inline videos in comments _community pr!_ ([#5389](https://github.com/lbryio/lbry-desktop/pull/5389))
- Search page crashing on some results ([#5428](https://github.com/lbryio/lbry-desktop/pull/5428))
- Long channel names caused comments to extend underneath related content _community pr!_ ([#5431](https://github.com/lbryio/lbry-desktop/pull/5431))
- Keep floating player always visible _community pr!_ ([#5448](https://github.com/lbryio/lbry-desktop/pull/5448))
- LBRY Desktop incorrectly setting itself as the default HTML-file application in Linux ([#5617](https://github.com/lbryio/lbry-desktop/pull/5617))
- All notifications being cleared when only 1 is clicked ([#5619](https://github.com/lbryio/lbry-desktop/pull/5619))
- Markdown editor's "Create Link (Ctrl-K)" action now directly highlights the URL stub when the label is present ([#5585](https://github.com/lbryio/lbry-desktop/issues/5585))
## [0.49.4] - [2021-01-26]
@@ -48,7 +31,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- No longer supporting 32 bit windows
- Updated lbry-sdk to [0.88.0](https://github.com/lbryio/lbry-sdk/releases/tag/v0.88.0)
- Improve how spendable balance is displayed ([#5409](https://github.com/lbryio/lbry-desktop/pull/5276))
- Improve how spendable balance is displayed ([#5276](https://github.com/lbryio/lbry-desktop/pull/5276))
### Fixed
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2017-2021 LBRY Inc.
Copyright (c) 2017-2020 LBRY Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
-3
View File
@@ -12,7 +12,6 @@ const config = {
LBRY_API_URL: process.env.LBRY_API_URL, //api.lbry.com',
LBRY_WEB_STREAMING_API: process.env.LBRY_WEB_STREAMING_API, //cdn.lbryplayer.xyz',
LBRY_WEB_BUFFER_API: process.env.LBRY_WEB_BUFFER_API,
COMMENT_SERVER_API: process.env.COMMENT_SERVER_API,
WELCOME_VERSION: process.env.WELCOME_VERSION,
DOMAIN: process.env.DOMAIN,
SHARE_DOMAIN_URL: process.env.SHARE_DOMAIN_URL,
@@ -21,7 +20,6 @@ const config = {
SITE_TITLE: process.env.SITE_TITLE,
SITE_NAME: process.env.SITE_NAME,
SITE_DESCRIPTION: process.env.SITE_DESCRIPTION,
SITE_HELP_EMAIL: process.env.SITE_HELP_EMAIL,
LOGO_TITLE: process.env.LOGO_TITLE,
OG_TITLE_SUFFIX: process.env.OG_TITLE_SUFFIX,
OG_HOMEPAGE_TITLE: process.env.OG_HOMEPAGE_TITLE,
@@ -35,7 +33,6 @@ const config = {
ENABLE_COMMENT_REACTIONS: process.env.ENABLE_COMMENT_REACTIONS === 'true',
ENABLE_FILE_REACTIONS: process.env.ENABLE_FILE_REACTIONS === 'true',
ENABLE_CREATOR_REACTIONS: process.env.ENABLE_CREATOR_REACTIONS === 'true',
CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS: process.env.CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS,
SIMPLE_SITE: process.env.SIMPLE_SITE === 'true',
SHOW_ADS: process.env.SHOW_ADS === 'true',
PINNED_URI_1: process.env.PINNED_URI_1,
+1 -4
View File
@@ -46,10 +46,7 @@ let lbryFirst;
const appState = {};
if (process.platform !== 'linux') {
app.setAsDefaultProtocolClient('lbry');
}
app.setAsDefaultProtocolClient('lbry');
app.name = 'LBRY';
app.setAppUserModelId('io.lbry.LBRY');
app.commandLine.appendSwitch('force-color-profile', 'srgb');
-4
View File
@@ -27,10 +27,6 @@ declare type CommentsState = {
myReactsByCommentId: any,
othersReactsByCommentId: any,
pendingCommentReactions: Array<string>,
moderationBlockList: ?Array<string>,
fetchingModerationBlockList: boolean,
blockingByUri: {},
unBlockingByUri: {},
};
declare type CommentReactParams = {
-16
View File
@@ -1,16 +0,0 @@
// @flow
declare type CommentListParams = {
page: number,
page_size: number,
claim_id: string,
};
declare type CommentAbandonParams = {
comment_id: string,
creator_channel_id?: string,
creator_channel_name?: string,
channel_id?: string,
hexdata?: string,
};
declare type ModerationBlockParams = {};
+41 -20
View File
@@ -127,7 +127,12 @@ export default function GetHomePageRowData(
pageSize: getPageSize(12),
channelIds: YOUTUBER_CHANNEL_IDS,
limitClaimsPerChannel: 1,
releaseTime: `>${Math.floor(moment().subtract(1, 'months').startOf('week').unix())}`,
releaseTime: `>${Math.floor(
moment()
.subtract(1, 'months')
.startOf('week')
.unix()
)}`,
},
};
@@ -154,8 +159,18 @@ export default function GetHomePageRowData(
orderBy: ['release_time'],
releaseTime:
subscribedChannels.length > 20
? `>${Math.floor(moment().subtract(6, 'months').startOf('week').unix())}`
: `>${Math.floor(moment().subtract(1, 'year').startOf('week').unix())}`,
? `>${Math.floor(
moment()
.subtract(6, 'months')
.startOf('week')
.unix()
)}`
: `>${Math.floor(
moment()
.subtract(1, 'year')
.startOf('week')
.unix()
)}`,
pageSize: getPageSize(subscribedChannels.length > 3 ? (subscribedChannels.length > 6 ? 16 : 8) : 4),
channelIds: subscribedChannels.map((subscription: Subscription) => {
const { channelClaimId } = parseURI(subscription.uri);
@@ -172,7 +187,12 @@ export default function GetHomePageRowData(
orderBy: ['effective_amount'],
claimType: ['stream'],
limitClaimsPerChannel: 2,
releaseTime: `>${Math.floor(moment().subtract(1, 'day').startOf('day').unix())}`,
releaseTime: `>${Math.floor(
moment()
.subtract(1, 'day')
.startOf('day')
.unix()
)}`,
},
};
@@ -185,21 +205,21 @@ export default function GetHomePageRowData(
},
};
// const TRENDING_CLASSICS = {
// title: __('Trending Classics'),
// link: `/$/${PAGES.DISCOVER}?${CS.ORDER_BY_KEY}=${CS.ORDER_BY_TRENDING}&${CS.FRESH_KEY}=${CS.FRESH_WEEK}`,
// options: {
// pageSize: getPageSize(4),
// claimType: ['stream'],
// limitClaimsPerChannel: 1,
// releaseTime: `<${Math.floor(
// moment()
// .subtract(6, 'month')
// .startOf('day')
// .unix()
// )}`,
// },
// };
const TRENDING_CLASSICS = {
title: __('Trending Classics'),
link: `/$/${PAGES.DISCOVER}?${CS.ORDER_BY_KEY}=${CS.ORDER_BY_TRENDING}&${CS.FRESH_KEY}=${CS.FRESH_WEEK}`,
options: {
pageSize: getPageSize(4),
claimType: ['stream'],
limitClaimsPerChannel: 1,
releaseTime: `<${Math.floor(
moment()
.subtract(6, 'month')
.startOf('day')
.unix()
)}`,
},
};
// const TRENDING_ON_LBRY = {
// title: __('Trending On LBRY'),
@@ -216,7 +236,7 @@ export default function GetHomePageRowData(
options: {
pageSize: getPageSize(4),
tags: followedTags.map((tag) => tag.name),
tags: followedTags.map(tag => tag.name),
claimType: ['stream'],
limitClaimsPerChannel: 2,
},
@@ -254,6 +274,7 @@ export default function GetHomePageRowData(
rowData.push(YOUTUBE_CREATOR_ROW);
}
rowData.push(TRENDING_CLASSICS);
rowData.push(TOP_CONTENT_TODAY);
// rowData.push(TRENDING_ON_LBRY);
-1
View File
@@ -2,4 +2,3 @@ import * as lbrytv from './homepage';
// import all homepages
// export object of homepages
export default {'en': lbrytv};
export const NO_ADS_CHANNEL_IDS = [];
+17 -18
View File
@@ -53,7 +53,8 @@
"electron-updater": "^4.2.4",
"express": "^4.17.1",
"if-env": "^1.0.4",
"remove-markdown": "^0.3.0",
"remark-breaks": "^2.0.1",
"remove-markdown": "^0.3.0",
"tempy": "^0.6.0",
"videojs-logo": "^2.1.4"
},
@@ -67,18 +68,17 @@
"@babel/plugin-transform-runtime": "^7.4.3",
"@babel/polyfill": "^7.2.5",
"@babel/preset-env": "^7.12.11",
"@babel/preset-flow": "^7.12.1",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.0.0",
"@datapunt/matomo-tracker-js": "^0.1.4",
"@exponent/electron-cookies": "^2.0.0",
"@hot-loader/react-dom": "^16.13",
"@reach/auto-id": "^0.13.0",
"@reach/auto-id": "^0.12.1",
"@reach/combobox": "^0.12.1",
"@reach/menu-button": "0.7.4",
"@reach/rect": "^0.13.0",
"@reach/tabs": "^0.1.5",
"@reach/tooltip": "^0.12.1",
"@reach/utils": "^0.12.1",
"@sentry/browser": "^5.12.1",
"@sentry/webpack-plugin": "^1.10.0",
@@ -87,17 +87,17 @@
"async-exit-hook": "^2.0.1",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.5",
"babel-plugin-add-module-exports": "^1.0.4",
"babel-plugin-add-module-exports": "^1.0.0",
"babel-plugin-import-glob": "^2.0.0",
"babel-plugin-transform-imports": "^1.5.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"bluebird": "^3.5.1",
"chalk": "^4.1.0",
"chalk": "^2.4.2",
"classnames": "^2.2.5",
"codemirror": "^5.39.2",
"concurrently": "^4.1.2",
"connected-react-router": "^6.8.0",
"copy-webpack-plugin": "^5.1.2",
"connected-react-router": "^6.4.0",
"copy-webpack-plugin": "^4.6.0",
"country-data": "^0.0.31",
"cross-env": "^7.0.3",
"crypto-js": "^4.0.0",
@@ -117,7 +117,6 @@
"electron-is-dev": "^0.3.0",
"electron-webpack": "^2.8.2",
"electron-window-state": "^4.1.1",
"emoji-dictionary": "^1.0.11",
"eslint": "^5.15.2",
"eslint-config-prettier": "^2.9.0",
"eslint-config-standard": "^12.0.0",
@@ -136,18 +135,18 @@
"flow-bin": "^0.97.0",
"flow-typed": "^2.3.0",
"formik": "^0.10.4",
"hast-util-sanitize": "^3.0.2",
"hast-util-sanitize": "^1.1.2",
"history": "^4.9.0",
"husky": "^3.1.0",
"imagesloaded": "^4.1.4",
"json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#bf728f8716385749370de9a1edee50b267d61fa4",
"lbryinc": "lbryio/lbryinc#7faea40d87b78ec91b901c62f501499dc4737025",
"lbry-redux": "lbryio/lbry-redux#7bd6ae1824f9241fdaea6441558fb52f0e465553",
"lbryinc": "lbryio/lbryinc#eee2cb730ecec95a1344a755035755b0d4dad5cf",
"lint-staged": "^7.0.2",
"localforage": "^1.7.1",
"lodash-es": "^4.17.14",
"mammoth": "^1.4.16",
"mammoth": "^1.4.6",
"moment": "^2.22.0",
"node-abi": "^2.5.1",
"node-fetch": "^2.6.1",
@@ -158,7 +157,7 @@
"postcss-loader": "^3.0.0",
"postcss-rtl": "^1.7.3",
"preprocess-loader": "^0.3.0",
"prettier": "^2.2.1",
"prettier": "^1.11.1",
"prop-types": "^15.6.2",
"qrcode.react": "^0.8.0",
"raw-loader": "^2.0.0",
@@ -175,7 +174,7 @@
"react-redux": "^6.0.1",
"react-router": "^5.1.0",
"react-router-dom": "^5.1.0",
"react-simplemde-editor": "^4.1.3",
"react-simplemde-editor": "^4.0.0",
"react-spring": "^8.0.20",
"reakit": "^1.0.0-beta.13",
"redux": "^3.6.0",
@@ -185,7 +184,6 @@
"redux-thunk": "^2.2.0",
"remark": "^9.0.0",
"remark-attr": "^0.8.3",
"remark-breaks": "^1.0.5",
"remark-emoji": "^2.0.1",
"remark-frontmatter": "^2.0.0",
"remark-react": "^8.0.0",
@@ -197,15 +195,16 @@
"strip-markdown": "^3.0.3",
"style-loader": "^0.23.1",
"terser-webpack-plugin": "^1.2.3",
"three": "^0.125.0",
"three": "^0.93.0",
"three-full": "^17.1.0",
"tiny-relative-date": "^1.3.0",
"tree-kill": "^1.1.0",
"unist-util-visit": "^2.0.3",
"unist-util-visit": "^1.4.1",
"uuid": "^8.3.2",
"video.js": "^7.10.1",
"videojs-contrib-quality-levels": "^2.0.9",
"videojs-event-tracking": "^1.0.1",
"videojs-hls-quality-selector": "^1.1.4",
"villain-react": "^1.0.9",
"wavesurfer.js": "^2.2.1",
"webpack": "^4.28.4",
+28 -78
View File
@@ -18,7 +18,6 @@
"Settings": "Settings",
"Help": "Help",
"No results": "No results",
"No results. Contents may be hidden by the Language filter.": "No results. Contents may be hidden by the Language filter.",
"Home": "Home",
"Library": "Library",
"Purchased": "Purchased",
@@ -32,7 +31,6 @@
"Play": "Play",
"Subscribe": "Subscribe",
"Report content": "Report content",
"Report Content": "Report Content",
"Content-Type": "Content-Type",
"Languages": "Languages",
"Media Type": "Media Type",
@@ -48,6 +46,8 @@
"Description of your content": "Description of your content",
"Price": "Price",
"Free": "Free",
"This is a username or handle that your content can be found under.": "This is a username or handle that your content can be found under.",
"Ex. @Marvel, @TheBeatles, @BooksByJoe": "Ex. @Marvel, @TheBeatles, @BooksByJoe",
"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",
@@ -143,7 +143,7 @@
"Purchase and tip confirmations": "Purchase and tip confirmations",
"Always confirm before purchasing content or tipping": "Always confirm before purchasing content or tipping",
"Only confirm purchases or tips over a certain amount": "Only confirm purchases or tips over a certain amount",
"When this option is chosen, LBRY won't ask you to confirm purchases or tips below your chosen amount.": "When this option is chosen, LBRY won't ask you to confirm purchases or tips below your chosen amount.",
"When this option is chosen, LBRY won't ask you to confirm downloads or tips below your chosen amount.": "When this option is chosen, LBRY won't ask you to confirm downloads or tips below your chosen amount.",
"Content settings": "Content settings",
"Notifications": "Notifications",
"Show Desktop Notifications": "Show Desktop Notifications",
@@ -214,7 +214,7 @@
"Skip": "Skip",
"An updated version of LBRY is now available.": "An updated version of LBRY is now available.",
"Your version is out of date and may be unreliable or insecure.": "Your version is out of date and may be unreliable or insecure.",
"A new version %release_tag% of LBRY is ready for you.": "A new version %release_tag% of LBRY is ready for you.",
"A new version of LBRY is ready for you.": "A new version of LBRY is ready for you.",
"Want to know what has changed? See the %release_notes%.": "Want to know what has changed? See the %release_notes%.",
"release notes": "release notes",
"Read the FAQ": "Read the FAQ",
@@ -293,6 +293,7 @@
"Clearing": "Clearing",
"A deposit amount is required": "A deposit amount is required",
"Deposit cannot be 0": "Deposit cannot be 0",
"Your deposit cannot be 0": "Your deposit cannot be 0",
"Please decrease your deposit to account for transaction fees": "Please decrease your deposit to account for transaction fees",
"Upload thumbnail": "Upload thumbnail",
"Confirm Thumbnail Upload": "Confirm Thumbnail Upload",
@@ -457,7 +458,10 @@
"View File": "View File",
"Close": "Close",
"LBRY Download Complete": "LBRY Download Complete",
"Blocked": "Blocked",
"Unblock": "Unblock",
"You have blocked this channel content.": "You have blocked this channel content.",
"Blocked %channelUrl%": "Blocked %channelUrl%",
"This channel hasn't published anything yet": "This channel hasn't published anything yet",
"Network and data settings": "Network and data settings",
"Save all viewed content to your downloads directory": "Save all viewed content to your downloads directory",
@@ -466,7 +470,7 @@
"If disabled, LBRY will be very sad and you won't be helping improve the network.": "If disabled, LBRY will be very sad and you won't be helping improve the network.",
"Floating video player": "Floating video player",
"Keep content playing in the corner when navigating to a different page.": "Keep content playing in the corner when navigating to a different page.",
"Blocked and muted channels": "Blocked and muted channels",
"Blocked channels": "Blocked channels",
"Manage": "Manage",
"Automatic dark mode": "Automatic dark mode",
"Hide wallet balance in header": "Hide wallet balance in header",
@@ -492,7 +496,7 @@
"Dark": "Dark",
"light": "light",
"dark": "dark",
"Live help is available most hours in the %channel% channel of our Discord chat room. Or you can always email us at %help_email%.": "Live help is available most hours in the %channel% channel of our Discord chat room. Or you can always email us at %help_email%.",
"Live help is available most hours in the %channel% channel of our Discord chat room. Or you can always email us at help@lbry.com.": "Live help is available most hours in the %channel% channel of our Discord chat room. Or you can always email us at help@lbry.com.",
"Your LBRY Credits, channels, and publishes are controllable by you and only you, via a wallet file stored locally on your computer.": "Your LBRY Credits, channels, and publishes are controllable by you and only you, via a wallet file stored locally on your computer.",
"However, it is easy to back up manually. To backup your wallet, make a copy of the folder listed below:": "However, it is easy to back up manually. To backup your wallet, make a copy of the folder listed below:",
"Access to these files are equivalent to having access to your Credits, channels, and publishes. Keep any copies you make of your wallet in a secure place. For more details on backing up and best practices %helpLink%.": "Access to these files are equivalent to having access to your Credits, channels, and publishes. Keep any copies you make of your wallet in a secure place. For more details on backing up and best practices %helpLink%.",
@@ -562,6 +566,7 @@
"This account must undergo review before you can participate in the rewards program.": "This account must undergo review before you can participate in the rewards program.",
"This can take anywhere from several minutes to several days.": "This can take anywhere from several minutes to several days.",
"We apologize for this inconvenience, but have added this additional step to prevent fraud.": "We apologize for this inconvenience, but have added this additional step to prevent fraud.",
"If you continue to see this message, send us an email to help@lbry.com.": "If you continue to see this message, send us an email to help@lbry.com.",
"Return Home": "Return Home",
"Please enjoy free content in the meantime!": "Please enjoy free content in the meantime!",
"Claimed Rewards": "Claimed Rewards",
@@ -675,9 +680,9 @@
"Add": "Add",
"In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.": "In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.",
"lbry.tv": "lbry.tv",
"Your blocked channels": "Your blocked channels",
"Bid position must be a number.": "Bid position must be a number.",
"Copy": "Copy",
"Copy Link": "Copy Link",
"Text copied": "Text copied",
"Rewards Disabled": "Rewards Disabled",
"Wallet servers are used to relay data to and from the LBRY blockchain. They also determine what content shows in trending or is blocked. %learn_more%.": "Wallet servers are used to relay data to and from the LBRY blockchain. They also determine what content shows in trending or is blocked. %learn_more%.",
@@ -735,6 +740,7 @@
"Repost": "Repost",
"Repost your favorite claims to help more people discover them!": "Repost your favorite claims to help more people discover them!",
"Repost %title%": "Repost %title%",
"Channel to repost on": "Channel to repost on",
"Advanced": "Advanced",
"community name": "community name",
"Change this to repost to a different %lbry_naming_link%.": "Change this to repost to a different %lbry_naming_link%.",
@@ -818,6 +824,8 @@
"Known Tags": "Known Tags",
"Almost there": "Almost there",
"More Channels": "More Channels",
"You aren’t blocking any channels": "You aren’t blocking any channels",
"When you block a channel, all content from that channel will be hidden.": "When you block a channel, all content from that channel will be hidden.",
"View top claims for %normalized_uri%": "View top claims for %normalized_uri%",
"view all claims": "view all claims",
"Top claims at lbry://%name%": "Top claims at lbry://%name%",
@@ -882,8 +890,6 @@
"Change Inviter": "Change Inviter",
"You haven't uploaded anything yet. This is where you can find them when you do!": "You haven't uploaded anything yet. This is where you can find them when you do!",
"You haven't uploaded anything with this channel yet!": "You haven't uploaded anything with this channel yet!",
"You haven't uploaded anything": "You haven't uploaded anything",
"Upload something to start tracking your stats!": "Upload something to start tracking your stats!",
"You haven't created a channel yet, let's fix that!": "You haven't created a channel yet, let's fix that!",
"Upload Something": "Upload Something",
"Amount cannot be zero": "Amount cannot be zero",
@@ -899,6 +905,7 @@
"Already have an account? %sign_in%": "Already have an account? %sign_in%",
"Sign in with a password (optional)": "Sign in with a password (optional)",
"Don't have an account? %sign_up%": "Don't have an account? %sign_up%",
"Preparing your content": "Preparing your content",
"File details": "File details",
"You can unlock all or some of these LBRY Credits at any time.": "You can unlock all or some of these LBRY Credits at any time.",
"Keeping it locked improves the trust and discoverability of your content.": "Keeping it locked improves the trust and discoverability of your content.",
@@ -937,7 +944,7 @@
"You have %count% blocked %channels%.": "You have %count% blocked %channels%.",
"Account password": "Account password",
"You do not currently have a password set.": "You do not currently have a password set.",
"Enter your %SITE_NAME% password": "Enter your %SITE_NAME% password",
"Enter Your lbry.tv Password": "Enter Your lbry.tv Password",
"Logging in as %email%": "Logging in as %email%",
"Forgot Password?": "Forgot Password?",
"Use Magic Link": "Use Magic Link",
@@ -968,7 +975,7 @@
"You will not see reposts by people you follow or receive email notifying about them.": "You will not see reposts by people you follow or receive email notifying about them.",
"Sorry, your request timed out. Modify your options or %again%": "Sorry, your request timed out. Modify your options or %again%",
"Pause at any time to select a thumbnail from your video": "Pause at any time to select a thumbnail from your video",
"For video content, use MP4s in H264/AAC format and a friendly bitrate (under 5 Mbps) and resolution (720p) for more reliable streaming. %SITE_NAME% uploads are restricted to %limit% GB.": "For video content, use MP4s in H264/AAC format and a friendly bitrate (under 5 Mbps) and resolution (720p) for more reliable streaming. %SITE_NAME% uploads are restricted to %limit% GB.",
"For video content, use MP4s in H264/AAC format and a friendly bitrate (under 5 Mbps) and resolution (720p) for more reliable streaming. %SITE_NAME% uploads are restricted to 2 GB.": "For video content, use MP4s in H264/AAC format and a friendly bitrate (under 5 Mbps) and resolution (720p) for more reliable streaming. %SITE_NAME% uploads are restricted to 2 GB.",
"Share this channel": "Share this channel",
"File preview": "File preview",
"Go Home": "Go Home",
@@ -1016,6 +1023,9 @@
"Purchases": "Purchases",
"No purchases found.": "No purchases found.",
"Your wallet is not currently synced with lbry.tv. You are in control of backing up your wallet.": "Your wallet is not currently synced with lbry.tv. You are in control of backing up your wallet.",
"You don't have blocked channels.": "You don't have blocked channels.",
"You have one blocked channel.": "You have one blocked channel.",
"You have %channels% blocked channels.": "You have %channels% blocked channels.",
"Drop here to publish!": "Drop here to publish!",
"Trending for %tagName%": "Trending for %tagName%",
"Recent From Following": "Recent From Following",
@@ -1055,7 +1065,7 @@
"minute": "minute",
"hours": "hours",
"hour": "hour",
"%SITE_NAME% uploads are limited to %limit% GB. Download the app for unrestricted publishing.": "%SITE_NAME% uploads are limited to %limit% GB. Download the app for unrestricted publishing.",
"%SITE_NAME% uploads are limited to 2 GB. Download the app for unrestricted publishing.": "%SITE_NAME% uploads are limited to 2 GB. Download the app for unrestricted publishing.",
"Connected": "Connected",
"Not connected": "Not connected",
"this link": "this link",
@@ -1159,7 +1169,6 @@
"Thanks for the feedback. Mark has been notified and is currently walking over to his computer to work on this.": "Thanks for the feedback. Mark has been notified and is currently walking over to his computer to work on this.",
"Changelog": "Changelog",
"Boost your content": "Boost your content",
"Boost This Video": "Boost This Video",
"Send Revocable Support": "Send Revocable Support",
"Send a %amount% Tip": "Send a %amount% Tip",
"Channel to show support as": "Channel to show support as",
@@ -1171,8 +1180,7 @@
"Loading your channels...": "Loading your channels...",
"Try out the app!": "Try out the app!",
"Download the app to track files you've viewed and downloaded.": "Download the app to track files you've viewed and downloaded.",
"Create a new channel": "Create a new channel",
"Go Live": "Go Live",
"Create a New Channel": "Create a New Channel",
"Thumbnail source": "Thumbnail source",
"Cover source": "Cover source",
"Your changes will be live in a few minutes": "Your changes will be live in a few minutes",
@@ -1194,6 +1202,8 @@
"Email preferences": "Email preferences",
"Opt out of any topics you don't want to receive email about.": "Opt out of any topics you don't want to receive email about.",
"Uncheck your email below if you want to stop receiving messages.": "Uncheck your email below if you want to stop receiving messages.",
"Remove from blocked list": "Remove from blocked list",
"Are you sure you want to remove this from the list?": "Are you sure you want to remove this from the list?",
"Send a chunk of change to this creator to let them know you appreciate their content.": "Send a chunk of change to this creator to let them know you appreciate their content.",
"CableTube Escape Artists": "CableTube Escape Artists",
"Unlink YouTube Channel": "Unlink YouTube Channel",
@@ -1213,7 +1223,6 @@
"Choose image": "Choose image",
"%image_type% %recommended_ratio%": "%image_type% %recommended_ratio%",
"%label% • File to upload": "%label% • File to upload",
"Video file": "Video file",
"Select video file to upload": "Select video file to upload",
"Uploading...": "Uploading...",
"Use a URL": "Use a URL",
@@ -1249,17 +1258,6 @@
"View thumbnail": "View thumbnail",
"These changes will appear shortly.": "These changes will appear shortly.",
"Block Channel": "Block Channel",
"Unblock Channel": "Unblock Channel",
"Blocking...": "Blocking...",
"Blocked": "Blocked",
"Unblock": "Unblock",
"Unblocking...": "Unblocking...",
"Channel blocked. You will not see them again.": "Channel blocked. You will not see them again.",
"Mute Channel": "Mute Channel",
"Unmute Channel": "Unmute Channel",
"Muted": "Muted",
"Mute": "Mute",
"Unmute": "Unmute",
"Manage notifications": "Manage notifications",
"Uploads": "Uploads",
"Advanced settings": "Advanced settings",
@@ -1324,10 +1322,6 @@
"Sync YouTube Channel": "Sync YouTube Channel",
"Terms": "Terms",
"Privacy Policy": "Privacy Policy",
"Comment replies": "Comment replies",
"Daily watch availability": "Daily watch availability",
"Daily watch reminders": "Daily watch reminders",
"New content": "New content",
"No notifications": "No notifications",
"You don't have any notifications yet, but they will be here when you do!": "You don't have any notifications yet, but they will be here when you do!",
"I like this": "I like this",
@@ -1366,9 +1360,6 @@
"%total_comments% comments": "%total_comments% comments",
"Upvote": "Upvote",
"Downvote": "Downvote",
"You loved this": "You loved this",
"Creator loved this": "Creator loved this",
"A channel is required to throw fire and slime": "A channel is required to throw fire and slime",
"Best": "Best",
"Controversial": "Controversial",
"Show Replies": "Show Replies",
@@ -1399,7 +1390,6 @@
"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.",
"Claim your channel! Create an identity used to securely publish content.": "Claim your channel! Create an identity used to securely publish content.",
"Launch your own channel by sharing a video.": "Launch your own channel by sharing a video.",
"Your First Credit:": "Your First Credit:",
"Return to the app 24-48 hours following your first use of the app. This reward will self destruct after that time span.": "Return to the app 24-48 hours following your first use of the app. This reward will self destruct after that time span.",
"Watch content and earn more Credits for each level unlocked! 10 views required for level 1 (Current Score: 2). Only up to 10 views per day count.": "Watch content and earn more Credits for each level unlocked! 10 views required for level 1 (Current Score: 2). Only up to 10 views per day count.",
"Follow your favorite creators and earn more Credits for each level unlocked! Follow 1 creators for level 1 (Current Score: 1).": "Follow your favorite creators and earn more Credits for each level unlocked! Follow 1 creators for level 1 (Current Score: 1).",
@@ -1410,7 +1400,6 @@
"You will receive an SMS text message confirming your phone number is valid.": "You will receive an SMS text message confirming your phone number is valid.",
"Verified accounts are eligible to earn LBRY Credits for views, watching and reposting videos, sharing invite links etc. Verifying also helps us keep the %SITE_NAME% community safe too! %Refresh% or %Skip%.": "Verified accounts are eligible to earn LBRY Credits for views, watching and reposting videos, sharing invite links etc. Verifying also helps us keep the %SITE_NAME% community safe too! %Refresh% or %Skip%.",
"Your First Nickel": "Your First Nickel",
"Your First Credit": "Your First Credit",
"Go for a Stream": "Go for a Stream",
"Channel Surfing": "Channel Surfing",
"First Upload": "First Upload",
@@ -1520,8 +1509,6 @@
"Learn more about LBRY Credits on %DOMAIN%": "Learn more about LBRY Credits on %DOMAIN%",
"Results boosted by %lbc%": "Results boosted by %lbc%",
"This will be visible in a few minutes.": "This will be visible in a few minutes.",
"Turn on notifications": "Turn on notifications",
"Turn off notifications": "Turn off notifications",
"Notifications turned off for %channel%.": "Notifications turned off for %channel%.",
"Notifications turned on for %channel%.": "Notifications turned on for %channel%.",
"Notifications turned on for %channel%!": "Notifications turned on for %channel%!",
@@ -1538,10 +1525,9 @@
"Something went wrong with your invite link. You can set and claim your invite reward after signing in.": "Something went wrong with your invite link. You can set and claim your invite reward after signing in.",
"Not a valid invite": "Not a valid invite",
"Explore": "Explore",
"Under maintenance...": "Under maintenance...",
"There is a bug... somewhere": "There is a bug... somewhere",
"We're currently upgrading or rebooting our services, please try refreshing in a few minutes.": "We're currently upgrading or rebooting our services, please try refreshing in a few minutes.",
"Try refreshing to fix the issue. If that doesn't work, email %SITE_HELP_EMAIL% for support.": "Try refreshing to fix the issue. If that doesn't work, email %SITE_HELP_EMAIL% for support.",
"Try refreshing to fix the issue. If that doesn't work, email help@lbry.com for support.": "Try refreshing to fix the issue. If that doesn't work, email help@lbry.com for support.",
"No Results": "No Results",
"Content preview": "Content preview",
"Repost url": "Repost url",
"Close sidebar - hide channels you are following": "Close sidebar - hide channels you are following",
@@ -1576,41 +1562,5 @@
"Delete supports to spend": "Delete supports to spend",
"%lbc_amount% boosting content": "%lbc_amount% boosting content",
"Deposit cannot be higher than your available balance: %balance%": "Deposit cannot be higher than your available balance: %balance%",
"This channel has disabled comments on their page.": "This channel has disabled comments on their page.",
"The creator of this content has disabled comments.": "The creator of this content has disabled comments.",
"These %lbc% help your content in search rankings. You can unlock them but that's less fun.": "These %lbc% help your content in search rankings. You can unlock them but that's less fun.",
"You have a lot of tips. This could take some time.": "You have a lot of tips. This could take some time.",
"Your immediately spendable balance is %balance%.": "Your immediately spendable balance is %balance%.",
"%balance% available.": "%balance% available.",
"Unlock all tips": "Unlock all tips",
"Unlock All": "Unlock All",
"Yeah, well, that's just, like, your opinion, man.": "Yeah, well, that's just, like, your opinion, man.",
"Moon cheese is an acquired taste": "Moon cheese is an acquired taste",
"Level %current_level%": "Level %current_level%",
"Creator tools": "Creator tools",
"Prevent this channel from interacting with you.": "Prevent this channel from interacting with you.",
"Hide this channel for you only.": "Hide this channel for you only.",
"Interacting as %channelName%": "Interacting as %channelName%",
"Page Not Found": "Page Not Found",
"Transaction limit reached. Try reducing the Description length.": "Transaction limit reached. Try reducing the Description length.",
"You do not have any muted channels": "You do not have any muted channels",
"You do not have any blocked channels": "You do not have any blocked channels",
"Blocked channels will be invisible to you in the app. They will not be able to comment on your content, or reply to you comments left on other channels' content.": "Blocked channels will be invisible to you in the app. They will not be able to comment on your content, or reply to you comments left on other channels' content.",
"Muted channels will be invisible to you in the app. They will not know they are muted and can still interact with you and your content.": "Muted channels will be invisible to you in the app. They will not know they are muted and can still interact with you and your content.",
"This channel is blocked": "This channel is blocked",
"This channel is muted": "This channel is muted",
"Are you sure you want to view this content? Viewing will not unblock @%channel%": "Are you sure you want to view this content? Viewing will not unblock @%channel%",
"Are you sure you want to view this content? Viewing will not unmute @%channel%": "Are you sure you want to view this content? Viewing will not unmute @%channel%",
"View Content": "View Content",
"Mute (m)": "Mute (m)",
"Playback Rate (<, >)": "Playback Rate (<, >)",
"Fullscreen (f)": "Fullscreen (f)",
"Pause (space)": "Pause (space)",
"Play (space)": "Play (space)",
"Unmute (m)": "Unmute (m)",
"Exit Fullscreen (f)": "Exit Fullscreen (f)",
"Toggle Theater mode (t)": "Toggle Theater mode (t)",
"Quality": "Quality",
"--end--": "--end--",
"Create A LiveStream": "Create A LiveStream",
"--end--": "--end--"
}
-7
View File
@@ -37,7 +37,6 @@ type Analytics = {
tagFollowEvent: (string, boolean, ?string) => void,
playerLoadedEvent: (?boolean) => void,
playerStartedEvent: (?boolean) => void,
videoFetchDuration: (string, number) => void,
videoStartEvent: (string, number) => void,
videoBufferEvent: (
StreamClaim,
@@ -200,12 +199,6 @@ const analytics: Analytics = {
Lbryio.call('feedback', 'search', { query, vote });
}
},
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);
-39
View File
@@ -1,39 +0,0 @@
// @flow
import { COMMENT_SERVER_API } from 'config';
const Comments = {
url: COMMENT_SERVER_API,
enabled: Boolean(COMMENT_SERVER_API),
moderation_block: (params: ModerationBlockParams) => fetchCommentsApi('moderation.Block', params),
moderation_unblock: (params: ModerationBlockParams) => fetchCommentsApi('moderation.UnBlock', params),
moderation_block_list: (params: ModerationBlockParams) => fetchCommentsApi('moderation.BlockedList', params),
comment_list: (params: CommentListParams) => fetchCommentsApi('comment.List', params),
comment_abandon: (params: CommentAbandonParams) => fetchCommentsApi('comment.Abandon', params),
};
function fetchCommentsApi(method: string, params: {}) {
if (!Comments.enabled) {
return Promise.reject('Comments are not currently enabled'); // eslint-disable-line
}
const url = `${Comments.url}?m=${method}`;
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method,
params,
}),
};
return fetch(url, options)
.then((res) => res.json())
.then((res) => res.result);
}
export default Comments;
+10 -2
View File
@@ -1,6 +1,14 @@
import { connect } from 'react-redux';
import { selectBlockedChannels } from 'redux/selectors/blocked';
import { doChannelUnsubscribe } from 'redux/actions/subscriptions';
import { doOpenModal } from 'redux/actions/app';
import AbandonedChannelPreview from './view';
const select = (state, props) => ({});
const select = (state, props) => ({
blockedChannelUris: selectBlockedChannels(state),
});
export default connect(select)(AbandonedChannelPreview);
export default connect(select, {
doChannelUnsubscribe,
doOpenModal,
})(AbandonedChannelPreview);
+38 -7
View File
@@ -2,18 +2,28 @@
import React from 'react';
import classnames from 'classnames';
import ChannelThumbnail from 'component/channelThumbnail';
import Button from 'component/button';
import { parseURI } from 'lbry-redux';
import ChannelBlockButton from 'component/channelBlockButton';
import ChannelMuteButton from 'component/channelMuteButton';
import * as ICONS from '../../constants/icons';
import * as MODALS from 'constants/modal_types';
type SubscriptionArgs = {
channelName: string,
uri: string,
};
type Props = {
uri: string,
doChannelUnsubscribe: SubscriptionArgs => void,
type: string,
blockedChannelUris: Array<string>,
doOpenModal: (string, {}) => void,
};
function AbandonedChannelPreview(props: Props) {
const { uri, type } = props;
const { uri, doChannelUnsubscribe, type, blockedChannelUris, doOpenModal } = props;
const { channelName } = parseURI(uri);
const isBlockedChannel = blockedChannelUris.includes(uri);
return (
<li className={classnames('claim-preview__wrapper', 'claim-preview__wrapper--notice')}>
@@ -27,10 +37,31 @@ function AbandonedChannelPreview(props: Props) {
<div className="media__subtitle">{__(`This channel may have been unpublished.`)}</div>
</div>
<div className="claim-preview__actions">
<div className="section__actions">
<ChannelBlockButton uri={uri} />
<ChannelMuteButton uri={uri} />
</div>
{isBlockedChannel && (
<Button
iconColor="red"
icon={ICONS.UNBLOCK}
button={'alt'}
label={__('Unblock')}
onClick={() => doOpenModal(MODALS.REMOVE_BLOCKED, { blockedUri: uri })}
/>
)}
{/* SubscribeButton uses resolved permanentUri; modifying it didn't seem worth it. */}
{!isBlockedChannel && (
<Button
iconColor="red"
icon={ICONS.UNSUBSCRIBE}
button={'alt'}
label={__('Unfollow')}
onClick={e => {
e.stopPropagation();
doChannelUnsubscribe({
channelName: `@${channelName}`,
uri,
});
}}
/>
)}
</div>
</div>
</div>
+7 -24
View File
@@ -5,32 +5,20 @@ 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, selectMyChannelUrls, SETTINGS } from 'lbry-redux';
import { doFetchChannelListMine, SETTINGS } from 'lbry-redux';
import {
makeSelectClientSetting,
selectLanguage,
selectLoadedLanguages,
selectThemePath,
} from 'redux/selectors/settings';
import {
selectIsUpgradeAvailable,
selectAutoUpdateDownloaded,
selectModal,
selectActiveChannelClaim,
} from 'redux/selectors/app';
import { selectIsUpgradeAvailable, selectAutoUpdateDownloaded, selectModal } from 'redux/selectors/app';
import { doGetWalletSyncPreference, doSetLanguage } from 'redux/actions/settings';
import { doSyncLoop } from 'redux/actions/sync';
import {
doDownloadUpgradeRequested,
doSignIn,
doGetAndPopulatePreferences,
doSetActiveChannel,
doSetIncognito,
} from 'redux/actions/app';
import { doFetchModBlockedList } from 'redux/actions/comments';
import { doDownloadUpgradeRequested, doSignIn, doGetAndPopulatePreferences } from 'redux/actions/app';
import App from './view';
const select = (state) => ({
const select = state => ({
user: selectUser(state),
accessToken: selectAccessToken(state),
theme: selectThemePath(state),
@@ -45,23 +33,18 @@ const select = (state) => ({
isAuthenticated: selectUserVerifiedEmail(state),
currentModal: selectModal(state),
syncFatalError: selectSyncFatalError(state),
activeChannelClaim: selectActiveChannelClaim(state),
myChannelUrls: selectMyChannelUrls(state),
});
const perform = (dispatch) => ({
const perform = dispatch => ({
fetchAccessToken: () => dispatch(doFetchAccessToken()),
fetchChannelListMine: () => dispatch(doFetchChannelListMine()),
setLanguage: (language) => dispatch(doSetLanguage(language)),
setLanguage: language => dispatch(doSetLanguage(language)),
signIn: () => dispatch(doSignIn()),
requestDownloadUpgrade: () => dispatch(doDownloadUpgradeRequested()),
updatePreferences: () => dispatch(doGetAndPopulatePreferences()),
getWalletSyncPref: () => dispatch(doGetWalletSyncPreference()),
syncLoop: (noInterval) => dispatch(doSyncLoop(noInterval)),
syncLoop: noInterval => dispatch(doSyncLoop(noInterval)),
setReferrer: (referrer, doClaim) => dispatch(doUserSetReferrer(referrer, doClaim)),
setActiveChannelIfNotSet: () => dispatch(doSetActiveChannel()),
setIncognito: () => dispatch(doSetIncognito()),
fetchModBlockedList: () => dispatch(doFetchModBlockedList()),
});
export default hot(connect(select, perform)(App));
+9 -33
View File
@@ -56,14 +56,14 @@ type Props = {
goForward: () => void,
index: number,
length: number,
push: (string) => void,
push: string => void,
},
fetchAccessToken: () => void,
fetchChannelListMine: () => void,
signIn: () => void,
requestDownloadUpgrade: () => void,
onSignedIn: () => void,
setLanguage: (string) => void,
setLanguage: string => void,
isUpgradeAvailable: boolean,
autoUpdateDownloaded: boolean,
updatePreferences: () => Promise<any>,
@@ -80,11 +80,6 @@ type Props = {
syncEnabled: boolean,
currentModal: any,
syncFatalError: boolean,
activeChannelClaim: ?ChannelClaim,
myChannelUrls: ?Array<string>,
setActiveChannelIfNotSet: () => void,
setIncognito: (boolean) => void,
fetchModBlockedList: () => void,
};
function App(props: Props) {
@@ -111,11 +106,6 @@ function App(props: Props) {
syncLoop,
currentModal,
syncFatalError,
myChannelUrls,
activeChannelClaim,
setActiveChannelIfNotSet,
setIncognito,
fetchModBlockedList,
} = props;
const appRef = useRef();
@@ -136,17 +126,15 @@ function App(props: Props) {
const showUpgradeButton =
(autoUpdateDownloaded || (process.platform === 'linux' && isUpgradeAvailable)) && !upgradeNagClosed;
// referral claiming
const referredRewardAvailable = rewards && rewards.some((reward) => reward.reward_type === REWARDS.TYPE_REFEREE);
const referredRewardAvailable = rewards && rewards.some(reward => reward.reward_type === REWARDS.TYPE_REFEREE);
const urlParams = new URLSearchParams(search);
const rawReferrerParam = urlParams.get('r');
const sanitizedReferrerParam = rawReferrerParam && rawReferrerParam.replace(':', '#');
const shouldHideNag = pathname.startsWith(`/$/${PAGES.EMBED}`) || pathname.startsWith(`/$/${PAGES.AUTH_VERIFY}`);
const userId = user && user.id;
const useCustomScrollbar = !IS_MAC;
const hasMyChannels = myChannelUrls && myChannelUrls.length > 0;
const hasNoChannels = myChannelUrls && myChannelUrls.length === 0;
const shouldMigrateLanguage = LANGUAGE_MIGRATIONS[language];
const hasActiveChannelClaim = activeChannelClaim !== undefined;
let uri;
try {
@@ -168,7 +156,7 @@ function App(props: Props) {
useEffect(() => {
if (!uploadCount) return;
const handleBeforeUnload = (event) => {
const handleBeforeUnload = event => {
event.preventDefault();
event.returnValue = 'magic'; // without setting this to something it doesn't work
};
@@ -178,7 +166,7 @@ function App(props: Props) {
// allows user to navigate history using the forward and backward buttons on a mouse
useEffect(() => {
const handleForwardAndBackButtons = (e) => {
const handleForwardAndBackButtons = e => {
switch (e.button) {
case MOUSE_BACK_BTN:
history.index > 0 && history.goBack();
@@ -194,7 +182,7 @@ function App(props: Props) {
// allows user to pause miniplayer using the spacebar without the page scrolling down
useEffect(() => {
const handleKeyPress = (e) => {
const handleKeyPress = e => {
if (e.key === ' ' && e.target === document.body) {
e.preventDefault();
}
@@ -240,18 +228,6 @@ function App(props: Props) {
document.documentElement.setAttribute('theme', theme);
}, [theme]);
useEffect(() => {
if (hasMyChannels && !hasActiveChannelClaim) {
setActiveChannelIfNotSet();
} else if (hasNoChannels) {
setIncognito(true);
}
if (hasMyChannels) {
fetchModBlockedList();
}
}, [hasMyChannels, hasNoChannels, hasActiveChannelClaim, setActiveChannelIfNotSet, setIncognito]);
useEffect(() => {
if (!languages.includes(language)) {
setLanguage(language);
@@ -352,7 +328,7 @@ function App(props: Props) {
// @endif
if (syncFatalError) {
return <SyncFatalError lbryTvApiStatus={lbryTvApiStatus} />;
return <SyncFatalError />;
}
return (
@@ -364,7 +340,7 @@ function App(props: Props) {
[`${MAIN_WRAPPER_CLASS}--scrollbar`]: useCustomScrollbar,
})}
ref={appRef}
onContextMenu={IS_WEB ? undefined : (e) => openContextMenu(e)}
onContextMenu={IS_WEB ? undefined : e => openContextMenu(e)}
>
{IS_WEB && lbryTvApiStatus === STATUS_DOWN ? (
<Yrbl
+18
View File
@@ -0,0 +1,18 @@
import { connect } from 'react-redux';
import { makeSelectClaimIsMine, makeSelectShortUrlForUri, makeSelectPermanentUrlForUri } from 'lbry-redux';
import { selectChannelIsBlocked } from 'redux/selectors/blocked';
import { doToast } from 'redux/actions/notifications';
import { doToggleBlockChannel } from 'redux/actions/blocked';
import BlockButton from './view';
const select = (state, props) => ({
channelIsBlocked: selectChannelIsBlocked(props.uri)(state),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
shortUrl: makeSelectShortUrlForUri(props.uri)(state),
permanentUrl: makeSelectPermanentUrlForUri(props.uri)(state),
});
export default connect(select, {
toggleBlockChannel: doToggleBlockChannel,
doToast,
})(BlockButton);
+49
View File
@@ -0,0 +1,49 @@
// @flow
import * as ICONS from 'constants/icons';
import * as PAGES from 'constants/pages';
import React, { useRef } from 'react';
import Button from 'component/button';
import useHover from 'effects/use-hover';
type Props = {
permanentUrl: ?string,
shortUrl: string,
isSubscribed: boolean,
toggleBlockChannel: (uri: string) => void,
channelIsBlocked: boolean,
claimIsMine: boolean,
doToast: ({ message: string, linkText: string, linkTarget: string }) => void,
};
export default function BlockButton(props: Props) {
const { permanentUrl, shortUrl, toggleBlockChannel, channelIsBlocked, claimIsMine, doToast } = props;
const blockRef = useRef();
const isHovering = useHover(blockRef);
const blockLabel = channelIsBlocked ? __('Blocked') : __('Block');
const blockTitlePrefix = channelIsBlocked ? __('Unblock this channel') : __('Block this channel');
const blockedOverride = channelIsBlocked && isHovering && __('Unblock');
return permanentUrl && (!claimIsMine || channelIsBlocked) ? (
<Button
ref={blockRef}
icon={ICONS.BLOCK}
button={'alt'}
label={blockedOverride || blockLabel}
title={blockTitlePrefix}
requiresAuth={IS_WEB}
onClick={e => {
e.stopPropagation();
if (!channelIsBlocked) {
doToast({
message: __('Blocked %channelUrl%', { channelUrl: shortUrl }),
linkText: __('Manage'),
linkTarget: `/${PAGES.BLOCKED}`,
});
}
toggleBlockChannel(permanentUrl);
}}
/>
) : null;
}
+1 -2
View File
@@ -1,10 +1,9 @@
import { connect } from 'react-redux';
import { makeSelectMetadataItemForUri, makeSelectClaimForUri, makeSelectStakedLevelForChannelUri } from 'lbry-redux';
import { makeSelectMetadataItemForUri, makeSelectClaimForUri } from 'lbry-redux';
import ChannelAbout from './view';
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
stakedLevel: makeSelectStakedLevelForChannelUri(props.uri)(state),
description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
website: makeSelectMetadataItemForUri(props.uri, 'website_url')(state),
email: makeSelectMetadataItemForUri(props.uri, 'email')(state),
+4 -5
View File
@@ -17,7 +17,6 @@ type Props = {
email: ?string,
website: ?string,
languages: Array<string>,
stakedLevel?: number,
};
const formatEmail = (email: string) => {
@@ -30,7 +29,7 @@ const formatEmail = (email: string) => {
};
function ChannelAbout(props: Props) {
const { claim, uri, description, email, website, languages, stakedLevel } = props;
const { claim, uri, description, email, website, languages } = props;
const claimId = claim && claim.claim_id;
return (
@@ -41,7 +40,7 @@ function ChannelAbout(props: Props) {
<>
<label>{__('Description')}</label>
<div className="media__info-text media__info-text--constrained">
<MarkdownPreview content={description} stakedLevel={stakedLevel} />
<MarkdownPreview content={description} />
</div>
</>
)}
@@ -49,7 +48,7 @@ function ChannelAbout(props: Props) {
<Fragment>
<label>{__('Contact')}</label>
<div className="media__info-text">
<MarkdownPreview content={formatEmail(email)} simpleLinks />
<MarkdownPreview content={formatEmail(email)} />
</div>
</Fragment>
)}
@@ -57,7 +56,7 @@ function ChannelAbout(props: Props) {
<Fragment>
<label>{__('Site')}</label>
<div className="media__info-text">
<MarkdownPreview content={website} simpleLinks />
<MarkdownPreview content={website} />
</div>
</Fragment>
)}
-14
View File
@@ -1,14 +0,0 @@
import { connect } from 'react-redux';
import { doCommentModUnBlock, doCommentModBlock } from 'redux/actions/comments';
import { makeSelectChannelIsBlocked, makeSelectUriIsBlockingOrUnBlocking } from 'redux/selectors/comments';
import ChannelBlockButton from './view';
const select = (state, props) => ({
isBlocked: makeSelectChannelIsBlocked(props.uri)(state),
isBlockingOrUnBlocking: makeSelectUriIsBlockingOrUnBlocking(props.uri)(state),
});
export default connect(select, {
doCommentModUnBlock,
doCommentModBlock,
})(ChannelBlockButton);
-41
View File
@@ -1,41 +0,0 @@
// @flow
import React from 'react';
import Button from 'component/button';
type Props = {
uri: string,
isBlocked: boolean,
isBlockingOrUnBlocking: boolean,
doCommentModUnBlock: (string) => void,
doCommentModBlock: (string) => void,
};
function ChannelBlockButton(props: Props) {
const { uri, doCommentModUnBlock, doCommentModBlock, isBlocked, isBlockingOrUnBlocking } = props;
function handleClick() {
if (isBlocked) {
doCommentModUnBlock(uri);
} else {
doCommentModBlock(uri);
}
}
return (
<Button
button={isBlocked ? 'alt' : 'secondary'}
label={
isBlocked
? isBlockingOrUnBlocking
? __('Unblocking...')
: __('Unblock')
: isBlockingOrUnBlocking
? __('Blocking...')
: __('Block')
}
onClick={handleClick}
/>
);
}
export default ChannelBlockButton;
+3 -8
View File
@@ -6,10 +6,9 @@ import {
makeSelectClaimIsMine,
makeSelectTotalPagesInChannelSearch,
makeSelectClaimForUri,
doResolveUris,
SETTINGS,
} from 'lbry-redux';
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
import { selectChannelIsBlocked } from 'redux/selectors/blocked';
import { withRouter } from 'react-router';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
import { makeSelectClientSetting } from 'redux/selectors/settings';
@@ -25,7 +24,7 @@ const select = (state, props) => {
fetching: makeSelectFetchingChannelClaims(props.uri)(state),
totalPages: makeSelectTotalPagesInChannelSearch(props.uri, PAGE_SIZE)(state),
channelIsMine: makeSelectClaimIsMine(props.uri)(state),
channelIsBlocked: makeSelectChannelIsMuted(props.uri)(state),
channelIsBlocked: selectChannelIsBlocked(props.uri)(state),
claim: props.uri && makeSelectClaimForUri(props.uri)(state),
isAuthenticated: selectUserVerifiedEmail(state),
showMature: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state),
@@ -33,8 +32,4 @@ const select = (state, props) => {
};
};
const perform = (dispatch) => ({
doResolveUris: (uris, returnCachedUris) => dispatch(doResolveUris(uris, returnCachedUris)),
});
export default withRouter(connect(select, perform)(ChannelPage));
export default withRouter(connect(select)(ChannelPage));
+3 -11
View File
@@ -29,8 +29,6 @@ type Props = {
isAuthenticated: boolean,
showMature: boolean,
tileLayout: boolean,
viewHiddenChannels: boolean,
doResolveUris: (Array<string>, boolean) => void,
};
function ChannelContent(props: Props) {
@@ -46,8 +44,6 @@ function ChannelContent(props: Props) {
defaultInfiniteScroll = true,
showMature,
tileLayout,
viewHiddenChannels,
doResolveUris,
} = props;
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
const [searchQuery, setSearchQuery] = React.useState('');
@@ -75,16 +71,11 @@ function ChannelContent(props: Props) {
!showMature ? '&nsfw=false&size=25&from=0' : ''
}`
)
.then((results) => {
.then(results => {
const urls = results.map(({ name, claimId }) => {
return `lbry://${name}#${claimId}`;
});
// Batch-resolve the urls before calling 'setSearchResults', as the
// latter will immediately cause the tiles to resolve, ending up
// calling doResolveUri one by one before the batched one.
doResolveUris(urls, true);
setSearchResults(urls);
})
.catch(() => {
@@ -129,14 +120,15 @@ function ChannelContent(props: Props) {
{claim && claimsInChannel > 0 ? (
<ClaimListDiscover
showHiddenByUser={viewHiddenChannels}
forceShowReposts
tileLayout={tileLayout}
uris={searchResults}
channelIds={[claim.claim_id]}
claimType={CS.CLAIM_TYPES}
feeAmount={CS.FEE_AMOUNT_ANY}
defaultOrderBy={CS.ORDER_BY_NEW}
pageSize={defaultPageSize}
streamType={CS.CONTENT_ALL}
infiniteScroll={defaultInfiniteScroll}
injectedItem={SHOW_ADS && !isAuthenticated && IS_WEB && <Ads type="video" />}
meta={
+15
View File
@@ -0,0 +1,15 @@
import { connect } from 'react-redux';
import ChannelCreate from './view';
import { selectBalance, doCreateChannel, selectCreatingChannel, selectCreateChannelError } from 'lbry-redux';
const select = state => ({
balance: selectBalance(state),
creatingChannel: selectCreatingChannel(state),
createChannelError: selectCreateChannelError(state),
});
const perform = dispatch => ({
createChannel: (name, amount) => dispatch(doCreateChannel(name, amount)),
});
export default connect(select, perform)(ChannelCreate);
+143
View File
@@ -0,0 +1,143 @@
// @flow
import React from 'react';
import { isNameValid } from 'lbry-redux';
import { Form, FormField } from 'component/common/form';
import Button from 'component/button';
import analytics from 'analytics';
import LbcSymbol from 'component/common/lbc-symbol';
import { MINIMUM_PUBLISH_BID, INVALID_NAME_ERROR } from 'constants/claim';
type Props = {
balance: number,
createChannel: (string, number) => Promise<any>,
onSuccess?: ({}) => void,
creatingChannel: boolean,
createChannelError: ?string,
};
type State = {
newChannelName: string,
newChannelBid: number,
newChannelNameError: string,
newChannelBidError: string,
};
class ChannelCreate extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
newChannelName: '',
newChannelBid: 0.001,
newChannelNameError: '',
newChannelBidError: '',
};
(this: any).handleNewChannelNameChange = this.handleNewChannelNameChange.bind(this);
(this: any).handleNewChannelBidChange = this.handleNewChannelBidChange.bind(this);
(this: any).handleCreateChannel = this.handleCreateChannel.bind(this);
}
handleNewChannelNameChange(event: SyntheticInputEvent<*>) {
let newChannelName = event.target.value;
if (newChannelName.startsWith('@')) {
newChannelName = newChannelName.slice(1);
}
let newChannelNameError;
if (newChannelName.length > 0 && !isNameValid(newChannelName, false)) {
newChannelNameError = INVALID_NAME_ERROR;
}
this.setState({
newChannelNameError,
newChannelName,
});
}
handleNewChannelBidChange(newChannelBid: number) {
const { balance } = this.props;
let newChannelBidError;
if (newChannelBid === 0) {
newChannelBidError = __('Your deposit cannot be 0');
} else if (newChannelBid === balance) {
newChannelBidError = __('Please decrease your deposit to account for transaction fees');
} else if (newChannelBid > balance) {
newChannelBidError = __('Deposit cannot be higher than your available balance');
} else if (newChannelBid < MINIMUM_PUBLISH_BID) {
newChannelBidError = __('Your deposit must be higher');
}
this.setState({
newChannelBid,
newChannelBidError,
});
}
handleCreateChannel() {
const { createChannel, onSuccess } = this.props;
const { newChannelBid, newChannelName } = this.state;
const channelName = `@${newChannelName.trim()}`;
const success = channelClaim => {
analytics.apiLogPublish(channelClaim);
if (onSuccess !== undefined) {
onSuccess({ ...this.props, ...this.state });
}
};
createChannel(channelName, newChannelBid).then(success);
}
render() {
const { newChannelName, newChannelNameError, newChannelBid, newChannelBidError } = this.state;
const { creatingChannel, createChannelError } = this.props;
return (
<Form onSubmit={this.handleCreateChannel}>
{createChannelError && <div className="error__text">{createChannelError}</div>}
<div>
<FormField
label={__('Name')}
name="channel-input"
type="text"
placeholder={__('ChannelName')}
error={newChannelNameError}
value={newChannelName}
onChange={this.handleNewChannelNameChange}
/>
<FormField
className="form-field--price-amount"
name="channel-deposit"
label={<LbcSymbol postfix={__('Deposit')} size={14} />}
step="any"
min="0"
type="number"
helper={__(
'These LBRY Credits remain yours. It is a deposit to reserve the name and can be undone at any time.'
)}
error={newChannelBidError}
value={newChannelBid}
onChange={event => this.handleNewChannelBidChange(parseFloat(event.target.value))}
onWheel={e => e.stopPropagation()}
/>
<div className="section__actions">
<Button
type="submit"
button="primary"
label={!creatingChannel ? __('Create channel') : __('Creating channel...')}
disabled={
!newChannelName || !newChannelBid || creatingChannel || newChannelNameError || newChannelBidError
}
/>
</div>
</div>
</Form>
);
}
}
export default ChannelCreate;
+1 -3
View File
@@ -1,9 +1,8 @@
import { connect } from 'react-redux';
import { withRouter } from 'react-router';
import { makeSelectCommentForCommentId } from 'redux/selectors/comments';
import { DISABLE_COMMENTS_TAG } from 'constants/tags';
import ChannelDiscussion from './view';
import { makeSelectTagInClaimOrChannelForUri } from 'lbry-redux';
const select = (state, props) => {
const { search } = props.location;
@@ -12,7 +11,6 @@ const select = (state, props) => {
return {
linkedComment: makeSelectCommentForCommentId(linkedCommentId)(state),
commentsDisabled: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_COMMENTS_TAG)(state),
};
};
+1 -6
View File
@@ -1,20 +1,15 @@
// @flow
import React from 'react';
import CommentsList from 'component/commentsList';
import Empty from 'component/common/empty';
type Props = {
uri: string,
linkedComment: ?any,
commentsDisabled: boolean,
};
function ChannelDiscussion(props: Props) {
const { uri, linkedComment, commentsDisabled } = props;
const { uri, linkedComment } = props;
if (commentsDisabled) {
return <Empty text={__('This channel has disabled comments on their page.')} />;
}
return (
<section className="section">
<CommentsList uri={uri} linkedComment={linkedComment} />
+5 -9
View File
@@ -16,7 +16,7 @@ import {
doClearChannelErrors,
} from 'lbry-redux';
import { doOpenModal } from 'redux/actions/app';
import { doUpdateBlockListForPublishedChannel } from 'redux/actions/comments';
import ChannelPage from './view';
const select = (state, props) => ({
@@ -38,16 +38,12 @@ const select = (state, props) => ({
balance: selectBalance(state),
});
const perform = (dispatch) => ({
const perform = dispatch => ({
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
updateChannel: (params) => dispatch(doUpdateChannel(params)),
createChannel: (params) => {
updateChannel: params => dispatch(doUpdateChannel(params)),
createChannel: params => {
const { name, amount, ...optionalParams } = params;
return dispatch(
doCreateChannel('@' + name, amount, optionalParams, (channelClaim) => {
dispatch(doUpdateBlockListForPublishedChannel(channelClaim));
})
);
return dispatch(doCreateChannel('@' + name, amount, optionalParams));
},
clearChannelErrors: () => dispatch(doClearChannelErrors()),
});
+28 -41
View File
@@ -19,8 +19,6 @@ import * as PAGES from 'constants/pages';
import analytics from 'analytics';
import LbcSymbol from 'component/common/lbc-symbol';
import SUPPORTED_LANGUAGES from 'constants/supported_languages';
import WalletSpendableBalanceHelp from 'component/walletSpendableBalanceHelp';
const LANG_NONE = 'none';
const MAX_TAG_SELECT = 5;
@@ -39,17 +37,17 @@ type Props = {
tags: Array<string>,
locations: Array<string>,
languages: Array<string>,
updateChannel: (any) => Promise<any>,
updateChannel: any => Promise<any>,
updatingChannel: boolean,
updateError: string,
createChannel: (any) => Promise<any>,
createChannel: any => Promise<any>,
createError: string,
creatingChannel: boolean,
clearChannelErrors: () => void,
onDone: () => void,
openModal: (
id: string,
{ onUpdate: (string) => void, assetName: string, helpText: string, currentValue: string, title: string }
{ onUpdate: string => void, assetName: string, helpText: string, currentValue: string, title: string }
) => void,
uri: string,
disabled: boolean,
@@ -118,7 +116,7 @@ function ChannelForm(props: Props) {
languages: languages || [],
locations: locations || [],
tags: tags
? tags.map((tag) => {
? tags.map(tag => {
return { name: tag };
})
: [],
@@ -181,13 +179,13 @@ function ChannelForm(props: Props) {
function handleSubmit() {
if (uri) {
updateChannel(params).then((success) => {
updateChannel(params).then(success => {
if (success) {
onDone();
}
});
} else {
createChannel(params).then((success) => {
createChannel(params).then(success => {
if (success) {
analytics.apiLogPublish(success);
onDone();
@@ -196,12 +194,6 @@ function ChannelForm(props: Props) {
}
}
const LIMIT_ERR_PARTIAL_MSG = 'bad-txns-claimscriptsize-toolarge (code 16)';
let errorMsg = updateError || createError;
if (errorMsg && errorMsg.includes(LIMIT_ERR_PARTIAL_MSG)) {
errorMsg = __('Transaction limit reached. Try reducing the Description length.');
}
React.useEffect(() => {
let nameError;
if (!name && name !== undefined) {
@@ -228,7 +220,7 @@ function ChannelForm(props: Props) {
title={__('Cover')}
onClick={() =>
openModal(MODALS.IMAGE_UPLOAD, {
onUpdate: (coverUrl) => handleCoverChange(coverUrl),
onUpdate: coverUrl => handleCoverChange(coverUrl),
title: __('Edit Cover Image'),
helpText: __('(6.25:1)'),
assetName: __('Cover Image'),
@@ -252,7 +244,7 @@ function ChannelForm(props: Props) {
title={__('Edit')}
onClick={() =>
openModal(MODALS.IMAGE_UPLOAD, {
onUpdate: (v) => handleThumbnailChange(v),
onUpdate: v => handleThumbnailChange(v),
title: __('Edit Thumbnail Image'),
helpText: __('(1:1)'),
assetName: __('Thumbnail'),
@@ -303,7 +295,7 @@ function ChannelForm(props: Props) {
value={params.name || channelName}
error={nameError}
disabled={!isNewChannel}
onChange={(e) => setParams({ ...params, name: e.target.value })}
onChange={e => setParams({ ...params, name: e.target.value })}
/>
</fieldset-group>
{!isNewChannel && <span className="form-field__help">{__('This field cannot be changed.')}</span>}
@@ -314,7 +306,7 @@ function ChannelForm(props: Props) {
label={__('Title')}
placeholder={__('My Awesome Channel')}
value={params.title}
onChange={(e) => setParams({ ...params, title: e.target.value })}
onChange={e => setParams({ ...params, title: e.target.value })}
/>
<FormField
type="markdown"
@@ -322,7 +314,7 @@ function ChannelForm(props: Props) {
label={__('Description')}
placeholder={__('Description of your content')}
value={params.description}
onChange={(text) => setParams({ ...params, description: text })}
onChange={text => setParams({ ...params, description: text })}
textAreaMaxLength={FF_MAX_CHARS_IN_DESCRIPTION}
/>
</>
@@ -342,14 +334,9 @@ function ChannelForm(props: Props) {
error={bidError}
min="0.0"
disabled={false}
onChange={(event) => handleBidChange(parseFloat(event.target.value))}
onChange={event => handleBidChange(parseFloat(event.target.value))}
placeholder={0.1}
helper={
<>
{__('Increasing your deposit can help your channel be discovered more easily.')}
<WalletSpendableBalanceHelp inline />
</>
}
helper={__('Increasing your deposit can help your channel be discovered more easily.')}
/>
}
/>
@@ -363,17 +350,17 @@ function ChannelForm(props: Props) {
limitSelect={MAX_TAG_SELECT}
tagsPassedIn={params.tags || []}
label={__('Selected Tags')}
onRemove={(clickedTag) => {
const newTags = params.tags.slice().filter((tag) => tag.name !== clickedTag.name);
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)) {
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) });
setParams({ ...params, tags: params.tags.filter(tag => tag.name !== newTag.name) });
}
});
}}
@@ -392,7 +379,7 @@ function ChannelForm(props: Props) {
placeholder={__('aprettygoodsite.com')}
disabled={false}
value={params.website}
onChange={(e) => setParams({ ...params, website: e.target.value })}
onChange={e => setParams({ ...params, website: e.target.value })}
/>
<FormField
type="text"
@@ -401,20 +388,20 @@ function ChannelForm(props: Props) {
placeholder={__('yourstruly@example.com')}
disabled={false}
value={params.email}
onChange={(e) => setParams({ ...params, email: e.target.value })}
onChange={e => setParams({ ...params, email: e.target.value })}
/>
<FormField
name="language_select"
type="select"
label={__('Primary Language')}
onChange={(event) => handleLanguageChange(0, event.target.value)}
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) => (
{Object.keys(SUPPORTED_LANGUAGES).map(language => (
<option key={language} value={language}>
{SUPPORTED_LANGUAGES[language]}
</option>
@@ -424,7 +411,7 @@ function ChannelForm(props: Props) {
name="language_select2"
type="select"
label={__('Secondary Language')}
onChange={(event) => handleLanguageChange(1, event.target.value)}
onChange={event => handleLanguageChange(1, event.target.value)}
value={secondaryLanguage}
disabled={!languageParam[0]}
helper={__('Your other content language')}
@@ -433,8 +420,8 @@ function ChannelForm(props: Props) {
{__('None selected')}
</option>
{Object.keys(SUPPORTED_LANGUAGES)
.filter((lang) => lang !== languageParam[0])
.map((language) => (
.filter(lang => lang !== languageParam[0])
.map(language => (
<option key={language} value={language}>
{SUPPORTED_LANGUAGES[language]}
</option>
@@ -462,8 +449,8 @@ function ChannelForm(props: Props) {
/>
<Button button="link" label={__('Cancel')} onClick={onDone} />
</div>
{errorMsg ? (
<ErrorText>{errorMsg}</ErrorText>
{updateError || createError ? (
<ErrorText>{updateError || createError}</ErrorText>
) : (
<p className="help">
{__('After submitting, it will take a few minutes for your changes to be live for everyone.')}
+40
View File
@@ -0,0 +1,40 @@
import { connect } from 'react-redux';
import {
doResolveUri,
selectPublishFormValues,
selectIsStillEditing,
selectMyClaimForUri,
selectIsResolvingPublishUris,
selectTakeOverAmount,
doResetThumbnailStatus,
doClearPublish,
doUpdatePublishForm,
doPrepareEdit,
} from 'lbry-redux';
import { doPublishDesktop } from 'redux/actions/publish';
import { selectUnclaimedRewardValue } from 'redux/selectors/rewards';
import ChannelForm from './view';
const select = state => ({
...selectPublishFormValues(state),
// The winning claim for a short lbry uri
amountNeededForTakeover: selectTakeOverAmount(state),
// My previously published claims under this short lbry uri
myClaimForUri: selectMyClaimForUri(state),
// If I clicked the "edit" button, have I changed the uri?
// Need this to make it easier to find the source on previously published content
isStillEditing: selectIsStillEditing(state),
isResolvingUri: selectIsResolvingPublishUris(state),
totalRewardValue: selectUnclaimedRewardValue(state),
});
const perform = dispatch => ({
updatePublishForm: value => dispatch(doUpdatePublishForm(value)),
clearPublish: () => dispatch(doClearPublish()),
resolveUri: uri => dispatch(doResolveUri(uri)),
publish: filePath => dispatch(doPublishDesktop(filePath)),
prepareEdit: (claim, uri) => dispatch(doPrepareEdit(claim, uri)),
resetThumbnailStatus: () => dispatch(doResetThumbnailStatus()),
});
export default connect(select, perform)(ChannelForm);
+63
View File
@@ -0,0 +1,63 @@
// @flow
import React, { useEffect, Fragment } from 'react';
import { CHANNEL_NEW } from 'constants/claim';
import { buildURI, isURIValid } from 'lbry-redux';
import ChannelCreate from 'component/channelCreate';
import Card from 'component/common/card';
import * as ICONS from 'constants/icons';
type Props = {
name: ?string,
channel: string,
resolveUri: string => void,
updatePublishForm: any => void,
onSuccess: () => void,
};
function ChannelForm(props: Props) {
const { name, channel, resolveUri, updatePublishForm, onSuccess } = props;
// Every time the channel or name changes, resolve the uris to find winning bid amounts
useEffect(() => {
// If they are midway through a channel creation, treat it as anonymous until it completes
const channelName = channel === CHANNEL_NEW ? '' : channel;
// We are only going to store the full uri, but we need to resolve the uri with and without the channel name
let uri;
try {
uri = name && buildURI({ streamName: name, channelName });
} catch (e) {}
if (channelName && name) {
// resolve without the channel name so we know the winning bid for it
try {
const uriLessChannel = buildURI({ streamName: name });
resolveUri(uriLessChannel);
} catch (e) {}
}
const isValid = isURIValid(uri);
if (uri && isValid) {
resolveUri(uri);
updatePublishForm({ uri });
}
}, [name, channel, resolveUri, updatePublishForm]);
return (
<Fragment>
<Card
icon={ICONS.CHANNEL}
title="Create a New Channel"
subtitle="This is a username or handle that your content can be found under."
actions={
<React.Fragment>
<ChannelCreate onSuccess={onSuccess} onChannelChange={channel => updatePublishForm({ channel })} />
</React.Fragment>
}
/>
</Fragment>
);
}
export default ChannelForm;
-12
View File
@@ -1,12 +0,0 @@
import { connect } from 'react-redux';
import { doToggleMuteChannel } from 'redux/actions/blocked';
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
import ChannelMuteButton from './view';
const select = (state, props) => ({
isMuted: makeSelectChannelIsMuted(props.uri)(state),
});
export default connect(select, {
doToggleMuteChannel,
})(ChannelMuteButton);
-24
View File
@@ -1,24 +0,0 @@
// @flow
import React from 'react';
import Button from 'component/button';
type Props = {
uri: string,
isMuted: boolean,
channelClaim: ?ChannelClaim,
doToggleMuteChannel: (string) => void,
};
function ChannelBlockButton(props: Props) {
const { uri, doToggleMuteChannel, isMuted } = props;
return (
<Button
button={isMuted ? 'alt' : 'secondary'}
label={isMuted ? __('Unmute') : __('Mute')}
onClick={() => doToggleMuteChannel(uri)}
/>
);
}
export default ChannelBlockButton;
+2 -9
View File
@@ -1,16 +1,9 @@
import { connect } from 'react-redux';
import { selectMyChannelClaims } from 'lbry-redux';
import { selectActiveChannelClaim, selectIncognito } from 'redux/selectors/app';
import { doSetActiveChannel, doSetIncognito } from 'redux/actions/app';
import SelectChannel from './view';
import { selectMyChannelClaims } from 'lbry-redux';
const select = state => ({
channels: selectMyChannelClaims(state),
activeChannelClaim: selectActiveChannelClaim(state),
incognito: selectIncognito(state),
});
export default connect(select, {
doSetActiveChannel,
doSetIncognito,
})(SelectChannel);
export default connect(select)(SelectChannel);
+23 -60
View File
@@ -1,23 +1,16 @@
// @flow
import * as ICONS from 'constants/icons';
import * as PAGES from 'constants/pages';
import classnames from 'classnames';
import React from 'react';
import ChannelThumbnail from 'component/channelThumbnail';
import { Menu, MenuList, MenuButton, MenuItem } from '@reach/menu-button';
import ChannelTitle from 'component/channelTitle';
import Icon from 'component/common/icon';
import { useHistory } from 'react-router';
type Props = {
selectedChannelUrl: string, // currently selected channel
channels: ?Array<ChannelClaim>,
onChannelSelect: (url: string) => void,
hideAnon?: boolean,
activeChannelClaim: ?ChannelClaim,
doSetActiveChannel: (string) => void,
incognito: boolean,
doSetIncognito: (boolean) => void,
};
type ListItemProps = {
@@ -30,71 +23,41 @@ function ChannelListItem(props: ListItemProps) {
return (
<div className={classnames('channel__list-item', { 'channel__list-item--selected': isSelected })}>
<ChannelThumbnail uri={uri} hideStakedIndicator />
<ChannelThumbnail uri={uri} />
<ChannelTitle uri={uri} />
{isSelected && <Icon icon={ICONS.DOWN} />}
</div>
);
}
type IncognitoSelectorProps = {
isSelected?: boolean,
};
function IncognitoSelector(props: IncognitoSelectorProps) {
return (
<div className={classnames('channel__list-item', { 'channel__list-item--selected': props.isSelected })}>
<Icon sectionIcon icon={ICONS.ANONYMOUS} />
<h2 className="channel__list-text">{__('Anonymous')}</h2>
{props.isSelected && <Icon icon={ICONS.DOWN} />}
</div>
);
}
function ChannelSelector(props: Props) {
const { channels, activeChannelClaim, doSetActiveChannel, hideAnon = false, incognito, doSetIncognito } = props;
const {
push,
location: { pathname },
} = useHistory();
const activeChannelUrl = activeChannelClaim && activeChannelClaim.permanent_url;
const { channels, selectedChannelUrl, onChannelSelect } = props;
function handleChannelSelect(channelClaim) {
doSetIncognito(false);
doSetActiveChannel(channelClaim.claim_id);
if (!channels || !selectedChannelUrl) {
return null;
}
return (
<div className="channel__selector">
<Menu>
<MenuButton>
{(incognito && !hideAnon) || !activeChannelUrl ? (
<IncognitoSelector isSelected />
) : (
<ChannelListItem uri={activeChannelUrl} isSelected />
)}
</MenuButton>
<MenuList className="menu__list channel__list">
{channels &&
channels.map((channel) => (
<MenuItem key={channel.permanent_url} onSelect={() => handleChannelSelect(channel)}>
<ChannelListItem uri={channel.permanent_url} />
</MenuItem>
))}
{!hideAnon && (
<MenuItem onSelect={() => doSetIncognito(true)}>
<IncognitoSelector />
<Menu>
<MenuButton className="">
<ChannelListItem uri={selectedChannelUrl} isSelected />
</MenuButton>
<MenuList className="menu__list channel__list">
{channels &&
channels.map(channel => (
<MenuItem
key={channel.canonical_url}
onSelect={() => {
if (selectedChannelUrl !== channel.canonical_url) {
onChannelSelect(channel.canonical_url);
}
}}
>
<ChannelListItem uri={channel.canonical_url} />
</MenuItem>
)}
<MenuItem onSelect={() => push(`/$/${PAGES.CHANNEL_NEW}?redirect=${pathname}`)}>
<div className="channel__list-item">
<Icon sectionIcon icon={ICONS.CHANNEL} />
<h2 className="channel__list-text">{__('Create a new channel')}</h2>
</div>
</MenuItem>
</MenuList>
</Menu>
</div>
))}
</MenuList>
</Menu>
);
}
@@ -1,15 +0,0 @@
import { connect } from 'react-redux';
import {
makeSelectClaimForUri,
makeSelectStakedLevelForChannelUri,
makeSelectTotalStakedAmountForChannelUri,
} from 'lbry-redux';
import ChannelStakedIndicator from './view';
const select = (state, props) => ({
channelClaim: makeSelectClaimForUri(props.uri)(state),
amount: makeSelectTotalStakedAmountForChannelUri(props.uri)(state),
level: makeSelectStakedLevelForChannelUri(props.uri)(state),
});
export default connect(select)(ChannelStakedIndicator);
@@ -1,94 +0,0 @@
// @flow
import { SIMPLE_SITE } from 'config';
import * as ICONS from 'constants/icons';
import React from 'react';
import classnames from 'classnames';
import Icon from 'component/common/icon';
import LbcSymbol from 'component/common/lbc-symbol';
import Tooltip from 'component/common/tooltip';
import CreditAmount from 'component/common/credit-amount';
type Props = {
channelClaim: ChannelClaim,
amount: number,
level: number,
large?: boolean,
inline?: boolean,
};
function getChannelIcon(level: number): string {
const icons = {
'1': ICONS.CHANNEL_LEVEL_1,
'2': ICONS.CHANNEL_LEVEL_2,
'3': ICONS.CHANNEL_LEVEL_3,
'4': ICONS.CHANNEL_LEVEL_4,
'5': ICONS.CHANNEL_LEVEL_5,
};
return icons[level] || ICONS.CHANNEL_LEVEL_1;
}
function ChannelStakedIndicator(props: Props) {
const { channelClaim, amount, level, large = false, inline = false } = props;
if (!channelClaim || !channelClaim.meta) {
return null;
}
const isControlling = channelClaim && channelClaim.meta.is_controlling;
const icon = getChannelIcon(level);
return (
SIMPLE_SITE && (
<Tooltip
label={
<div className="channel-staked__tooltip">
<div className="channel-staked__tooltip-icons">
<LevelIcon icon={icon} isControlling={isControlling} size={isControlling ? 14 : 10} />
</div>
<div className="channel-staked__tooltip-text">
<span>{__('Level %current_level%', { current_level: level })}</span>
<div className="channel-staked__amount">
<LbcSymbol postfix={<CreditAmount amount={amount} showLBC={false} />} size={14} />
</div>
</div>
</div>
}
>
<div
className={classnames('channel-staked__wrapper', {
'channel-staked__wrapper--large': large,
'channel-staked__wrapper--inline': inline,
})}
>
<LevelIcon icon={icon} large={large} isControlling={isControlling} />
</div>
</Tooltip>
)
);
}
type LevelIconProps = {
isControlling: boolean,
icon: string,
large?: boolean,
};
function LevelIcon(props: LevelIconProps) {
const { large, isControlling, icon } = props;
return (
icon && (
<Icon
icon={icon}
size={large ? 36 : 14}
className={classnames('channel-staked__indicator', {
'channel-staked__indicator--large': large,
'channel-staked__indicator--controlling': isControlling,
})}
/>
)
);
}
export default ChannelStakedIndicator;
+2 -10
View File
@@ -4,7 +4,6 @@ import { parseURI } from 'lbry-redux';
import classnames from 'classnames';
import Gerbil from './gerbil.png';
import FreezeframeWrapper from 'component/fileThumbnail/FreezeframeWrapper';
import ChannelStakedIndicator from 'component/channelStakedIndicator';
type Props = {
thumbnail: ?string,
@@ -15,10 +14,9 @@ type Props = {
small?: boolean,
allowGifs?: boolean,
claim: ?ChannelClaim,
doResolveUri: (string) => void,
doResolveUri: string => void,
isResolving: boolean,
showDelayedMessage?: boolean,
hideStakedIndicator?: boolean,
};
function ChannelThumbnail(props: Props) {
@@ -34,7 +32,6 @@ function ChannelThumbnail(props: Props) {
doResolveUri,
isResolving,
showDelayedMessage = false,
hideStakedIndicator = false,
} = props;
const [thumbError, setThumbError] = React.useState(false);
const shouldResolve = claim === undefined;
@@ -60,11 +57,7 @@ function ChannelThumbnail(props: Props) {
}, [doResolveUri, shouldResolve, uri]);
if (channelThumbnail && channelThumbnail.endsWith('gif') && !allowGifs) {
return (
<FreezeframeWrapper src={channelThumbnail} className={classnames('channel-thumbnail', className)}>
{!hideStakedIndicator && <ChannelStakedIndicator uri={uri} claim={claim} />}
</FreezeframeWrapper>
);
return <FreezeframeWrapper src={channelThumbnail} className={classnames('channel-thumbnail', className)} />;
}
return (
@@ -97,7 +90,6 @@ function ChannelThumbnail(props: Props) {
)}
</>
)}
{!hideStakedIndicator && <ChannelStakedIndicator uri={uri} claim={claim} />}
</div>
);
}
+6 -7
View File
@@ -1,12 +1,11 @@
import { connect } from 'react-redux';
import ClaimList from './view';
import { SETTINGS } from 'lbry-redux';
import { makeSelectClientSetting } from 'redux/selectors/settings';
const select = (state) => ({
searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state),
});
const select = state => ({});
const perform = (dispatch) => ({});
const perform = dispatch => ({});
export default connect(select, perform)(ClaimList);
export default connect(
select,
perform
)(ClaimList);
+13 -16
View File
@@ -22,7 +22,7 @@ type Props = {
type: string,
empty?: string,
defaultSort?: boolean,
onScrollBottom?: (any) => void,
onScrollBottom?: any => void,
page?: number,
pageSize?: number,
id?: string,
@@ -32,12 +32,11 @@ type Props = {
showUnresolvedClaims?: boolean,
renderProperties: ?(Claim) => Node,
includeSupportAction?: boolean,
hideBlock: boolean,
injectedItem: ?Node,
timedOutMessage?: Node,
tileLayout?: boolean,
renderActions?: (Claim) => ?Node,
searchInLanguage: boolean,
hideMenu?: boolean,
renderActions?: Claim => ?Node,
};
export default function ClaimList(props: Props) {
@@ -57,28 +56,24 @@ export default function ClaimList(props: Props) {
showUnresolvedClaims,
renderProperties,
includeSupportAction,
hideBlock,
injectedItem,
timedOutMessage,
tileLayout = false,
renderActions,
searchInLanguage,
hideMenu,
} = props;
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
const timedOut = uris === null;
const urisLength = (uris && uris.length) || 0;
const sortedUris = (urisLength > 0 && (currentSort === SORT_NEW ? uris : uris.slice().reverse())) || [];
const noResultMsg = searchInLanguage
? __('No results. Contents may be hidden by the Language filter.')
: __('No results');
function handleSortChange() {
setCurrentSort(currentSort === SORT_NEW ? SORT_OLD : SORT_NEW);
}
useEffect(() => {
const handleScroll = debounce((e) => {
const handleScroll = debounce(e => {
if (page && pageSize && onScrollBottom) {
const mainEl = document.querySelector(`.${MAIN_CLASS}`);
@@ -100,9 +95,10 @@ export default function ClaimList(props: Props) {
return tileLayout && !header ? (
<section className="claim-grid">
{urisLength > 0 &&
uris.map((uri) => <ClaimPreviewTile key={uri} uri={uri} showHiddenByUser={showHiddenByUser} />)}
{!timedOut && urisLength === 0 && !loading && <div className="empty main--empty">{empty || noResultMsg}</div>}
{urisLength > 0 && uris.map(uri => <ClaimPreviewTile key={uri} uri={uri} />)}
{!timedOut && urisLength === 0 && !loading && (
<div className="empty main--empty">{empty || __('No results')}</div>
)}
{timedOut && timedOutMessage && <div className="empty main--empty">{timedOutMessage}</div>}
</section>
) : (
@@ -150,13 +146,12 @@ export default function ClaimList(props: Props) {
<ClaimPreview
uri={uri}
type={type}
hideMenu={hideMenu}
includeSupportAction={includeSupportAction}
showUnresolvedClaim={showUnresolvedClaims}
properties={renderProperties || (type !== 'small' ? undefined : false)}
renderActions={renderActions}
showUserBlocked={showHiddenByUser}
showHiddenByUser={showHiddenByUser}
hideBlock={hideBlock}
customShouldHide={(claim: StreamClaim) => {
// Hack to hide spee.ch thumbnail publishes
// If it meets these requirements, it was probably uploaded here:
@@ -173,7 +168,9 @@ export default function ClaimList(props: Props) {
</ul>
)}
{!timedOut && urisLength === 0 && !loading && <div className="empty empty--centered">{empty || noResultMsg}</div>}
{!timedOut && urisLength === 0 && !loading && (
<div className="empty empty--centered">{empty || __('No results')}</div>
)}
{!loading && timedOut && timedOutMessage && <div className="empty empty--centered">{timedOutMessage}</div>}
</section>
);
+3 -5
View File
@@ -7,13 +7,12 @@ import {
SETTINGS,
} from 'lbry-redux';
import { selectFollowedTags } from 'redux/selectors/tags';
import { selectMutedChannels } from 'redux/selectors/blocked';
import { selectBlockedChannels } from 'redux/selectors/blocked';
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
import { makeSelectClientSetting, selectLanguage } from 'redux/selectors/settings';
import { selectModerationBlockList } from 'redux/selectors/comments';
import ClaimListDiscover from './view';
const select = (state) => ({
const select = state => ({
followedTags: selectFollowedTags(state),
claimSearchByQuery: selectClaimSearchByQuery(state),
claimSearchByQueryLastPageReached: selectClaimSearchByQueryLastPageReached(state),
@@ -21,8 +20,7 @@ const select = (state) => ({
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state),
hideReposts: makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state),
languageSetting: selectLanguage(state),
mutedUris: selectMutedChannels(state),
blockedUris: selectModerationBlockList(state),
hiddenUris: selectBlockedChannels(state),
searchInLanguage: makeSelectClientSetting(SETTINGS.SEARCH_IN_LANGUAGE)(state),
});
+36 -20
View File
@@ -20,18 +20,17 @@ type Props = {
doClaimSearch: ({}) => void,
loading: boolean,
personalView: boolean,
doToggleTagFollowDesktop: (string) => void,
doToggleTagFollowDesktop: string => void,
meta?: Node,
showNsfw: boolean,
hideReposts: boolean,
history: { action: string, push: (string) => void, replace: (string) => void },
history: { action: string, push: string => void, replace: string => void },
location: { search: string, pathname: string },
claimSearchByQuery: {
[string]: Array<string>,
},
claimSearchByQueryLastPageReached: { [string]: boolean },
mutedUris: Array<string>,
blockedUris: Array<string>,
hiddenUris: Array<string>,
hiddenNsfwMessage?: Node,
channelIds?: Array<string>,
claimIds?: Array<string>,
@@ -44,12 +43,13 @@ type Props = {
header?: Node,
headerLabel?: string | Node,
name?: string,
hideBlock?: boolean,
hideAdvancedFilter?: boolean,
claimType?: Array<string>,
defaultClaimType?: Array<string>,
streamType?: string | Array<string>,
defaultStreamType?: string | Array<string>,
renderProperties?: (Claim) => Node,
renderProperties?: Claim => Node,
includeSupportAction?: boolean,
repostedClaimId?: string,
pageSize?: number,
@@ -64,7 +64,6 @@ type Props = {
languageSetting: string,
searchInLanguage: boolean,
scrollAnchor?: string,
showHiddenByUser?: boolean,
};
function ClaimListDiscover(props: Props) {
@@ -81,8 +80,7 @@ function ClaimListDiscover(props: Props) {
hideReposts,
history,
location,
mutedUris,
blockedUris,
hiddenUris,
hiddenNsfwMessage,
defaultOrderBy,
orderBy,
@@ -91,6 +89,7 @@ function ClaimListDiscover(props: Props) {
name,
claimType,
pageSize,
hideBlock,
defaultClaimType,
streamType,
defaultStreamType,
@@ -113,7 +112,6 @@ function ClaimListDiscover(props: Props) {
languageSetting,
searchInLanguage,
scrollAnchor,
showHiddenByUser = false,
} = props;
const didNavigateForward = history.action === 'PUSH';
const { search } = location;
@@ -122,14 +120,13 @@ function ClaimListDiscover(props: Props) {
const isLargeScreen = useIsLargeScreen();
const [orderParamEntry, setOrderParamEntry] = usePersistedState(`entry-${location.pathname}`, CS.ORDER_BY_TRENDING);
const [orderParamUser, setOrderParamUser] = usePersistedState(`orderUser-${location.pathname}`, CS.ORDER_BY_TRENDING);
const followed = (followedTags && followedTags.map((t) => t.name)) || [];
const followed = (followedTags && followedTags.map(t => t.name)) || [];
const urlParams = new URLSearchParams(search);
const tagsParam = // can be 'x,y,z' or 'x' or ['x','y'] or CS.CONSTANT
(tags && getParamFromTags(tags)) ||
(urlParams.get(CS.TAGS_KEY) !== null && urlParams.get(CS.TAGS_KEY)) ||
(defaultTags && getParamFromTags(defaultTags));
const freshnessParam = freshness || urlParams.get(CS.FRESH_KEY) || defaultFreshness;
const mutedAndBlockedChannelIds = Array.from(new Set(mutedUris.concat(blockedUris).map((uri) => uri.split('#')[1])));
const langParam = urlParams.get(CS.LANGUAGE_KEY) || null;
const languageParams = searchInLanguage
@@ -209,7 +206,7 @@ function ClaimListDiscover(props: Props) {
no_totals: true,
not_channel_ids:
// If channelIdsParam were passed in, we don't need not_channel_ids
!channelIdsParam ? mutedAndBlockedChannelIds : [],
!channelIdsParam && hiddenUris && hiddenUris.length ? hiddenUris.map(hiddenUri => hiddenUri.split('#')[1]) : [],
not_tags: !showNsfw ? MATURE_TAGS : [],
order_by:
orderParam === CS.ORDER_BY_TRENDING
@@ -250,7 +247,12 @@ function ClaimListDiscover(props: Props) {
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())}`;
options.release_time = `>${Math.floor(
moment()
.subtract(1, freshnessParam)
.startOf('hour')
.unix()
)}`;
} else if (orderParam === CS.ORDER_BY_NEW || orderParam === CS.ORDER_BY_TRENDING) {
// Warning - hack below
// If users are following more than 10 channels or tags, limit results to stuff less than a year old
@@ -261,15 +263,29 @@ function ClaimListDiscover(props: Props) {
(options.channel_ids && options.channel_ids.length > 20) ||
(options.any_tags && options.any_tags.length > 20)
) {
options.release_time = `>${Math.floor(moment().subtract(3, CS.FRESH_MONTH).startOf('week').unix())}`;
options.release_time = `>${Math.floor(
moment()
.subtract(3, CS.FRESH_MONTH)
.startOf('week')
.unix()
)}`;
} else if (
(options.channel_ids && options.channel_ids.length > 10) ||
(options.any_tags && options.any_tags.length > 10)
) {
options.release_time = `>${Math.floor(moment().subtract(1, CS.FRESH_YEAR).startOf('week').unix())}`;
options.release_time = `>${Math.floor(
moment()
.subtract(1, CS.FRESH_YEAR)
.startOf('week')
.unix()
)}`;
} else {
// Hack for at least the New page until https://github.com/lbryio/lbry-sdk/issues/2591 is fixed
options.release_time = `<${Math.floor(moment().startOf('minute').unix())}`;
options.release_time = `<${Math.floor(
moment()
.startOf('minute')
.unix()
)}`;
}
}
}
@@ -317,14 +333,14 @@ function ClaimListDiscover(props: Props) {
if (hideReposts && !options.reposted_claim_id && !forceShowReposts) {
if (Array.isArray(options.claim_type)) {
if (options.claim_type.length > 1) {
options.claim_type = options.claim_type.filter((claimType) => claimType !== 'repost');
options.claim_type = options.claim_type.filter(claimType => claimType !== 'repost');
}
} else {
options.claim_type = ['stream', 'channel'];
}
}
const hasMatureTags = tagsParam && tagsParam.split(',').some((t) => MATURE_TAGS.includes(t));
const hasMatureTags = tagsParam && tagsParam.split(',').some(t => MATURE_TAGS.includes(t));
const claimSearchCacheQuery = createNormalizedClaimSearchKey(options);
const claimSearchResult = claimSearchByQuery[claimSearchCacheQuery];
const claimSearchResultLastPageReached = claimSearchByQueryLastPageReached[claimSearchCacheQuery];
@@ -483,8 +499,8 @@ function ClaimListDiscover(props: Props) {
timedOutMessage={timedOutMessage}
renderProperties={renderProperties}
includeSupportAction={includeSupportAction}
hideBlock={hideBlock}
injectedItem={injectedItem}
showHiddenByUser={showHiddenByUser}
/>
{loading && (
<div className="claim-grid">
@@ -511,8 +527,8 @@ function ClaimListDiscover(props: Props) {
timedOutMessage={timedOutMessage}
renderProperties={renderProperties}
includeSupportAction={includeSupportAction}
hideBlock={hideBlock}
injectedItem={injectedItem}
showHiddenByUser={showHiddenByUser}
/>
{loading && new Array(dynamicPageSize).fill(1).map((x, i) => <ClaimPreview key={i} placeholder="loading" />)}
</div>
-20
View File
@@ -1,20 +0,0 @@
import { connect } from 'react-redux';
import { makeSelectClaimForUri, makeSelectClaimIsMine } from 'lbry-redux';
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
import { doToggleMuteChannel } from 'redux/actions/blocked';
import { doCommentModBlock, doCommentModUnBlock } from 'redux/actions/comments';
import { makeSelectChannelIsBlocked } from 'redux/selectors/comments';
import ClaimPreview from './view';
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
channelIsMuted: makeSelectChannelIsMuted(props.uri)(state),
channelIsBlocked: makeSelectChannelIsBlocked(props.uri)(state),
});
export default connect(select, {
doToggleMuteChannel,
doCommentModBlock,
doCommentModUnBlock,
})(ClaimPreview);
-120
View File
@@ -1,120 +0,0 @@
// @flow
import { URL, SHARE_DOMAIN_URL } from 'config';
import * as ICONS from 'constants/icons';
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';
const SHARE_DOMAIN = SHARE_DOMAIN_URL || URL;
type Props = {
uri: string,
claim: ?Claim,
inline?: boolean,
claimIsMine: boolean,
channelIsMuted: boolean,
channelIsBlocked: boolean,
doToggleMuteChannel: (string) => void,
doCommentModBlock: (string) => void,
doCommentModUnBlock: (string) => void,
};
function ClaimMenuList(props: Props) {
const {
uri,
claim,
inline = false,
claimIsMine,
doToggleMuteChannel,
channelIsMuted,
channelIsBlocked,
doCommentModBlock,
doCommentModUnBlock,
} = props;
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;
}
function handleToggleMute() {
doToggleMuteChannel(channelUri);
}
function handleToggleBlock() {
if (channelIsBlocked) {
doCommentModUnBlock(channelUri);
} else {
doCommentModBlock(channelUri);
}
}
function handleCopyLink() {
navigator.clipboard.writeText(shareUrl);
}
function handleReportContent() {
window.open(`https://lbry.com/dmca/${claim.claim_id}`, '_blank', 'noopener');
}
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">
{!claimIsMine && (
<>
<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>
<hr className="menu__separator" />
</>
)}
<MenuItem className="comment__menu-option" onSelect={handleCopyLink}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.SHARE} />
{__('Copy Link')}
</div>
</MenuItem>
{!claimIsMine && (
<MenuItem className="comment__menu-option" onSelect={handleReportContent}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.REPORT} />
{__('Report Content')}
</div>
</MenuItem>
)}
</MenuList>
</Menu>
);
}
export default ClaimMenuList;
+6 -8
View File
@@ -11,12 +11,11 @@ import {
makeSelectClaimWasPurchased,
makeSelectStreamingUrlForUri,
} from 'lbry-redux';
import { selectMutedChannels, makeSelectChannelIsMuted } from 'redux/selectors/blocked';
import { selectBlockedChannels, selectChannelIsBlocked } from 'redux/selectors/blocked';
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
import { selectShowMatureContent } from 'redux/selectors/settings';
import { makeSelectHasVisitedUri } from 'redux/selectors/content';
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
import { selectModerationBlockList } from 'redux/selectors/comments';
import ClaimPreview from './view';
const select = (state, props) => ({
@@ -31,18 +30,17 @@ const select = (state, props) => ({
nsfw: props.uri && makeSelectClaimIsNsfw(props.uri)(state),
blackListedOutpoints: selectBlackListedOutpoints(state),
filteredOutpoints: selectFilteredOutpoints(state),
mutedUris: selectMutedChannels(state),
blockedUris: selectModerationBlockList(state),
blockedChannelUris: selectBlockedChannels(state),
hasVisitedUri: props.uri && makeSelectHasVisitedUri(props.uri)(state),
channelIsBlocked: props.uri && makeSelectChannelIsMuted(props.uri)(state),
channelIsBlocked: props.uri && selectChannelIsBlocked(props.uri)(state),
isSubscribed: props.uri && makeSelectIsSubscribed(props.uri, true)(state),
streamingUrl: props.uri && makeSelectStreamingUrlForUri(props.uri)(state),
wasPurchased: props.uri && makeSelectClaimWasPurchased(props.uri)(state),
});
const perform = (dispatch) => ({
resolveUri: (uri) => dispatch(doResolveUri(uri)),
getFile: (uri) => dispatch(doFileGet(uri, false)),
const perform = dispatch => ({
resolveUri: uri => dispatch(doResolveUri(uri)),
getFile: uri => dispatch(doFileGet(uri, false)),
});
export default connect(select, perform)(ClaimPreview);
+42 -36
View File
@@ -3,7 +3,8 @@ import type { Node } from 'react';
import React, { useEffect, forwardRef } from 'react';
import { NavLink, withRouter } from 'react-router-dom';
import classnames from 'classnames';
import { parseURI } from 'lbry-redux';
import { parseURI, convertToShareLink } from 'lbry-redux';
import { openCopyLinkMenu } from 'util/context-menu';
import { formatLbryUrlForWeb } from 'util/url';
import { isEmpty } from 'util/object';
import FileThumbnail from 'component/fileThumbnail';
@@ -12,6 +13,7 @@ import FileProperties from 'component/fileProperties';
import ClaimTags from 'component/claimTags';
import SubscribeButton from 'component/subscribeButton';
import ChannelThumbnail from 'component/channelThumbnail';
import BlockButton from 'component/blockButton';
import ClaimSupportButton from 'component/claimSupportButton';
import useGetThumbnail from 'effects/use-get-thumbnail';
import ClaimPreviewTitle from 'component/claimPreviewTitle';
@@ -20,7 +22,6 @@ import ClaimRepostAuthor from 'component/claimRepostAuthor';
import FileDownloadLink from 'component/fileDownloadLink';
import AbandonedChannelPreview from 'component/abandonedChannelPreview';
import PublishPending from 'component/publishPending';
import ClaimMenuList from 'component/claimMenuList';
import ClaimPreviewLoading from './claim-preview-loading';
import ClaimPreviewHidden from './claim-preview-no-mature';
import ClaimPreviewNoContent from './claim-preview-no-content';
@@ -33,9 +34,9 @@ type Props = {
claimIsMine: boolean,
pending?: boolean,
reflectingProgress?: any, // fxme
resolveUri: (string) => void,
resolveUri: string => void,
isResolvingUri: boolean,
history: { push: (string) => void },
history: { push: string => void },
title: string,
nsfw: boolean,
placeholder: string,
@@ -49,25 +50,25 @@ type Props = {
txid: string,
nout: number,
}>,
mutedUris: Array<string>,
blockedUris: Array<string>,
blockedChannelUris: Array<string>,
channelIsBlocked: boolean,
isSubscribed: boolean,
actions: boolean | Node | string | number,
properties: boolean | Node | string | number | ((Claim) => Node),
properties: boolean | Node | string | number | (Claim => Node),
empty?: Node,
onClick?: (any) => any,
onClick?: any => any,
hideBlock?: boolean,
streamingUrl: ?string,
getFile: (string) => void,
customShouldHide?: (Claim) => boolean,
getFile: string => void,
customShouldHide?: Claim => boolean,
showUnresolvedClaim?: boolean,
showNullPlaceholder?: boolean,
includeSupportAction?: boolean,
hideActions?: boolean,
renderActions?: (Claim) => ?Node,
renderActions?: Claim => ?Node,
wrapperElement?: string,
hideRepostLabel?: boolean,
repostUrl?: string,
hideMenu?: boolean,
};
const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
@@ -83,6 +84,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
// is the claim consider nsfw?
nsfw,
claimIsMine,
isSubscribed,
streamingUrl,
// user properties
channelIsBlocked,
@@ -108,14 +110,13 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
hideActions = false,
properties,
onClick,
hideBlock,
actions,
mutedUris,
blockedUris,
blockedChannelUris,
blackListedOutpoints,
filteredOutpoints,
includeSupportAction,
renderActions,
hideMenu = false,
// repostUrl,
} = props;
const WrapperElement = wrapperElement || 'li';
@@ -141,7 +142,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
const navigateUrl = formatLbryUrlForWeb((claim && claim.canonical_url) || uri || '/');
const navLinkProps = {
to: navigateUrl,
onClick: (e) => e.stopPropagation(),
onClick: e => e.stopPropagation(),
};
// do not block abandoned and nsfw claims if showUserBlocked is passed
@@ -153,7 +154,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
// This will be replaced once blocking is done at the wallet server level
if (claim && !claimIsMine && !shouldHide && blackListedOutpoints) {
shouldHide = blackListedOutpoints.some(
(outpoint) =>
outpoint =>
(signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) ||
(outpoint.txid === claim.txid && outpoint.nout === claim.nout)
);
@@ -162,17 +163,19 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
// or signing channel outpoint is in the filter list
if (claim && !claimIsMine && !shouldHide && filteredOutpoints) {
shouldHide = filteredOutpoints.some(
(outpoint) =>
outpoint =>
(signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) ||
(outpoint.txid === claim.txid && outpoint.nout === claim.nout)
);
}
// block stream claims
if (claim && !shouldHide && !showUserBlocked && mutedUris.length && signingChannel) {
shouldHide = mutedUris.some((blockedUri) => blockedUri === signingChannel.permanent_url);
if (claim && !shouldHide && !showUserBlocked && blockedChannelUris.length && signingChannel) {
shouldHide = blockedChannelUris.some(blockedUri => blockedUri === signingChannel.permanent_url);
}
if (claim && !shouldHide && !showUserBlocked && blockedUris.length && signingChannel) {
shouldHide = blockedUris.some((blockedUri) => blockedUri === signingChannel.permanent_url);
// block channel claims if we can't control for them in claim search
// e.g. fetchRecommendedSubscriptions
if (claim && isChannelUri && !shouldHide && !showUserBlocked && blockedChannelUris.length) {
shouldHide = blockedChannelUris.some(blockedUri => blockedUri === claim.permanent_url);
}
if (!shouldHide && customShouldHide && claim) {
@@ -185,6 +188,17 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
// Make sure this happens after we figure out if this claim needs to be hidden
const thumbnailUrl = useGetThumbnail(contentUri, claim, streamingUrl, getFile, shouldHide);
function handleContextMenu(e) {
// @if TARGET='app'
e.preventDefault();
e.stopPropagation();
if (claim) {
const shareLink = convertToShareLink(claim.canonical_url || claim.permanent_url);
openCopyLinkMenu(shareLink.replace(/#/g, ':'), e);
}
// @endif
}
function handleOnClick(e) {
if (onClick) {
onClick(e);
@@ -199,7 +213,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
if (isValid && !isResolvingUri && shouldFetch && uri) {
resolveUri(uri);
}
}, [isValid, uri, isResolvingUri, shouldFetch, resolveUri]);
}, [isValid, uri, isResolvingUri, shouldFetch]);
if (shouldHide && !showNullPlaceholder) {
return null;
@@ -239,6 +253,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
ref={ref}
role="link"
onClick={pending || type === 'inline' ? undefined : handleOnClick}
onContextMenu={handleContextMenu}
className={classnames('claim-preview__wrapper', {
'claim-preview__wrapper--channel': isChannelUri && type !== 'inline',
'claim-preview__wrapper--inline': type === 'inline',
@@ -260,7 +275,7 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
>
{isChannelUri && claim ? (
<UriIndicator uri={contentUri} link>
<ChannelThumbnail uri={contentUri} />
<ChannelThumbnail uri={contentUri} obscure={channelIsBlocked} />
</UriIndicator>
) : (
<>
@@ -297,10 +312,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
<ClaimPreviewTitle uri={uri} />
</NavLink>
)}
{/* {type !== 'small' && !isChannelUri && signingChannel && SIMPLE_SITE && (
<ChannelThumbnail uri={signingChannel.permanent_url} />
)} */}
</div>
<ClaimPreviewSubtitle uri={uri} type={type} />
{(pending || !!reflectingProgress) && <PublishPending uri={uri} />}
@@ -314,16 +325,12 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
actions
) : (
<div className="claim-preview__primary-actions">
{!isChannelUri && signingChannel && (
<div className="claim-preview__channel-staked">
<ChannelThumbnail uri={signingChannel.permanent_url} />
</div>
)}
{isChannelUri && !channelIsBlocked && !claimIsMine && (
<SubscribeButton uri={contentUri.startsWith('lbry://') ? contentUri : `lbry://${contentUri}`} />
)}
{!hideBlock && isChannelUri && !isSubscribed && (!claimIsMine || channelIsBlocked) && (
<BlockButton uri={contentUri.startsWith('lbry://') ? contentUri : `lbry://${contentUri}`} />
)}
{includeSupportAction && <ClaimSupportButton uri={uri} />}
</div>
)}
@@ -344,7 +351,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
)}
</div>
</div>
{!hideMenu && <ClaimMenuList uri={uri} />}
</WrapperElement>
);
});
+1 -1
View File
@@ -10,7 +10,7 @@ type Props = {
claim: ?Claim,
pending?: boolean,
type: string,
beginPublish: (string) => void,
beginPublish: string => void,
};
function ClaimPreviewSubtitle(props: Props) {
+5 -5
View File
@@ -9,7 +9,7 @@ import {
makeSelectChannelForClaimUri,
makeSelectClaimIsNsfw,
} from 'lbry-redux';
import { selectMutedChannels } from 'redux/selectors/blocked';
import { selectBlockedChannels } from 'redux/selectors/blocked';
import { selectBlackListedOutpoints, selectFilteredOutpoints } from 'lbryinc';
import { selectShowMatureContent } from 'redux/selectors/settings';
import ClaimPreviewTile from './view';
@@ -22,14 +22,14 @@ const select = (state, props) => ({
title: props.uri && makeSelectTitleForUri(props.uri)(state),
blackListedOutpoints: selectBlackListedOutpoints(state),
filteredOutpoints: selectFilteredOutpoints(state),
blockedChannelUris: selectMutedChannels(state),
blockedChannelUris: selectBlockedChannels(state),
showMature: selectShowMatureContent(state),
isMature: makeSelectClaimIsNsfw(props.uri)(state),
});
const perform = (dispatch) => ({
resolveUri: (uri) => dispatch(doResolveUri(uri)),
getFile: (uri) => dispatch(doFileGet(uri, false)),
const perform = dispatch => ({
resolveUri: uri => dispatch(doResolveUri(uri)),
getFile: uri => dispatch(doFileGet(uri, false)),
});
export default connect(select, perform)(ClaimPreviewTile);
+17 -23
View File
@@ -14,14 +14,13 @@ 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';
type Props = {
uri: string,
claim: ?Claim,
resolveUri: (string) => void,
resolveUri: string => void,
isResolvingUri: boolean,
history: { push: (string) => void },
history: { push: string => void },
thumbnail: string,
title: string,
placeholder: boolean,
@@ -34,12 +33,11 @@ type Props = {
nout: number,
}>,
blockedChannelUris: Array<string>,
getFile: (string) => void,
getFile: string => void,
placeholder: boolean,
streamingUrl: string,
isMature: boolean,
showMature: boolean,
showHiddenByUser?: boolean,
};
function ClaimPreviewTile(props: Props) {
@@ -59,7 +57,6 @@ function ClaimPreviewTile(props: Props) {
blockedChannelUris,
isMature,
showMature,
showHiddenByUser,
} = props;
const isRepost = claim && claim.repost_channel_url;
const shouldFetch = claim === undefined;
@@ -69,7 +66,7 @@ function ClaimPreviewTile(props: Props) {
const navLinkProps = {
to: navigateUrl,
onClick: (e) => e.stopPropagation(),
onClick: e => e.stopPropagation(),
};
let isChannel;
@@ -83,10 +80,13 @@ function ClaimPreviewTile(props: Props) {
}
}
let channelUri;
const signingChannel = claim && claim.signing_channel;
let channelThumbnail;
if (signingChannel) {
channelUri = signingChannel.permanent_url;
channelThumbnail =
// I should be able to just pass the the uri to <ChannelThumbnail /> but it wasn't working
// Come back to me
(signingChannel.value && signingChannel.value.thumbnail && signingChannel.value.thumbnail.url) || undefined;
}
function handleClick(e) {
@@ -112,7 +112,7 @@ function ClaimPreviewTile(props: Props) {
// This will be replaced once blocking is done at the wallet server level
if (claim && !shouldHide && blackListedOutpoints) {
shouldHide = blackListedOutpoints.some(
(outpoint) =>
outpoint =>
(signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) ||
(outpoint.txid === claim.txid && outpoint.nout === claim.nout)
);
@@ -121,20 +121,20 @@ function ClaimPreviewTile(props: Props) {
// or signing channel outpoint is in the filter list
if (claim && !shouldHide && filteredOutpoints) {
shouldHide = filteredOutpoints.some(
(outpoint) =>
outpoint =>
(signingChannel && outpoint.txid === signingChannel.txid && outpoint.nout === signingChannel.nout) ||
(outpoint.txid === claim.txid && outpoint.nout === claim.nout)
);
}
// block stream claims
if (claim && !shouldHide && !showHiddenByUser && blockedChannelUris.length && signingChannel) {
shouldHide = blockedChannelUris.some((blockedUri) => blockedUri === signingChannel.permanent_url);
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 (claim && isChannel && !shouldHide && !showHiddenByUser && blockedChannelUris.length) {
shouldHide = blockedChannelUris.some((blockedUri) => blockedUri === claim.permanent_url);
if (claim && isChannel && !shouldHide && blockedChannelUris.length) {
shouldHide = blockedChannelUris.some(blockedUri => blockedUri === claim.permanent_url);
}
if (shouldHide) {
@@ -179,13 +179,7 @@ function ClaimPreviewTile(props: Props) {
</NavLink>
<NavLink {...navLinkProps}>
<h2 className="claim-tile__title">
<TruncatedText text={title || (claim && claim.name)} lines={isChannel ? 1 : 2} />
{isChannel && (
<div className="claim-tile__about">
<UriIndicator uri={uri} link />
</div>
)}
<ClaimMenuList uri={uri} />
<TruncatedText text={title || (claim && claim.name)} lines={2} />
</h2>
</NavLink>
<div>
@@ -197,7 +191,7 @@ function ClaimPreviewTile(props: Props) {
) : (
<React.Fragment>
<UriIndicator uri={uri} link hideAnonymous>
<ChannelThumbnail uri={channelUri} />
<ChannelThumbnail thumbnailPreview={channelThumbnail} />
</UriIndicator>
<div className="claim-tile__about">
+1 -1
View File
@@ -47,7 +47,7 @@ function ClaimRepostAuthor(props: Props) {
return (
<div className="claim-preview__repost-author">
<Icon icon={ICONS.REPOST} size={10} className="claim-preview__repost-icon" />
<Icon icon={ICONS.REPOST} size={10} />
<I18nMessage tokens={{ repost_channel_link: <UriIndicator link uri={repostChannelUrl} /> }}>
%repost_channel_link% reposted
</I18nMessage>
+1 -1
View File
@@ -53,7 +53,7 @@ export default function ClaimTags(props: Props) {
return (
<div className={classnames('file-properties--small', { 'file-properties--large': type === 'large' })}>
{tagsToDisplay.map((tag) => (
{tagsToDisplay.map(tag => (
<Tag key={tag} title={tag} name={tag} />
))}
</div>
+3 -1
View File
@@ -1,14 +1,16 @@
import { connect } from 'react-redux';
import { doClaimSearch, selectClaimSearchByQuery, selectFetchingClaimSearchByQuery, SETTINGS } from 'lbry-redux';
import { selectBlockedChannels } from 'redux/selectors/blocked';
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import ClaimListDiscover from './view';
const select = (state) => ({
const select = state => ({
claimSearchByQuery: selectClaimSearchByQuery(state),
fetchingClaimSearchByQuery: selectFetchingClaimSearchByQuery(state),
showNsfw: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state),
hideReposts: makeSelectClientSetting(SETTINGS.HIDE_REPOSTS)(state),
hiddenUris: selectBlockedChannels(state),
});
const perform = {
+11 -6
View File
@@ -10,7 +10,7 @@ type Props = {
doClaimSearch: ({}) => void,
showNsfw: boolean,
hideReposts: boolean,
history: { action: string, push: (string) => void, replace: (string) => void },
history: { action: string, push: string => void, replace: string => void },
claimSearchByQuery: {
[string]: Array<string>,
},
@@ -19,10 +19,10 @@ type Props = {
},
// claim search options are below
tags: Array<string>,
blockedUris: Array<string>,
mutedUris: Array<string>,
hiddenUris: Array<string>,
claimIds?: Array<string>,
channelIds?: Array<string>,
notChannelIds?: Array<string>,
pageSize: number,
orderBy?: Array<string>,
releaseTime?: string,
@@ -39,10 +39,12 @@ function ClaimTilesDiscover(props: Props) {
claimSearchByQuery,
showNsfw,
hideReposts,
hiddenUris,
// Below are options to pass that are forwarded to claim_search
tags,
channelIds,
claimIds,
notChannelIds,
orderBy,
pageSize = 8,
releaseTime,
@@ -84,7 +86,10 @@ function ClaimTilesDiscover(props: Props) {
not_tags: !showNsfw ? MATURE_TAGS : [],
any_languages: languages,
channel_ids: channelIds || [],
not_channel_ids: [],
not_channel_ids:
notChannelIds ||
// If channelIds were passed in, we don't need not_channel_ids
(!channelIds && hiddenUris && hiddenUris.length ? hiddenUris.map(hiddenUri => hiddenUri.split('#')[1]) : []),
order_by: orderBy || ['trending_group', 'trending_mixed'],
};
@@ -103,7 +108,7 @@ function ClaimTilesDiscover(props: Props) {
// https://github.com/lbryio/lbry-desktop/issues/3774
if (hideReposts) {
if (Array.isArray(options.claim_type)) {
options.claim_type = options.claim_type.filter((claimType) => claimType !== 'repost');
options.claim_type = options.claim_type.filter(claimType => claimType !== 'repost');
} else {
options.claim_type = ['stream', 'channel'];
}
@@ -138,7 +143,7 @@ function ClaimTilesDiscover(props: Props) {
return (
<ul className="claim-grid">
{uris && uris.length
? uris.map((uri) => <ClaimPreviewTile key={uri} uri={uri} />)
? uris.map(uri => <ClaimPreviewTile key={uri} uri={uri} />)
: new Array(pageSize).fill(1).map((x, i) => <ClaimPreviewTile key={i} placeholder />)}
</ul>
);
+44 -19
View File
@@ -1,30 +1,55 @@
import { connect } from 'react-redux';
import { makeSelectStakedLevelForChannelUri, makeSelectThumbnailForUri, selectMyChannelClaims } from 'lbry-redux';
import { doCommentUpdate } from 'redux/actions/comments';
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
import {
doResolveUri,
makeSelectClaimIsPending,
makeSelectClaimForUri,
makeSelectThumbnailForUri,
makeSelectIsUriResolving,
selectMyChannelClaims,
makeSelectMyChannelPermUrlForName,
makeSelectChannelPermUrlForClaimUri,
} from 'lbry-redux';
import { doCommentAbandon, doCommentUpdate, doCommentPin, doCommentList } from 'redux/actions/comments';
import { doToggleBlockChannel } from 'redux/actions/blocked';
import { selectChannelIsBlocked } from 'redux/selectors/blocked';
import { doToast } from 'redux/actions/notifications';
import { doSetPlayingUri } from 'redux/actions/content';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
import { makeSelectOthersReactionsForComment } from 'redux/selectors/comments';
import { selectActiveChannelClaim } from 'redux/selectors/app';
import { selectPlayingUri } from 'redux/selectors/content';
import {
selectIsFetchingComments,
makeSelectOthersReactionsForComment,
selectCommentChannel,
} from 'redux/selectors/comments';
import Comment from './view';
const select = (state, props) => ({
thumbnail: props.authorUri && makeSelectThumbnailForUri(props.authorUri)(state),
channelIsBlocked: props.authorUri && makeSelectChannelIsMuted(props.authorUri)(state),
commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
othersReacts: makeSelectOthersReactionsForComment(props.commentId)(state),
activeChannelClaim: selectActiveChannelClaim(state),
myChannels: selectMyChannelClaims(state),
playingUri: selectPlayingUri(state),
stakedLevel: makeSelectStakedLevelForChannelUri(props.authorUri)(state),
});
const select = (state, props) => {
const channel = selectCommentChannel(state);
const perform = (dispatch) => ({
clearPlayingUri: () => dispatch(doSetPlayingUri({ uri: null })),
return {
activeChannel: channel,
pending: props.authorUri && makeSelectClaimIsPending(props.authorUri)(state),
channel: props.authorUri && makeSelectClaimForUri(props.authorUri)(state),
isResolvingUri: props.authorUri && makeSelectIsUriResolving(props.authorUri)(state),
thumbnail: props.authorUri && makeSelectThumbnailForUri(props.authorUri)(state),
channelIsBlocked: props.authorUri && selectChannelIsBlocked(props.authorUri)(state),
commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
isFetchingComments: selectIsFetchingComments(state),
myChannels: selectMyChannelClaims(state),
othersReacts: makeSelectOthersReactionsForComment(props.commentId)(state),
commentIdentityChannel: makeSelectMyChannelPermUrlForName(channel)(state),
contentChannel: makeSelectChannelPermUrlForClaimUri(props.uri)(state),
};
};
const perform = dispatch => ({
closeInlinePlayer: () => dispatch(doSetPlayingUri({ uri: null })),
resolveUri: uri => dispatch(doResolveUri(uri)),
updateComment: (commentId, comment) => dispatch(doCommentUpdate(commentId, comment)),
doToast: (options) => dispatch(doToast(options)),
deleteComment: commentId => dispatch(doCommentAbandon(commentId)),
blockChannel: channelUri => dispatch(doToggleBlockChannel(channelUri)),
doToast: options => dispatch(doToast(options)),
pinComment: (commentId, remove) => dispatch(doCommentPin(commentId, remove)),
fetchComments: uri => dispatch(doCommentList(uri)),
});
export default connect(select, perform)(Comment);
+84 -40
View File
@@ -5,12 +5,13 @@ import { FF_MAX_CHARS_IN_COMMENT } from 'constants/form-field';
import { SITE_NAME, SIMPLE_SITE, ENABLE_COMMENT_REACTIONS } from 'config';
import React, { useEffect, useState } from 'react';
import { parseURI } from 'lbry-redux';
import { isEmpty } from 'util/object';
import DateTime from 'component/dateTime';
import Button from 'component/button';
import Expandable from 'component/expandable';
import MarkdownPreview from 'component/common/markdown-preview';
import ChannelThumbnail from 'component/channelThumbnail';
import { Menu, MenuButton } from '@reach/menu-button';
import { Menu, MenuList, MenuButton, MenuItem } from '@reach/menu-button';
import Icon from 'component/common/icon';
import { FormField, Form } from 'component/common/form';
import classnames from 'classnames';
@@ -19,22 +20,25 @@ import CommentReactions from 'component/commentReactions';
import CommentsReplies from 'component/commentsReplies';
import { useHistory } from 'react-router';
import CommentCreate from 'component/commentCreate';
import CommentMenuList from 'component/commentMenuList';
import UriIndicator from 'component/uriIndicator';
type Props = {
clearPlayingUri: () => void,
closeInlinePlayer: () => void,
uri: string,
author: ?string, // LBRY Channel Name, e.g. @channel
authorUri: string, // full LBRY Channel URI: lbry://@channel#123...
commentId: string, // sha256 digest identifying the comment
message: string, // comment body
timePosted: number, // Comment timestamp
channel: ?Claim, // Channel Claim, retrieved to obtain thumbnail
pending?: boolean,
resolveUri: string => void, // resolves the URI
isResolvingUri: boolean, // if the URI is currently being resolved
channelIsBlocked: boolean, // if the channel is blacklisted in the app
claimIsMine: boolean, // if you control the claim which this comment was posted on
commentIsMine: boolean, // if this comment was signed by an owned channel
updateComment: (string, string) => void,
commentModBlock: (string) => void,
deleteComment: string => void,
blockChannel: string => void,
linkedComment?: any,
myChannels: ?Array<ChannelClaim>,
commentingEnabled: boolean,
@@ -46,10 +50,10 @@ type Props = {
like: number,
dislike: number,
},
pinComment: (string, boolean) => Promise<any>,
fetchComments: string => void,
commentIdentityChannel: any,
activeChannelClaim: ?ChannelClaim,
playingUri: ?PlayingUri,
stakedLevel: number,
contentChannel: any,
};
const LENGTH_TO_COLLAPSE = 300;
@@ -57,16 +61,22 @@ const ESCAPE_KEY = 27;
function Comment(props: Props) {
const {
clearPlayingUri,
closeInlinePlayer,
uri,
author,
authorUri,
timePosted,
message,
pending,
channel,
isResolvingUri,
resolveUri,
channelIsBlocked,
commentIsMine,
commentId,
updateComment,
deleteComment,
blockChannel,
linkedComment,
commentingEnabled,
myChannels,
@@ -74,9 +84,11 @@ function Comment(props: Props) {
isTopLevel,
threadDepth,
isPinned,
pinComment,
fetchComments,
othersReacts,
playingUri,
stakedLevel,
commentIdentityChannel,
contentChannel,
} = props;
const {
push,
@@ -96,7 +108,10 @@ function Comment(props: Props) {
const dislikesCount = (othersReacts && othersReacts.dislike) || 0;
const totalLikesAndDislikes = likesCount + dislikesCount;
const slimedToDeath = totalLikesAndDislikes >= 5 && dislikesCount / totalLikesAndDislikes > 0.8;
// to debounce subsequent requests
const shouldFetch =
channel === undefined ||
(channel !== null && channel.value_type === 'channel' && isEmpty(channel.meta) && !pending);
let channelOwnerOfContent;
try {
const { channelName } = parseURI(uri);
@@ -106,11 +121,16 @@ function Comment(props: Props) {
} catch (e) {}
useEffect(() => {
// If author was extracted from the URI, then it must be valid.
if (authorUri && author && !isResolvingUri && shouldFetch) {
resolveUri(authorUri);
}
if (isEditing) {
setCharCount(editedMessage.length);
// a user will try and press the escape key to cancel editing their comment
const handleEscape = (event) => {
const handleEscape = event => {
if (event.keyCode === ESCAPE_KEY) {
setEditing(false);
}
@@ -123,19 +143,26 @@ function Comment(props: Props) {
window.removeEventListener('keydown', handleEscape);
};
}
}, [author, authorUri, editedMessage, isEditing, setEditing]);
}, [isResolvingUri, shouldFetch, author, authorUri, resolveUri, editedMessage, isEditing, setEditing]);
function handleEditMessageChanged(event) {
setCommentValue(!SIMPLE_SITE && advancedEditor ? event : event.target.value);
}
function handlePinComment(commentId, remove) {
pinComment(commentId, remove).then(() => fetchComments(uri));
}
function handleEditComment() {
if (playingUri && playingUri.source === 'comment') {
clearPlayingUri();
}
closeInlinePlayer();
setEditing(true);
}
function handleDeleteComment() {
closeInlinePlayer();
deleteComment(commentId);
}
function handleSubmit() {
updateComment(commentId, editedMessage);
setEditing(false);
@@ -187,7 +214,11 @@ function Comment(props: Props) {
{!author ? (
<span className="comment__author">{__('Anonymous')}</span>
) : (
<UriIndicator link uri={authorUri} />
<Button
className="button--uri-indicator truncated-text comment__author"
navigate={authorUri}
label={author}
/>
)}
<Button
className="comment__time"
@@ -206,22 +237,45 @@ function Comment(props: Props) {
</div>
<div className="comment__menu">
<Menu>
<MenuButton className="menu__button">
<MenuButton>
<Icon
size={18}
className={mouseIsHovering ? 'comment__menu-icon--hovering' : 'comment__menu-icon'}
icon={ICONS.MORE_VERTICAL}
/>
</MenuButton>
<CommentMenuList
uri={uri}
isTopLevel={isTopLevel}
isPinned={isPinned}
commentId={commentId}
authorUri={authorUri}
commentIsMine={commentIsMine}
handleEditComment={handleEditComment}
/>
<MenuList className="menu__list--comments">
{commentIsMine ? (
<>
<MenuItem className="comment__menu-option menu__link" onSelect={handleEditComment}>
<Icon aria-hidden icon={ICONS.EDIT} />
{__('Edit')}
</MenuItem>
<MenuItem className="comment__menu-option menu__link" onSelect={handleDeleteComment}>
<Icon aria-hidden icon={ICONS.DELETE} />
{__('Delete')}
</MenuItem>
</>
) : (
<MenuItem className="comment__menu-option menu__link" onSelect={() => blockChannel(authorUri)}>
<Icon aria-hidden icon={ICONS.NO} />
{__('Block Channel')}
</MenuItem>
)}
{commentIdentityChannel === contentChannel && isTopLevel && (
<MenuItem
className="comment__menu-option menu__link"
onSelect={
isPinned ? () => handlePinComment(commentId, true) : () => handlePinComment(commentId, false)
}
>
<span className={'button__content'}>
<Icon aria-hidden icon={ICONS.PIN} className={'icon'} />
{isPinned ? __('Unpin') : __('Pin')}
</span>
</MenuItem>
)}
</MenuList>
</Menu>
</div>
</div>
@@ -256,20 +310,10 @@ function Comment(props: Props) {
</div>
) : editedMessage.length >= LENGTH_TO_COLLAPSE ? (
<Expandable>
<MarkdownPreview
content={message}
promptLinks
parentCommentId={commentId}
stakedLevel={stakedLevel}
/>
<MarkdownPreview content={message} promptLinks parentCommentId={commentId} />
</Expandable>
) : (
<MarkdownPreview
content={message}
promptLinks
parentCommentId={commentId}
stakedLevel={stakedLevel}
/>
<MarkdownPreview content={message} promptLinks parentCommentId={commentId} />
)}
</div>
+8 -16
View File
@@ -1,16 +1,9 @@
import { connect } from 'react-redux';
import {
makeSelectClaimForUri,
makeSelectClaimIsMine,
selectMyChannelClaims,
selectFetchingMyChannels,
} from 'lbry-redux';
import { selectIsPostingComment } from 'redux/selectors/comments';
import { doOpenModal, doSetActiveChannel } from 'redux/actions/app';
import { doCommentCreate } from 'redux/actions/comments';
import { makeSelectClaimForUri, selectMyChannelClaims, selectFetchingMyChannels } from 'lbry-redux';
import { selectIsPostingComment, selectCommentChannel } from 'redux/selectors/comments';
import { doOpenModal } from 'redux/actions/app';
import { doCommentCreate, doSetCommentChannel } from 'redux/actions/comments';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
import { selectActiveChannelClaim } from 'redux/selectors/app';
import { doToast } from 'redux/actions/notifications';
import { CommentCreate } from './view';
const select = (state, props) => ({
@@ -19,15 +12,14 @@ const select = (state, props) => ({
channels: selectMyChannelClaims(state),
isFetchingChannels: selectFetchingMyChannels(state),
isPostingComment: selectIsPostingComment(state),
activeChannelClaim: selectActiveChannelClaim(state),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
activeChannel: selectCommentChannel(state),
});
const perform = (dispatch, ownProps) => ({
createComment: (comment, claimId, parentId) => dispatch(doCommentCreate(comment, claimId, parentId, ownProps.uri)),
createComment: (comment, claimId, channel, parentId) =>
dispatch(doCommentCreate(comment, claimId, channel, parentId, ownProps.uri)),
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
setActiveChannel: (claimId) => dispatch(doSetActiveChannel(claimId)),
toast: (message) => dispatch(doToast({ message, isError: true })),
setCommentChannel: name => dispatch(doSetCommentChannel(name)),
});
export default connect(select, perform)(CommentCreate);
+24 -53
View File
@@ -1,25 +1,16 @@
// @flow
import { SIMPLE_SITE } from 'config';
import * as PAGES from 'constants/pages';
import { CHANNEL_NEW } from 'constants/claim';
import React, { useEffect, useState } from 'react';
import classnames from 'classnames';
import { FormField, Form } from 'component/common/form';
import Button from 'component/button';
import SelectChannel from 'component/selectChannel';
import ChannelSelection from 'component/selectChannel';
import usePersistedState from 'effects/use-persisted-state';
import { FF_MAX_CHARS_IN_COMMENT } from 'constants/form-field';
import { useHistory } from 'react-router';
import type { ElementRef } from 'react';
import emoji from 'emoji-dictionary';
const COMMENT_SLOW_MODE_SECONDS = 5;
const LIVESTREAM_EMOJIS = [
emoji.getUnicode('rocket'),
emoji.getUnicode('jeans'),
emoji.getUnicode('fire'),
emoji.getUnicode('heart'),
emoji.getUnicode('open_mouth'),
];
type Props = {
uri: string,
@@ -34,10 +25,7 @@ type Props = {
isReply: boolean,
isPostingComment: boolean,
activeChannel: string,
activeChannelClaim: ?ChannelClaim,
livestream?: boolean,
toast: (string) => void,
claimIsMine: boolean,
setCommentChannel: string => void,
};
export function CommentCreate(props: Props) {
@@ -52,20 +40,31 @@ export function CommentCreate(props: Props) {
isReply,
parentId,
isPostingComment,
activeChannelClaim,
livestream,
toast,
claimIsMine,
activeChannel,
setCommentChannel,
} = props;
const buttonref: ElementRef<any> = React.useRef();
const { push } = useHistory();
const { claim_id: claimId } = claim;
const [commentValue, setCommentValue] = React.useState('');
const [lastCommentTime, setLastCommentTime] = React.useState();
const [charCount, setCharCount] = useState(commentValue.length);
const [advancedEditor, setAdvancedEditor] = usePersistedState('comment-editor-mode', false);
const hasChannels = channels && channels.length;
const disabled = isPostingComment || !activeChannelClaim || !commentValue.length;
const disabled = isPostingComment || activeChannel === CHANNEL_NEW || !commentValue.length;
const topChannel =
channels &&
channels.reduce((top, channel) => {
const topClaimCount = (top && top.meta && top.meta.claims_in_channel) || 0;
const currentClaimCount = (activeChannel && channel.meta && channel.meta.claims_in_channel) || 0;
return topClaimCount >= currentClaimCount ? top : channel;
});
useEffect(() => {
// set default channel
if ((activeChannel === '' || activeChannel === 'anonymous') && topChannel) {
setCommentChannel(topChannel.name);
}
}, [activeChannel, topChannel, setCommentChannel]);
function handleCommentChange(event) {
let commentValue;
@@ -95,19 +94,8 @@ export function CommentCreate(props: Props) {
}
function handleSubmit() {
if (activeChannelClaim && commentValue.length) {
const timeUntilCanComment = !lastCommentTime
? 0
: lastCommentTime / 1000 - Date.now() / 1000 + COMMENT_SLOW_MODE_SECONDS;
if (livestream && !claimIsMine && timeUntilCanComment > 0) {
toast(
__('Slowmode is on. You can comment again in %time% seconds.', { time: Math.floor(timeUntilCanComment) })
);
return;
}
createComment(commentValue, claimId, parentId).then((res) => {
if (activeChannel !== CHANNEL_NEW && commentValue.length) {
createComment(commentValue, claimId, activeChannel, parentId).then(res => {
if (res && res.signature) {
setCommentValue('');
@@ -150,13 +138,13 @@ export function CommentCreate(props: Props) {
})}
>
<FormField
disabled={!activeChannelClaim}
disabled={activeChannel === CHANNEL_NEW}
type={SIMPLE_SITE ? 'textarea' : advancedEditor && !isReply ? 'markdown' : 'textarea'}
name={isReply ? 'content_reply' : 'content_description'}
label={
<span className="comment-new__label-wrapper">
<div className="comment-new__label">{isReply ? __('Replying as') + ' ' : __('Comment as') + ' '}</div>
<SelectChannel tiny />
<ChannelSelection channel={activeChannel} hideAnon tiny hideNew onChannelChange={setCommentChannel} />
</span>
}
quickActionLabel={
@@ -172,23 +160,6 @@ export function CommentCreate(props: Props) {
autoFocus={isReply}
textAreaMaxLength={FF_MAX_CHARS_IN_COMMENT}
/>
{livestream && hasChannels && (
<div className="livestream__emoji-actions">
{LIVESTREAM_EMOJIS.map((emoji) => (
<Button
key={emoji}
disabled={isPostingComment}
type="button"
button="alt"
className="button--emoji"
label={emoji}
onClick={() => {
setCommentValue(commentValue ? `${commentValue} ${emoji}` : emoji);
}}
/>
))}
</div>
)}
<div className="section__actions section__actions--no-margin">
<Button
ref={buttonref}
-29
View File
@@ -1,29 +0,0 @@
import { connect } from 'react-redux';
import { makeSelectChannelPermUrlForClaimUri, makeSelectClaimIsMine, makeSelectClaimForUri } from 'lbry-redux';
import { doCommentAbandon, doCommentPin, doCommentList, doCommentModBlock } from 'redux/actions/comments';
import { doToggleMuteChannel } from 'redux/actions/blocked';
// import { doSetActiveChannel } from 'redux/actions/app';
import { doSetPlayingUri } from 'redux/actions/content';
import { selectActiveChannelClaim } from 'redux/selectors/app';
import { selectPlayingUri } from 'redux/selectors/content';
import CommentMenuList from './view';
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
contentChannelPermanentUrl: makeSelectChannelPermUrlForClaimUri(props.uri)(state),
activeChannelClaim: selectActiveChannelClaim(state),
playingUri: selectPlayingUri(state),
});
const perform = (dispatch) => ({
clearPlayingUri: () => dispatch(doSetPlayingUri({ uri: null })),
deleteComment: (commentId, creatorChannelUrl) => dispatch(doCommentAbandon(commentId, creatorChannelUrl)),
blockChannel: (channelUri) => dispatch(doToggleMuteChannel(channelUri)),
pinComment: (commentId, remove) => dispatch(doCommentPin(commentId, remove)),
fetchComments: (uri) => dispatch(doCommentList(uri)),
// setActiveChannel: channelId => dispatch(doSetActiveChannel(channelId)),
commentModBlock: (commentAuthor) => dispatch(doCommentModBlock(commentAuthor)),
});
export default connect(select, perform)(CommentMenuList);
-143
View File
@@ -1,143 +0,0 @@
// @flow
import * as ICONS from 'constants/icons';
import React from 'react';
import { MenuList, MenuItem } from '@reach/menu-button';
import ChannelThumbnail from 'component/channelThumbnail';
import Icon from 'component/common/icon';
type Props = {
uri: string,
clearPlayingUri: () => void,
authorUri: string, // full LBRY Channel URI: lbry://@channel#123...
commentId: string, // sha256 digest identifying the comment
claimIsMine: boolean, // if you control the claim which this comment was posted on
commentIsMine: boolean, // if this comment was signed by an owned channel
deleteComment: (string, ?string) => void,
linkedComment?: any,
isPinned: boolean,
pinComment: (string, boolean) => Promise<any>,
blockChannel: (string) => void,
fetchComments: (string) => void,
handleEditComment: () => void,
contentChannelPermanentUrl: any,
activeChannelClaim: ?ChannelClaim,
claimIsMine: boolean,
isTopLevel: boolean,
commentModBlock: (string) => void,
playingUri: ?PlayingUri,
};
function CommentMenuList(props: Props) {
const {
uri,
authorUri,
commentIsMine,
commentId,
deleteComment,
blockChannel,
pinComment,
claimIsMine,
clearPlayingUri,
activeChannelClaim,
contentChannelPermanentUrl,
isTopLevel,
isPinned,
handleEditComment,
fetchComments,
commentModBlock,
playingUri,
} = props;
const activeChannelIsCreator = activeChannelClaim && activeChannelClaim.permanent_url === contentChannelPermanentUrl;
function handlePinComment(commentId, remove) {
pinComment(commentId, remove).then(() => fetchComments(uri));
}
function handleDeleteComment() {
if (playingUri && playingUri.source === 'comment') {
clearPlayingUri();
}
deleteComment(commentId, commentIsMine ? undefined : contentChannelPermanentUrl);
}
function handleCommentBlock() {
if (claimIsMine) {
commentModBlock(authorUri);
}
}
function handleCommentMute() {
blockChannel(authorUri);
}
return (
<MenuList className="menu__list">
{activeChannelIsCreator && <div className="comment__menu-title">{__('Creator tools')}</div>}
{activeChannelIsCreator && isTopLevel && (
<MenuItem
className="comment__menu-option menu__link"
onSelect={isPinned ? () => handlePinComment(commentId, true) : () => handlePinComment(commentId, false)}
>
<span className={'button__content'}>
<Icon aria-hidden icon={ICONS.PIN} className={'icon'} />
{isPinned ? __('Unpin') : __('Pin')}
</span>
</MenuItem>
)}
{activeChannelClaim &&
(activeChannelClaim.permanent_url === authorUri ||
activeChannelClaim.permanent_url === contentChannelPermanentUrl) && (
<MenuItem className="comment__menu-option" onSelect={handleDeleteComment}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.DELETE} />
{__('Remove')}
</div>
</MenuItem>
)}
{commentIsMine && activeChannelClaim && activeChannelClaim.permanent_url === authorUri && (
<MenuItem className="comment__menu-option menu__link" onSelect={handleEditComment}>
<Icon aria-hidden icon={ICONS.EDIT} />
{__('Edit')}
</MenuItem>
)}
{!commentIsMine && (
<MenuItem className="comment__menu-option" onSelect={handleCommentBlock}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.BLOCK} />
{__('Block')}
</div>
{activeChannelIsCreator && (
<span className="comment__menu-help">{__('Prevent this channel from interacting with you.')}</span>
)}
</MenuItem>
)}
{!commentIsMine && (
<MenuItem className="comment__menu-option" onSelect={handleCommentMute}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.MUTE} />
{__('Mute')}
</div>
{activeChannelIsCreator && (
<span className="comment__menu-help">{__('Hide this channel for you only.')}</span>
)}
</MenuItem>
)}
{activeChannelClaim && (
<div className="comment__menu-active">
<ChannelThumbnail uri={activeChannelClaim.permanent_url} />
<div className="comment__menu-channel">
{__('Interacting as %channelName%', { channelName: activeChannelClaim.name })}
</div>
</div>
)}
</MenuList>
);
}
export default CommentMenuList;
+6 -3
View File
@@ -2,16 +2,19 @@ import { connect } from 'react-redux';
import Comment from './view';
import { makeSelectClaimIsMine, makeSelectClaimForUri } from 'lbry-redux';
import { doToast } from 'redux/actions/notifications';
import { makeSelectMyReactionsForComment, makeSelectOthersReactionsForComment } from 'redux/selectors/comments';
import {
makeSelectMyReactionsForComment,
makeSelectOthersReactionsForComment,
selectCommentChannel,
} from 'redux/selectors/comments';
import { doCommentReact } from 'redux/actions/comments';
import { selectActiveChannelId } from 'redux/selectors/app';
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
myReacts: makeSelectMyReactionsForComment(props.commentId)(state),
othersReacts: makeSelectOthersReactionsForComment(props.commentId)(state),
activeChannelId: selectActiveChannelId(state),
activeChannel: selectCommentChannel(state),
});
const perform = dispatch => ({
+8 -8
View File
@@ -16,13 +16,13 @@ type Props = {
commentId: string,
pendingCommentReacts: Array<string>,
claimIsMine: boolean,
activeChannelId: ?string,
activeChannel: string,
claim: ?ChannelClaim,
doToast: ({ message: string }) => void,
};
export default function CommentReactions(props: Props) {
const { myReacts, othersReacts, commentId, react, claimIsMine, claim, activeChannelId, doToast } = props;
const { myReacts, othersReacts, commentId, react, claimIsMine, claim, activeChannel, doToast } = props;
const {
push,
location: { pathname },
@@ -31,14 +31,14 @@ export default function CommentReactions(props: Props) {
claim &&
claimIsMine &&
(claim.value_type === 'channel'
? claim.claim_id === activeChannelId
: claim.signing_channel && claim.signing_channel.claim_id === activeChannelId);
? claim.name === activeChannel
: claim.signing_channel && claim.signing_channel.name === activeChannel);
const authorUri =
claim && claim.value_type === 'channel'
? claim.canonical_url
: claim && claim.signing_channel && claim.signing_channel.canonical_url;
const getCountForReact = (type) => {
const getCountForReact = type => {
let count = 0;
if (othersReacts && othersReacts[type]) {
count += othersReacts[type];
@@ -52,7 +52,7 @@ export default function CommentReactions(props: Props) {
const creatorLiked = getCountForReact(REACTION_TYPES.CREATOR_LIKE) > 0;
function handleCommentLike() {
if (activeChannelId) {
if (activeChannel) {
react(commentId, REACTION_TYPES.LIKE);
} else {
promptForChannel();
@@ -60,7 +60,7 @@ export default function CommentReactions(props: Props) {
}
function handleCommentDislike() {
if (activeChannelId) {
if (activeChannel) {
react(commentId, REACTION_TYPES.DISLIKE);
} else {
promptForChannel();
@@ -105,7 +105,7 @@ export default function CommentReactions(props: Props) {
className={classnames('comment__action comment__action--creator-like')}
onClick={() => react(commentId, REACTION_TYPES.CREATOR_LIKE)}
>
{creatorLiked && <ChannelThumbnail uri={authorUri} hideStakedIndicator className="comment__creator-like" />}
{creatorLiked && <ChannelThumbnail uri={authorUri} className="comment__creator-like" />}
</Button>
)}
</>
+2 -2
View File
@@ -5,10 +5,10 @@ import {
selectIsFetchingComments,
makeSelectTotalCommentsCountForUri,
selectOthersReactsById,
selectCommentChannel,
} from 'redux/selectors/comments';
import { doCommentList, doCommentReactList } from 'redux/actions/comments';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
import { selectActiveChannelId } from 'redux/selectors/app';
import CommentsList from './view';
const select = (state, props) => ({
@@ -20,7 +20,7 @@ const select = (state, props) => ({
commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true,
fetchingChannels: selectFetchingMyChannels(state),
reactionsById: selectOthersReactsById(state),
activeChannelId: selectActiveChannelId(state),
activeChannel: selectCommentChannel(state),
});
const perform = dispatch => ({
+3 -3
View File
@@ -26,7 +26,7 @@ type Props = {
totalComments: number,
fetchingChannels: boolean,
reactionsById: ?{ [string]: { [REACTION_TYPES.LIKE | REACTION_TYPES.DISLIKE]: number } },
activeChannelId: ?string,
activeChannel: string,
};
function CommentList(props: Props) {
@@ -42,7 +42,7 @@ function CommentList(props: Props) {
totalComments,
fetchingChannels,
reactionsById,
activeChannelId,
activeChannel,
} = props;
const commentRef = React.useRef();
const spinnerRef = React.useRef();
@@ -90,7 +90,7 @@ function CommentList(props: Props) {
})
.catch(() => setReadyToDisplayComments(true));
}
}, [fetchReacts, uri, totalComments, activeChannelId, fetchingChannels]);
}, [fetchReacts, uri, totalComments, activeChannel, fetchingChannels]);
useEffect(() => {
if (readyToDisplayComments && linkedCommentId && commentRef && commentRef.current) {
@@ -18,7 +18,7 @@ type Props = {
error?: string | boolean,
helper?: string | React$Node,
type?: string,
onChange?: (any) => any,
onChange?: any => any,
defaultValue?: string | number,
placeholder?: string | number,
children?: React$Node,
@@ -37,7 +37,7 @@ type Props = {
min?: number,
max?: number,
quickActionLabel?: string,
quickActionHandler?: (any) => any,
quickActionHandler?: any => any,
};
export class FormField extends React.PureComponent<Props> {
@@ -147,7 +147,7 @@ export class FormField extends React.PureComponent<Props> {
contextmenu: openEditorMenu,
};
const getInstance = (editor) => {
const getInstance = editor => {
// SimpleMDE max char check
editor.codemirror.on('beforeChange', (instance, changes) => {
if (textAreaMaxLength && changes.update) {
@@ -163,44 +163,6 @@ export class FormField extends React.PureComponent<Props> {
}
}
});
// "Create Link (Ctrl-K)": highlight URL instead of label:
editor.codemirror.on('changes', (instance, changes) => {
try {
// Grab the last change from the buffered list. I assume the
// buffered one ('changes', instead of 'change') is more efficient,
// and that "Create Link" will always end up last in the list.
const lastChange = changes[changes.length - 1];
if (lastChange.origin === '+input') {
// https://github.com/Ionaru/easy-markdown-editor/blob/8fa54c496f98621d5f45f57577ce630bee8c41ee/src/js/easymde.js#L765
const EASYMDE_URL_PLACEHOLDER = '(https://)';
// The URL placeholder is always placed last, so just look at the
// last text in the array to also cover the multi-line case:
const urlLineText = lastChange.text[lastChange.text.length - 1];
if (urlLineText.endsWith(EASYMDE_URL_PLACEHOLDER) && urlLineText !== '[]' + EASYMDE_URL_PLACEHOLDER) {
const from = lastChange.from;
const to = lastChange.to;
const isSelectionMultiline = lastChange.text.length > 1;
const baseIndex = isSelectionMultiline ? 0 : from.ch;
// Everything works fine for the [Ctrl-K] case, but for the
// [Button] case, this handler happens before the original
// code, thus our change got wiped out.
// Add a small delay to handle that case.
setTimeout(() => {
instance.setSelection(
{ line: to.line, ch: baseIndex + urlLineText.lastIndexOf('(') + 1 },
{ line: to.line, ch: baseIndex + urlLineText.lastIndexOf(')') }
);
}, 25);
}
}
} catch (err) {
// Do nothing (revert to original behavior)
}
});
};
// Ideally, the character count should (and can) be appended to the
+3 -664
View File
@@ -2,6 +2,7 @@
// A housing for all of our icons. Mostly taken from https://github.com/feathericons/react-feather
import * as ICONS from 'constants/icons';
import React, { forwardRef } from 'react';
// $FlowFixMe
import { v4 as uuid } from 'uuid';
type IconProps = {
@@ -11,7 +12,6 @@ type IconProps = {
type CustomProps = {
size?: number,
className?: string,
};
// Returns a react component
@@ -41,7 +41,7 @@ const buildIcon = (iconStrokes: React$Node, customSvgValues = {}) =>
export const icons = {
// The LBRY icon is different from the base icon set so don't use buildIcon()
[ICONS.LBRY]: (props: IconProps) => (
[ICONS.LBRY]: () => (
<svg stroke="currentColor" fill="currentColor" x="0px" y="0px" viewBox="0 0 322 254" className="icon lbry-icon">
<path d="M296,85.9V100l-138.8,85.3L52.6,134l0.2-7.9l104,51.2L289,96.1v-5.8L164.2,30.1L25,116.2v38.5l131.8,65.2 l137.6-84.4l3.9,6l-141.1,86.4L18.1,159.1v-46.8l145.8-90.2C163.9,22.1,296,85.9,296,85.9z" />
<path d="M294.3,150.9l2-12.6l-12.2-2.1l0.8-4.9l17.1,2.9l-2.8,17.5L294.3,150.9L294.3,150.9z" />
@@ -238,13 +238,6 @@ export const icons = {
<circle cx="12" cy="12" r="10" />
</g>
),
[ICONS.MUTE]: buildIcon(
<g>
<polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5" />
<line x1="23" y1="9" x2="17" y2="15" />
<line x1="17" y1="9" x2="23" y2="15" />
</g>
),
[ICONS.LIGHT]: buildIcon(
<g>
<circle cx="12" cy="12" r="5" />
@@ -835,219 +828,6 @@ export const icons = {
<polygon points="9.75 15.02 15.5 11.75 9.75 8.48 9.75 15.02" />
</g>
),
[ICONS.SCIENCE]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="-3 0 24 24"
width={props.size || '16'}
height={props.size || '18'}
fill="none"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M0.767018182,20.022 C0.300109091,20.6874545 0.243381818,21.558 0.618654545,22.2801818 C0.995018182,23.0012727 1.7412,23.454 2.55501818,23.454 L14.8997455,23.454 C15.7135636,23.454 16.4597455,23.0012727 16.8350182,22.2801818 C17.2113818,21.558 17.1535636,20.6874545 16.6877455,20.022 L11.4546545,11.454 L11.4546545,2.72672727 L6.00010909,2.72672727 L6.00010909,11.454 L0.767018182,20.022 L0.767018182,20.022 Z" />
<path d="M13.6363636,1.63636364 C13.6363636,2.23963636 13.1487273,2.72727273 12.5454545,2.72727273 L4.90909091,2.72727273 C4.30581818,2.72727273 3.81818182,2.23963636 3.81818182,1.63636364 C3.81818182,1.03309091 4.30581818,0.545454545 4.90909091,0.545454545 L12.5454545,0.545454545 C13.1487273,0.545454545 13.6363636,1.03309091 13.6363636,1.63636364 L13.6363636,1.63636364 Z" />
<line x1="11.4545455" y1="4.90909091" x2="9.27272727" y2="4.90909091" id="Stroke-8219" strokeLinecap="round" />
<line x1="11.4545455" y1="9.27272727" x2="9.27272727" y2="9.27272727" id="Stroke-8220" strokeLinecap="round" />
<line x1="11.4545455" y1="7.09090909" x2="8.18181818" y2="7.09090909" id="Stroke-8221" strokeLinecap="round" />
<line x1="3.27272727" y1="15.8181818" x2="14.1818182" y2="15.8181818" id="Stroke-8222" />
<path
d="M13.0909091,21.2727273 C13.0909091,21.5738182 12.8465455,21.8181818 12.5454545,21.8181818 C12.2443636,21.8181818 12,21.5738182 12,21.2727273 C12,20.9716364 12.2443636,20.7272727 12.5454545,20.7272727 C12.8465455,20.7272727 13.0909091,20.9716364 13.0909091,21.2727273 L13.0909091,21.2727273 Z"
id="Stroke-8223"
strokeLinecap="round"
/>
<path
d="M10.3636364,18.2727273 C10.3636364,18.4232727 10.2414545,18.5454545 10.0909091,18.5454545 C9.94036364,18.5454545 9.81818182,18.4232727 9.81818182,18.2727273 C9.81818182,18.1221818 9.94036364,18 10.0909091,18 C10.2414545,18 10.3636364,18.1221818 10.3636364,18.2727273 L10.3636364,18.2727273 Z"
id="Stroke-8224"
strokeLinecap="round"
/>
<path
d="M7.63636364,19.6363636 C7.63636364,20.5396364 6.90327273,21.2727273 6,21.2727273 C5.09672727,21.2727273 4.36363636,20.5396364 4.36363636,19.6363636 C4.36363636,18.7330909 5.09672727,18 6,18 C6.90327273,18 7.63636364,18.7330909 7.63636364,19.6363636 L7.63636364,19.6363636 Z"
id="Stroke-8225"
strokeLinecap="round"
/>
</svg>
),
[ICONS.TECH]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="-5 0 24 24"
width={props.size || '16'}
height={props.size || '18'}
fill="none"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
>
<path
d="M13.5005,21.5 C13.5005,22.604 12.6055,23.5 11.5005,23.5 L2.5005,23.5 C1.3955,23.5 0.5005,22.604 0.5005,21.5 L0.5005,2.5 C0.5005,1.396 1.3955,0.5 2.5005,0.5 L11.5005,0.5 C12.6055,0.5 13.5005,1.396 13.5005,2.5 L13.5005,21.5 L13.5005,21.5 Z"
id="Stroke-5155"
strokeLinecap="round"
/>
<line x1="13.5005" y1="19.5" x2="0.5005" y2="19.5" id="Stroke-5156" strokeLinecap="round" />
<line x1="13.5005" y1="4.5" x2="0.5005" y2="4.5" id="Stroke-5157" strokeLinecap="round" />
<line x1="4.5005" y1="2.5" x2="9.5005" y2="2.5" id="Stroke-5158" strokeLinecap="round" />
<path
d="M7.0005,22 C6.7245,22 6.5005,21.776 6.5005,21.5 C6.5005,21.224 6.7245,21 7.0005,21 C7.2765,21 7.5005,21.224 7.5005,21.5 C7.5005,21.776 7.2765,22 7.0005,22 L7.0005,22 Z"
id="Stroke-5159"
/>
</svg>
),
[ICONS.NEWS]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width={props.size || '16'}
height={props.size || '18'}
fill="none"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
>
<line x1="3.5" y1="3.5" x2="14.5" y2="3.5" id="Stroke-6102" />
<polygon id="Stroke-6103" points="3.5 12.5 8.5 12.5 8.5 6.5 3.5 6.5" />
<line x1="11.5" y1="8.5" x2="14.5" y2="8.5" id="Stroke-6104" />
<line x1="10.5" y1="10.5" x2="14.5" y2="10.5" id="Stroke-6105" />
<line x1="10.5" y1="12.5" x2="14.5" y2="12.5" id="Stroke-6106" />
<line x1="3.5" y1="14.5" x2="14.5" y2="14.5" id="Stroke-6107" />
<line x1="3.5" y1="16.5" x2="14.5" y2="16.5" id="Stroke-6108" />
<line x1="3.5" y1="18.5" x2="14.5" y2="18.5" id="Stroke-6109" />
<path
d="M19.5,5.5 L21.5,5.5 L21.5,20.5 C21.5,21.052 21.053,21.5 20.5,21.5 C19.948,21.5 19.5,21.052 19.5,20.5 L19.5,2 L17.5,2 L17.5,4"
id="Stroke-6110"
/>
<path
d="M20.5,23.5 L3.5,23.5 C1.844,23.5 0.5,22.157 0.5,20.5 L0.5,0.5 L17.5,0.5 L17.5,20.5 C17.5,22.157 18.844,23.5 20.5,23.5 C22.157,23.5 23.5,22.157 23.5,20.5 L23.5,3.5 L19.5,3.5"
id="Stroke-6111"
/>
</svg>
),
[ICONS.FINANCE]: buildIcon(
<g>
<line x1="12" y1="1" x2="12" y2="23" />
<path d="M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6" />
</g>
),
[ICONS.RABBIT_HOLE]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width={props.size || '16'}
height={props.size || '18'}
fill="none"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
>
<polygon id="Stroke-7926" points="0.5 22.5205 12 0.5205 23.5 22.5205" />
<path
d="M14,15.5205 C14,16.6245 13.104,17.5205 12,17.5205 C10.896,17.5205 10,16.6245 10,15.5205 C10,14.4155 10.896,13.5205 12,13.5205 C13.104,13.5205 14,14.4155 14,15.5205 L14,15.5205 Z"
id="Stroke-7927"
/>
<path
d="M18.666,15.5205 C18.666,15.5205 16.666,19.5205 12,19.5205 C7.334,19.5205 5.334,15.5205 5.334,15.5205 C5.334,15.5205 7.334,11.5205 12,11.5205 C16.666,11.5205 18.666,15.5205 18.666,15.5205 L18.666,15.5205 Z"
id="Stroke-7928"
/>
</svg>
),
[ICONS.ENLIGHTENMENT]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="-1 0 24 24"
width={props.size || '16'}
height={props.size || '18'}
fill="none"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
>
<path
d="M8.9258,14.3311 C2.4228,14.3311 3.0138,8.4191 3.0138,8.4191 C10.1078,8.4191 8.9258,14.3311 8.9258,14.3311 L8.9258,14.3311 Z"
id="Stroke-5653"
/>
<path
d="M13.0732,14.3311 C19.5762,14.3311 18.9852,8.4191 18.9852,8.4191 C11.8912,8.4191 13.0732,14.3311 13.0732,14.3311 L13.0732,14.3311 Z"
id="Stroke-5654"
/>
<path
d="M21.4995,10 C21.4995,16.352 13.9995,23 10.9995,23 C7.9995,23 0.4995,16.352 0.4995,10 C0.4995,3.648 4.6475,0.5 10.9995,0.5 C17.3505,0.5 21.4995,3.648 21.4995,10 L21.4995,10 Z"
id="Stroke-5655"
/>
</svg>
),
[ICONS.GAMING]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="-2 -1 24 26"
width={props.size || '18'}
height={props.size || '16'}
fill="none"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
>
<g>
<path
d="M17.5,9 C17.5,4.307 13.694,0.5 9,0.5 C4.306,0.5 0.5,4.307 0.5,9 L0.5,22.5 C0.5,23.051 0.95,23.5 1.5,23.5 L2,23.5 C2.551,23.5 3,23.051 3,22.5 C3,21.951 3.45,21.5 4,21.5 C4.551,21.5 5,21.951 5,22.5 C5,23.051 5.45,23.5 6,23.5 L7,23.5 C7.551,23.5 8,23.051 8,22.5 C8,21.951 8.45,21.5 9,21.5 C9.551,21.5 10,21.951 10,22.5 C10,23.051 10.45,23.5 11,23.5 L12,23.5 C12.551,23.5 13,23.051 13,22.5 C13,21.951 13.45,21.5 14,21.5 C14.551,21.5 15,21.951 15,22.5 C15,23.051 15.45,23.5 16,23.5 L16.5,23.5 C17.051,23.5 17.5,23.051 17.5,22.5 L17.5,9 L17.5,9 Z"
id="Stroke-939"
/>
<path
d="M13.5,12 C13.5,12.826 12.825,13.5 12,13.5 C11.176,13.5 10.5,12.826 10.5,12 L10.5,9 C10.5,8.176 11.176,7.5 12,7.5 C12.825,7.5 13.5,8.176 13.5,9 L13.5,12 L13.5,12 Z"
id="Stroke-940"
/>
<path
d="M11.5,11 C11.5,11.277 11.276,11.5 11,11.5 C10.724,11.5 10.5,11.277 10.5,11 C10.5,10.725 10.724,10.5 11,10.5 C11.276,10.5 11.5,10.725 11.5,11 L11.5,11 Z"
id="Stroke-941"
/>
<path
d="M7.5,12 C7.5,12.826 6.825,13.5 6,13.5 C5.176,13.5 4.5,12.826 4.5,12 L4.5,9 C4.5,8.176 5.176,7.5 6,7.5 C6.825,7.5 7.5,8.176 7.5,9 L7.5,12 L7.5,12 Z"
id="Stroke-942"
/>
<path
d="M5.5,11 C5.5,11.277 5.276,11.5 5,11.5 C4.724,11.5 4.5,11.277 4.5,11 C4.5,10.725 4.724,10.5 5,10.5 C5.276,10.5 5.5,10.725 5.5,11 L5.5,11 Z"
id="Stroke-943"
/>
</g>
</svg>
),
[ICONS.COMMUNITY]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="-2 -1 24 26"
width={props.size || '18'}
height={props.size || '18'}
fill="none"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
>
<g>
<path
d="M0.5,5 L0.5,8 C0.5,12.694 3.806,16.5 8.5,16.5 C13.194,16.5 16.5,12.694 16.5,8 L16.5,5"
id="Stroke-8485"
/>
<path
d="M12,0.5 C14.485,0.5 16.5,2.515 16.5,5 C16.5,7.485 14.485,9.5 12,9.5 L5,9.5 C2.515,9.5 0.5,7.485 0.5,5 C0.5,2.515 2.515,0.5 5,0.5 L12,0.5 L12,0.5 Z"
id="Stroke-8486"
/>
<path d="M5.1758,15.7891 C6.0938,12.1251 8.6878,10.1561 11.9998,9.5001" id="Stroke-8487" />
<path d="M7.25,9.5 C5.316,9.5 3.75,7.934 3.75,6 C3.75,4.066 5.316,2.5 7.25,2.5 L10.5,2.5" id="Stroke-8488" />
<path d="M10,0.5 C11.934,0.5 13.5,2.066 13.5,4 C13.5,5.934 11.934,7.5 10,7.5 L7,7.5" id="Stroke-8489" />
<line x1="8.5" y1="16.5" x2="8.5" y2="23.5" id="Stroke-8490" />
<line x1="8.5" y1="19.5" x2="11" y2="19.5" id="Stroke-8491" />
<line x1="8.5" y1="22.5" x2="6" y2="22.5" id="Stroke-8492" />
<path d="M9.5,5 C8.119,5 7,6.119 7,7.5" id="Stroke-8493" />
</g>
</svg>
),
[ICONS.UPVOTE]: buildIcon(
<path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3" />
),
@@ -1222,7 +1002,7 @@ export const icons = {
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 26 24"
viewBox="-6 0 26 24"
width={props.size || '18'}
height={props.size || '18'}
fill="none"
@@ -1235,445 +1015,4 @@ export const icons = {
<path d="m 18.089706,2.6673324 c -0.458672,0 -0.914415,0.081053 -1.342833,0.2381801 -0.726068,-1.5175206 -2.625165,-2.67785413 -4.515474,-2.67785413 -1.902023,0 -3.8128297,1.16033353 -4.5408481,2.67785413 C 7.2621303,2.7483855 6.8063878,2.6673324 6.348691,2.6673324 c -2.1528256,0 -3.9045598,1.7507491 -3.9045598,3.9035835 0,2.0230385 1.4648199,3.6410591 3.4146614,3.8752841 v 8.262918 h 2.9276892 v -3.415632 c 0.00968,-0.26944 0.2273915,-0.487951 0.4977084,-0.487951 0.2693563,0 0.4879486,0.218539 0.4879486,0.487951 v 3.415632 h 1.9420352 v -4.391535 c 0,-0.269439 0.217626,-0.487951 0.487948,-0.487951 0.269357,0 0.487946,0.218539 0.487946,0.487951 v 4.391535 h 1.951795 v -3.415632 c 0.01964,-0.26944 0.238125,-0.487951 0.507465,-0.487951 0.270325,0 0.487949,0.218539 0.468432,0.487951 v 3.415632 h 2.927689 V 10.4462 c 1.980095,-0.234307 3.445891,-1.8522456 3.445891,-3.8752841 0,-2.1528344 -1.750758,-3.9035835 -3.901634,-3.9035835" />
</svg>
),
[ICONS.ANONYMOUS]: buildIcon(
<g>
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" />
</g>
),
[ICONS.LIVESTREAM]: buildIcon(
<g>
<polygon points="23 7 16 12 23 17 23 7" />
<rect x="1" y="5" width="15" height="14" rx="2" ry="2" />
</g>
),
[ICONS.CHANNEL_LEVEL_1]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 26 24"
width={props.size || '18'}
height={props.size || '18'}
fill="currentColor"
stroke="currentColor"
strokeWidth="0"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M12 4.32001L14.025 8.02501C14.4776 8.85522 15.1598 9.53744 15.99 9.99001L19.68 12L15.975 14.025C15.1448 14.4776 14.4626 15.1598 14.01 15.99L12 19.68L9.97501 15.975C9.52419 15.1524 8.84761 14.4758 8.02501 14.025L4.32001 12L8.02501 9.97501C8.84761 9.52419 9.52419 8.84761 9.97501 8.02501L12 4.32001Z" />
</svg>
),
[ICONS.CHANNEL_LEVEL_2]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 26 24"
width={props.size || '18'}
height={props.size || '18'}
fill="currentColor"
stroke="currentColor"
strokeWidth="0"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M15.705 7.31999L17.625 10.845C18.0591 11.6316 18.7099 12.2772 19.5 12.705L23.025 14.625L19.5 16.5C18.7154 16.9301 18.0701 17.5754 17.64 18.36L15.72 21.885L13.785 18.435C13.3625 17.6207 12.7106 16.9479 11.91 16.5L8.38499 14.64L11.91 12.705C12.7001 12.2772 13.3508 11.6316 13.785 10.845L15.705 7.31999ZM4.37999 4.31999C4.10558 4.81954 3.69454 5.23058 3.19499 5.50499L0.974991 6.67499L3.19499 7.88999C3.68451 8.14404 4.09453 8.5281 4.37999 8.99999L5.59499 11.22L6.80999 8.99999C7.0844 8.50045 7.49544 8.08941 7.99499 7.81499L10.215 6.59999L7.99499 5.44499C7.49544 5.17058 7.0844 4.75954 6.80999 4.25999L5.59499 2.05499L4.37999 4.31999Z" />
</svg>
),
[ICONS.CHANNEL_LEVEL_3]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width={props.size || '18'}
height={props.size || '18'}
fill="currentColor"
stroke="currentColor"
strokeWidth="0"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M12 7.95L13.92 11.475C14.3519 12.2672 15.0028 12.9181 15.795 13.35L19.32 15.27L15.795 17.19C15.0104 17.6201 14.3651 18.2654 13.935 19.05L12 22.59L10.08 19.065C9.64989 18.2804 9.00456 17.6351 8.22 17.205L4.68 15.27L8.205 13.35C8.99718 12.9181 9.64814 12.2672 10.08 11.475L12 7.95ZM3.57 3.705C3.29213 4.2198 2.8698 4.64213 2.355 4.92L0 6.18L2.34 7.5C2.8548 7.77788 3.27713 8.2002 3.555 8.715L4.815 10.95L6.075 8.655C6.36202 8.16237 6.78348 7.76173 7.29 7.5L9.585 6.24L7.29 4.92C6.7752 4.64213 6.35287 4.2198 6.075 3.705L4.815 1.41L3.57 3.705ZM17.625 3.825C17.3305 4.36309 16.8881 4.80555 16.35 5.1L13.935 6.42L16.35 7.74C16.8881 8.03446 17.3305 8.47692 17.625 9.015L18.945 11.43L20.265 9C20.5595 8.46191 21.0019 8.01946 21.54 7.725L24 6.42L21.54 5.1C21.0019 4.80555 20.5595 4.36309 20.265 3.825L18.945 1.41L17.625 3.825Z" />
</svg>
),
[ICONS.CHANNEL_LEVEL_4]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width={props.size || '18'}
height={props.size || '18'}
fill="currentColor"
stroke="currentColor"
strokeWidth="0"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M4.5 6.375L5.64 8.46C5.89614 8.92861 6.28139 9.31386 6.75 9.57L8.835 10.71L6.75 11.85C6.28139 12.1061 5.89614 12.4914 5.64 12.96L4.5 15L3.285 12.96C3.02886 12.4914 2.64361 12.1061 2.175 11.85L0.0899963 10.71L2.175 9.57C2.64361 9.31386 3.02886 8.92861 3.285 8.46L4.5 6.375ZM17.67 10.125C17.3718 10.6692 16.9242 11.1168 16.38 11.415L13.875 12.75L16.32 14.085C16.8642 14.3832 17.3118 14.8308 17.61 15.375L18.945 17.82L20.28 15.375C20.5782 14.8308 21.0258 14.3832 21.57 14.085L24 12.75L21.555 11.415C21.0108 11.1168 20.5632 10.6692 20.265 10.125L18.93 7.68L17.67 10.125ZM8.49 21C8.93984 21.2454 9.30955 21.6152 9.555 22.065L10.65 24L11.745 21.99C11.9975 21.5699 12.3608 21.2274 12.795 21L14.805 19.905L12.795 18.75C12.3451 18.5046 11.9754 18.1348 11.73 17.685L10.65 15.69L9.555 17.7C9.30955 18.1498 8.93984 18.5196 8.49 18.765L6.48 19.86L8.49 21ZM12.9 4.68C13.2986 4.8985 13.6265 5.22638 13.845 5.625L14.82 7.41L15.795 5.625C16.0135 5.22638 16.3414 4.8985 16.74 4.68L18.525 3.705L16.74 2.73C16.3414 2.5115 16.0135 2.18362 15.795 1.785L14.82 0L13.845 1.785C13.6265 2.18362 13.2986 2.5115 12.9 2.73L11.115 3.705L12.9 4.68Z" />
</svg>
),
[ICONS.CHANNEL_LEVEL_5]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width={props.size || '18'}
height={props.size || '18'}
fill="currentColor"
stroke="currentColor"
strokeWidth="0"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M12 4.89L13.875 8.31C14.291 9.07838 14.9216 9.70903 15.69 10.125L19.11 12L15.69 13.875C14.9216 14.291 14.291 14.9216 13.875 15.69L12 19.11L10.125 15.69C9.70903 14.9216 9.07838 14.291 8.31 13.875L4.89 12L8.31 10.125C9.07838 9.70903 9.70903 9.07838 10.125 8.31L12 4.89ZM3 1.89C2.76692 2.36024 2.3952 2.74767 1.935 3L0 4.005L1.935 5.055C2.38429 5.28744 2.75483 5.64753 3 6.09L4.05 8.025L5.1 6.09C5.33543 5.65943 5.68943 5.30543 6.12 5.07L8.055 4.02L6.09 3C5.65943 2.76457 5.30543 2.41057 5.07 1.98L4.005 0L3 1.89ZM18.975 1.89C18.7396 2.32057 18.3856 2.67457 17.955 2.91L16.02 3.96L17.955 5.01C18.3856 5.24543 18.7396 5.59943 18.975 6.03L20.025 7.965L21 6.09C21.2354 5.65943 21.5894 5.30543 22.02 5.07L24 4.005L22.065 3C21.6114 2.75957 21.2404 2.38858 21 1.935L19.995 0L18.975 1.89ZM3 17.91C2.76457 18.3406 2.41057 18.6946 1.98 18.93L0 19.995L1.935 21.045C2.36557 21.2804 2.71957 21.6344 2.955 22.065L4.005 24L5.055 22.065C5.28744 21.6157 5.64753 21.2452 6.09 21L8.025 19.95L6.09 18.9C5.65943 18.6646 5.30543 18.3106 5.07 17.88L4.02 15.945L3 17.91ZM18.975 17.91C18.7396 18.3406 18.3856 18.6946 17.955 18.93L16.02 19.98L17.955 21.03C18.3856 21.2654 18.7396 21.6194 18.975 22.05L20.025 23.985L21.075 22.05C21.3104 21.6194 21.6644 21.2654 22.095 21.03L24.03 19.98L22.095 18.93C21.6644 18.6946 21.3104 18.3406 21.075 17.91L20.025 15.975L18.975 17.91Z" />
</svg>
),
[ICONS.WILD_WEST]: buildIcon(
<g transform="matrix(1,0,0,1,0,0)">
<path
d="M12.546,23.25H11.454A10.7,10.7,0,0,1,2.161,7.235L3.75,4.453V2.25A1.5,1.5,0,0,1,5.25.75h3a1.5,1.5,0,0,1,1.5,1.5v3a2.988,2.988,0,0,1-.4,1.488L7.37,10.211a4.7,4.7,0,0,0,4.084,7.039h1.092a4.7,4.7,0,0,0,4.084-7.039L14.646,6.738a2.988,2.988,0,0,1-.4-1.488v-3a1.5,1.5,0,0,1,1.5-1.5h3a1.5,1.5,0,0,1,1.5,1.5v2.2l1.589,2.782A10.7,10.7,0,0,1,12.546,23.25Z"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M12,19.875a.375.375,0,0,1,.375.375"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M11.625,20.25A.375.375,0,0,1,12,19.875"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M12,20.625a.375.375,0,0,1-.375-.375"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M12.375,20.25a.375.375,0,0,1-.375.375"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M17.813,17.313a.375.375,0,0,1,.529-.024"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M17.836,17.843a.376.376,0,0,1-.023-.53"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M18.366,17.819a.375.375,0,0,1-.53.024"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M18.342,17.289a.375.375,0,0,1,.024.53"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M19.843,11.294a.376.376,0,0,1,.34-.407"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M20.25,11.634a.375.375,0,0,1-.407-.34"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M20.59,11.227a.374.374,0,0,1-.34.407"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M20.183,10.887a.375.375,0,0,1,.407.34"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M6.187,17.313a.375.375,0,0,0-.529-.024"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M6.164,17.843a.376.376,0,0,0,.023-.53"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M5.634,17.819a.375.375,0,0,0,.53.024"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M5.658,17.289a.375.375,0,0,0-.024.53"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M4.157,11.294a.376.376,0,0,0-.34-.407"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M3.75,11.634a.375.375,0,0,0,.407-.34"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M3.41,11.227a.374.374,0,0,0,.34.407"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path
d="M3.817,10.887a.375.375,0,0,0-.407.34"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
<path d="M20.25 4.5L18 4.5" fill="none" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1.5" />
<path d="M6 4.5L3.75 4.5" fill="none" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1.5" />
</g>
),
[ICONS.PEACE]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width={props.size || '18'}
height={props.size || '16'}
fill="none"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
>
<g transform="matrix(1,0,0,1,0,0)">
<path
d="M0.500 12.000 A11.500 11.500 0 1 0 23.500 12.000 A11.500 11.500 0 1 0 0.500 12.000 Z"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M13.5,3.642a8.5,8.5,0,0,1,6.24,11.877L13.5,9.354Z"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M13.5,13.6l4.471,4.455A8.529,8.529,0,0,1,13.5,20.365Z"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M4.33,15.549,10.5,9.354V3.635A8.517,8.517,0,0,0,3.5,12,7.583,7.583,0,0,0,4.33,15.549Z"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M10.5,20.364a8.543,8.543,0,0,1-4.463-2.306L10.5,13.6Z"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
/>
</g>
</svg>
),
[ICONS.UNIVERSE]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 25 24"
width={props.size || '18'}
height={props.size || '16'}
fill="none"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
>
<g transform="matrix(1,0,0,1,0,0)">
<path
d="M5.33,17.848A9.545,9.545,0,0,1,16.466,2.488"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M1.982,17.78C.769,19.905.363,21.554,1.048,22.24c1.04,1.039,4.294-.43,8.062-3.418"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M13.423,18.067l-3.58-3.58L17.8,6.53A5.054,5.054,0,0,1,20.153,5.2L22.2,4.686a.844.844,0,0,1,1.023,1.023l-.512,2.048a5.059,5.059,0,0,1-1.332,2.352Z"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M9.843,14.487,6.911,13.51a.422.422,0,0,1-.165-.7l1.022-1.022a3.383,3.383,0,0,1,3.462-.817l1.6.532Z"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M13.423,18.067,14.4,21a.422.422,0,0,0,.7.165l1.022-1.022a3.383,3.383,0,0,0,.817-3.462l-.532-1.6Z"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
/>
</g>
</svg>
),
[ICONS.CHEESE]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 25 24"
width={props.size || '18'}
height={props.size || '16'}
fill="none"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
>
<g transform="matrix(1,0,0,1,0,0)">
<path
d="M18.500 12.639 A1.500 1.500 0 1 0 21.500 12.639 A1.500 1.500 0 1 0 18.500 12.639 Z"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M5.000 14.139 A1.000 1.000 0 1 0 7.000 14.139 A1.000 1.000 0 1 0 5.000 14.139 Z"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M9.000 18.139 A2.000 2.000 0 1 0 13.000 18.139 A2.000 2.000 0 1 0 9.000 18.139 Z"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M23.5,8.493V19.761a1,1,0,0,1-.871.991l-21,2.74A1,1,0,0,1,.5,22.5a1.045,1.045,0,0,1,.686-.982A2,2,0,0,0,.5,17.639V11.945a1,1,0,0,1,.339-.751L12.709.749a1,1,0,0,1,.7-.248C17.854.674,23.5,3.642,23.5,8.493"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path d="M23.5 8.493L0.616 11.478" fill="none" strokeLinecap="round" strokeLinejoin="round" />
<path
d="M18,17.389a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M13.5,12.889a.25.25,0,1,1-.25.25.25.25,0,0,1,.25-.25"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
/>
</g>
</svg>
),
[ICONS.PORK_BUN]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 25 24"
width={props.size || '18'}
height={props.size || '16'}
fill="none"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
>
<g transform="matrix(1,0,0,1,0,0)">
<path
d="M11.247,5.3a1,1,0,0,1,1.507,0C15.378,8.3,23.5,11.518,23.5,16.5c0,5.706-5.794,7-11.5,7S.5,22.206.5,16.5C.5,11.518,8.623,8.3,11.247,5.3Z"
fill="none"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path d="M10,9.874a13.068,13.068,0,0,1-2.559,2.12" fill="none" strokeLinecap="round" strokeLinejoin="round" />
<path d="M14,9.874a13.068,13.068,0,0,0,2.559,2.12" fill="none" strokeLinecap="round" strokeLinejoin="round" />
<path d="M12 10.5L12 12.5" fill="none" strokeLinecap="round" strokeLinejoin="round" />
<path d="M6,.5C4.5,2,7.5,3,6,4.5" fill="none" strokeLinecap="round" strokeLinejoin="round" />
<path d="M18,.5c1.5,1.5-1.5,2.5,0,4" fill="none" strokeLinecap="round" strokeLinejoin="round" />
</g>
</svg>
),
[ICONS.MOVIES]: (props: CustomProps) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width={props.size || '18'}
height={props.size || '18'}
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<g transform="matrix(1,0,0,1,0,0)">
<path d="M19.5,11.75a3.751,3.751,0,0,1,3.124-3.7.75.75,0,0,0,.626-.739V5a1.5,1.5,0,0,0-1.5-1.5H2.25A1.5,1.5,0,0,0,.75,5V7.313a.749.749,0,0,0,.626.739,3.751,3.751,0,0,1,0,7.4.75.75,0,0,0-.626.739V18.5A1.5,1.5,0,0,0,2.25,20h19.5a1.5,1.5,0,0,0,1.5-1.5V16.187a.749.749,0,0,0-.626-.739A3.751,3.751,0,0,1,19.5,11.75Z" />
<path d="M4.5 6.5L6.75 6.5" />
<path d="M10.5 6.5L13.5 6.5" />
<path d="M17.25 6.5L19.5 6.5" />
<path d="M4.5 17L6.75 17" />
<path d="M10.5 17L13.5 17" />
<path d="M17.25 17L19.5 17" />
<path d="M12.624,10.436a.75.75,0,0,0-1.248,0l-1.6,2.4A.75.75,0,0,0,10.4,14h3.2a.75.75,0,0,0,.624-1.166Z" />
</g>
</svg>
),
};
+2 -3
View File
@@ -1,5 +1,4 @@
// @flow
import type { Node } from 'react';
import * as ICONS from 'constants/icons';
import React from 'react';
import classnames from 'classnames';
@@ -9,8 +8,8 @@ type Props = {
withText?: boolean,
isTitle?: boolean,
size?: number,
prefix?: string | number | Node,
postfix?: string | number | Node,
prefix?: string | number,
postfix?: string | number,
};
const LbcSymbol = (props: Props) => {
+2 -5
View File
@@ -13,7 +13,6 @@ import defaultSchema from 'hast-util-sanitize/lib/github.json';
import { formatedLinks, inlineLinks } from 'util/remark-lbry';
import { formattedTimestamp, inlineTimestamp } from 'util/remark-timestamp';
import ZoomableImage from 'component/zoomableImage';
import { CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS } from 'config';
type SimpleTextProps = {
children?: React.Node,
@@ -33,7 +32,6 @@ type MarkdownProps = {
className?: string,
parentCommentId?: string,
isMarkdownPost?: boolean,
stakedLevel?: number,
};
// ****************************************************************************
@@ -95,7 +93,7 @@ const REPLACE_REGEX = /(<iframe\s+src=["'])(.*?(?=))(["']\s*><\/iframe>)/g;
// ****************************************************************************
const MarkdownPreview = (props: MarkdownProps) => {
const { content, strip, simpleLinks, noDataStore, className, parentCommentId, isMarkdownPost, stakedLevel } = props;
const { content, strip, simpleLinks, noDataStore, className, parentCommentId, isMarkdownPost } = props;
const strippedContent = content
? content.replace(REPLACE_REGEX, (iframeHtml, y, iframeSrc) => {
// Let the browser try to create an iframe to see if the markup is valid
@@ -121,13 +119,12 @@ const MarkdownPreview = (props: MarkdownProps) => {
remarkReactComponents: {
a: noDataStore
? SimpleLink
: (linkProps) => (
: linkProps => (
<MarkdownLink
{...linkProps}
parentCommentId={parentCommentId}
isMarkdownPost={isMarkdownPost}
simpleLinks={simpleLinks}
allowPreview={stakedLevel && stakedLevel >= CHANNEL_STAKED_LEVEL_VIDEO_COMMENTS}
/>
),
// Workaraund of remarkOptions.Fragment
+1 -1
View File
@@ -41,7 +41,7 @@ class StatusBar extends React.PureComponent<Props, State> {
render() {
const { hoverUrl, show } = this.state;
return <div className={classnames('status-bar', { visible: show })}>{decodeURI(hoverUrl)}</div>;
return <div className={classnames('status-bar', { visible: show })}>{hoverUrl}</div>;
}
}
+5 -3
View File
@@ -1,8 +1,6 @@
// @flow
import type { Node } from 'react';
import React from 'react';
import ReachTooltip from '@reach/tooltip';
import '@reach/tooltip/styles.css';
type Props = {
label: string | Node,
@@ -12,7 +10,11 @@ type Props = {
function Tooltip(props: Props) {
const { children, label } = props;
return <ReachTooltip label={label}>{children}</ReachTooltip>;
if (typeof label !== 'string') {
return children;
}
return <span title={label}>{children}</span>;
}
export default Tooltip;
+6 -2
View File
@@ -1,9 +1,13 @@
import { connect } from 'react-redux';
import { makeSelectClaimForUri } from 'lbry-redux';
import { makeSelectClaimForUri, doPrepareEdit } from 'lbry-redux';
import CreatorAnalytics from './view';
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
});
export default connect(select)(CreatorAnalytics);
const perform = dispatch => ({
prepareEdit: channelName => dispatch(doPrepareEdit({ signing_channel: { name: channelName } })),
});
export default connect(select, perform)(CreatorAnalytics);
+8 -20
View File
@@ -26,7 +26,7 @@ export default function CreatorAnalytics(props: Props) {
const history = useHistory();
const [stats, setStats] = React.useState();
const [error, setError] = React.useState();
const [fetchingStats, setFetchingStats] = React.useState(false);
const [fetchingStats, setFetchingStats] = React.useState(true);
const claimId = claim && claim.claim_id;
const channelHasClaims = claim && claim.meta && claim.meta.claims_in_channel && claim.meta.claims_in_channel > 0;
@@ -81,24 +81,7 @@ export default function CreatorAnalytics(props: Props) {
/>
)}
{!error && !channelHasClaims ? (
<Yrbl
type="sad"
title={__("You haven't uploaded anything")}
subtitle={__('Upload something to start tracking your stats!')}
actions={
<div className="section__actions">
<Button
button="primary"
label={__('Upload Something')}
onClick={() => {
history.push(`/$/${PAGES.UPLOAD}`);
}}
/>
</div>
}
/>
) : (
{!error && (
<Yrbl
title={
channelHasClaims
@@ -110,7 +93,12 @@ export default function CreatorAnalytics(props: Props) {
<Button
button="primary"
label={__('Upload Something')}
onClick={() => history.push(`/$/${PAGES.UPLOAD}`)}
onClick={() => {
if (claim) {
prepareEdit(claim.name);
history.push(`/$/${PAGES.UPLOAD}`);
}
}}
/>
</div>
}
+4 -12
View File
@@ -9,7 +9,7 @@ import {
import { makeSelectCostInfoForUri } from 'lbryinc';
import { doSetPlayingUri } from 'redux/actions/content';
import { doToast } from 'redux/actions/notifications';
import { doOpenModal, doSetActiveChannel, doSetIncognito } from 'redux/actions/app';
import { doOpenModal } from 'redux/actions/app';
import fs from 'fs';
import FileActions from './view';
import { makeSelectFileRenderModeForUri } from 'redux/selectors/content';
@@ -23,19 +23,11 @@ const select = (state, props) => ({
myChannels: selectMyChannelClaims(state),
});
const perform = (dispatch) => ({
const perform = dispatch => ({
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
prepareEdit: (publishData, uri, fileInfo) => {
if (publishData.signing_channel) {
dispatch(doSetActiveChannel(publishData.signing_channel.claim_id));
} else {
dispatch(doSetIncognito(true));
}
dispatch(doPrepareEdit(publishData, uri, fileInfo, fs));
},
prepareEdit: (publishData, uri, fileInfo) => dispatch(doPrepareEdit(publishData, uri, fileInfo, fs)),
clearPlayingUri: () => dispatch(doSetPlayingUri({ uri: null })),
doToast: (options) => dispatch(doToast(options)),
doToast: options => dispatch(doToast(options)),
});
export default connect(select, perform)(FileActions);
+2 -3
View File
@@ -4,14 +4,13 @@ import ClaimPreview from 'component/claimPreview';
type Props = {
channelUri: string,
hideActions?: boolean,
};
function FileAuthor(props: Props) {
const { channelUri, hideActions } = props;
const { channelUri } = props;
return channelUri ? (
<ClaimPreview uri={channelUri} type="inline" properties={false} hideMenu hideActions={hideActions} />
<ClaimPreview uri={channelUri} type="inline" properties={false} hideBlock />
) : (
<div className="claim-preview--inline claim-preview__title">{__('Anonymous')}</div>
);
+1 -2
View File
@@ -13,7 +13,7 @@ type Props = {
fileInfo: ?FileListItem,
openModal: (id: string, { path: string }) => void,
pause: () => void,
download: (string) => void,
download: string => void,
costInfo: ?{ cost: string },
buttonType: ?string,
showLabel: ?boolean,
@@ -91,7 +91,6 @@ function FileDownloadLink(props: Props) {
return hideOpenButton ? null : (
<Button
button={buttonType}
className={buttonType ? undefined : 'button--file-action'}
title={openLabel}
label={showLabel ? openLabel : null}
icon={ICONS.EXTERNAL}
-4
View File
@@ -6,8 +6,6 @@ import {
makeSelectDownloadPathForUri,
makeSelectStreamingUrlForUri,
SETTINGS,
makeSelectStakedLevelForChannelUri,
makeSelectChannelForClaimUri,
} from 'lbry-redux';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import { makeSelectFileRenderModeForUri, makeSelectFileExtensionForUri } from 'redux/selectors/content';
@@ -15,11 +13,9 @@ import FileRender from './view';
const select = (state, props) => {
const autoplay = props.embedded ? false : makeSelectClientSetting(SETTINGS.AUTOPLAY)(state);
const channelUri = makeSelectChannelForClaimUri(props.uri)(state);
return {
currentTheme: makeSelectClientSetting(SETTINGS.THEME)(state),
claim: makeSelectClaimForUri(props.uri)(state),
stakedLevel: makeSelectStakedLevelForChannelUri(channelUri)(state),
thumbnail: makeSelectThumbnailForUri(props.uri)(state),
contentType: makeSelectContentTypeForUri(props.uri)(state),
downloadPath: makeSelectDownloadPathForUri(props.uri)(state),
-3
View File
@@ -35,7 +35,6 @@ type Props = {
thumbnail: string,
desktopPlayStartTime?: number,
className?: string,
stakedLevel?: number,
};
class FileRender extends React.PureComponent<Props> {
@@ -79,7 +78,6 @@ class FileRender extends React.PureComponent<Props> {
uri,
renderMode,
desktopPlayStartTime,
stakedLevel,
} = this.props;
const source = streamingUrl;
@@ -112,7 +110,6 @@ class FileRender extends React.PureComponent<Props> {
}}
renderMode={renderMode}
theme={currentTheme}
stakedLevel={stakedLevel}
/>
);
case RENDER_MODES.DOCX:
+4 -4
View File
@@ -89,16 +89,17 @@ export default function FileRenderFloating(props: Props) {
}
function clampToScreen(pos) {
const GAP_PX = 10;
const ESTIMATED_SCROLL_BAR_PX = 50;
const FLOATING_PLAYER_CLASS = 'content__viewer--floating';
const fpPlayerElem = document.querySelector(`.${FLOATING_PLAYER_CLASS}`);
if (fpPlayerElem) {
if (pos.x + fpPlayerElem.getBoundingClientRect().width > getScreenWidth() - ESTIMATED_SCROLL_BAR_PX) {
pos.x = getScreenWidth() - fpPlayerElem.getBoundingClientRect().width - ESTIMATED_SCROLL_BAR_PX;
pos.x = getScreenWidth() - fpPlayerElem.getBoundingClientRect().width - ESTIMATED_SCROLL_BAR_PX - GAP_PX;
}
if (pos.y + fpPlayerElem.getBoundingClientRect().height > getScreenHeight()) {
pos.y = getScreenHeight() - fpPlayerElem.getBoundingClientRect().height;
pos.y = getScreenHeight() - fpPlayerElem.getBoundingClientRect().height - GAP_PX * 2;
}
}
}
@@ -129,7 +130,7 @@ export default function FileRenderFloating(props: Props) {
// Listen to main-window resizing and adjust the fp position accordingly:
useEffect(() => {
const handleMainWindowResize = debounce((e) => {
const handleMainWindowResize = debounce(e => {
let newPos = {
x: Math.round(relativePos.x * getScreenWidth()),
y: Math.round(relativePos.y * getScreenHeight()),
@@ -248,7 +249,6 @@ export default function FileRenderFloating(props: Props) {
className={classnames('content__viewer', {
'content__viewer--floating': isFloating,
'content__viewer--inline': !isFloating,
'content__viewer--secondary': playingUriSource === 'comment',
'content__viewer--theater-mode': !isFloating && videoTheaterMode,
})}
style={
+2 -4
View File
@@ -14,12 +14,12 @@ import Nag from 'component/common/nag';
const SPACE_BAR_KEYCODE = 32;
type Props = {
play: (string) => void,
play: string => void,
isLoading: boolean,
isPlaying: boolean,
fileInfo: FileListItem,
uri: string,
history: { push: (string) => void },
history: { push: string => void },
location: { search: ?string, pathname: string },
obscurePreview: boolean,
insufficientCredits: boolean,
@@ -58,7 +58,6 @@ export default function FileRenderInitiator(props: Props) {
const isFree = hasCostInfo && cost === 0;
const fileStatus = fileInfo && fileInfo.status;
const isPlayable = RENDER_MODES.FLOATING_MODES.includes(renderMode);
const isText = RENDER_MODES.TEXT_MODES.includes(renderMode);
function doAuthRedirect() {
history.push(`/$/${PAGES.AUTH}?redirect=${encodeURIComponent(location.pathname)}`);
@@ -122,7 +121,6 @@ export default function FileRenderInitiator(props: Props) {
className={classnames('content__cover', {
'content__cover--disabled': disabled,
'content__cover--theater-mode': videoTheaterMode,
'content__cover--text': isText,
'card__media--nsfw': obscurePreview,
})}
>
+3 -3
View File
@@ -1,19 +1,19 @@
import { connect } from 'react-redux';
import { makeSelectFileInfoForUri, makeSelectStreamingUrlForUri } from 'lbry-redux';
import { doClaimEligiblePurchaseRewards } from 'redux/actions/rewards';
import { makeSelectFileRenderModeForUri, makeSelectIsPlaying } from 'redux/selectors/content';
import { makeSelectFileRenderModeForUri, selectPrimaryUri } from 'redux/selectors/content';
import { withRouter } from 'react-router';
import { doAnalyticsView } from 'redux/actions/app';
import FileRenderInline from './view';
const select = (state, props) => ({
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
isPlaying: makeSelectIsPlaying(props.uri)(state),
isPlaying: selectPrimaryUri(state) === props.uri,
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
});
const perform = (dispatch) => ({
const perform = dispatch => ({
triggerAnalyticsView: (uri, timeToStart) => dispatch(doAnalyticsView(uri, timeToStart)),
claimRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
});
+1 -1
View File
@@ -52,5 +52,5 @@ export default function FileRenderInline(props: Props) {
return null;
}
return renderContent ? <FileRender uri={uri} /> : <LoadingScreen isDocument />;
return renderContent ? <FileRender uri={uri} /> : <LoadingScreen status={__('Preparing your content')} isDocument />;
}
@@ -23,6 +23,7 @@ $transition-duration: 300ms;
top: 0;
left: 0;
pointer-events: none;
z-index: $base-zindex + 1;
vertical-align: top;
opacity: 0;
@@ -3,7 +3,7 @@ import classnames from 'classnames';
import PropTypes from 'prop-types';
import Freezeframe from './FreezeframeLite';
const FreezeframeWrapper = (props) => {
const FreezeframeWrapper = props => {
const imgRef = React.useRef();
const freezeframe = React.useRef();
// eslint-disable-next-line
+4 -2
View File
@@ -1,9 +1,11 @@
import { connect } from 'react-redux';
import { makeSelectTitleForUri } from 'lbry-redux';
import FileTitleSection from './view';
import { makeSelectInsufficientCreditsForUri } from 'redux/selectors/content';
import FileTitle from './view';
const select = (state, props) => ({
isInsufficientCredits: makeSelectInsufficientCreditsForUri(props.uri)(state),
title: makeSelectTitleForUri(props.uri)(state),
});
export default connect(select)(FileTitleSection);
export default connect(select)(FileTitle);
+63 -9
View File
@@ -1,22 +1,76 @@
// @flow
import type { Node } from 'react';
import * as React from 'react';
import classnames from 'classnames';
import { normalizeURI } from 'lbry-redux';
import FilePrice from 'component/filePrice';
import ClaimInsufficientCredits from 'component/claimInsufficientCredits';
import FileSubtitle from 'component/fileSubtitle';
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';
type Props = {
uri: string,
title: string,
className?: string,
children?: Node,
nsfw: boolean,
isNsfwBlocked: boolean,
};
function FileTitle(props: Props) {
const { title, children, className } = props;
const { title, uri, nsfw, isNsfwBlocked } = props;
return (
<h1 className={classnames(className)}>
<span>{title}</span>
{children}
</h1>
<Card
isPageTitle
noTitleWrap
title={
<React.Fragment>
{title}
{nsfw && (
<span className="media__title-badge">
<span className="badge badge--tag-mature">{__('Mature')}</span>
</span>
)}
</React.Fragment>
}
titleActions={<FilePrice uri={normalizeURI(uri)} type="filepage" />}
body={
<React.Fragment>
<ClaimInsufficientCredits uri={uri} />
<FileSubtitle uri={uri} />
</React.Fragment>
}
actions={
isNsfwBlocked ? (
<div className="main--empty">
<h2>
<Icon className="icon--hidden" icon={ICONS.EYE_OFF} />
{__('Mature content blocked.')}
</h2>
<div>
<I18nMessage
tokens={{
content_settings: (
<Button button="link" label={__('content settings')} navigate={`/$/${PAGES.SETTINGS}`} />
),
}}
>
Change this in your %content_settings%.
</I18nMessage>
</div>
</div>
) : (
<div className="section">
<FileAuthor uri={uri} />
<FileDescription uri={uri} />
</div>
)
}
/>
);
}
-11
View File
@@ -1,11 +0,0 @@
import { connect } from 'react-redux';
import { makeSelectTitleForUri } from 'lbry-redux';
import { makeSelectInsufficientCreditsForUri } from 'redux/selectors/content';
import FileTitleSection from './view';
const select = (state, props) => ({
isInsufficientCredits: makeSelectInsufficientCreditsForUri(props.uri)(state),
title: makeSelectTitleForUri(props.uri)(state),
});
export default connect(select)(FileTitleSection);
-77
View File
@@ -1,77 +0,0 @@
// @flow
import * as React from 'react';
import { normalizeURI } from 'lbry-redux';
import FilePrice from 'component/filePrice';
import ClaimInsufficientCredits from 'component/claimInsufficientCredits';
import FileSubtitle from 'component/fileSubtitle';
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';
type Props = {
uri: string,
title: string,
nsfw: boolean,
isNsfwBlocked: boolean,
};
function FileTitleSection(props: Props) {
const { title, uri, nsfw, isNsfwBlocked } = props;
return (
<Card
isPageTitle
noTitleWrap
title={
<React.Fragment>
{title}
{nsfw && (
<span className="media__title-badge">
<span className="badge badge--tag-mature">{__('Mature')}</span>
</span>
)}
</React.Fragment>
}
titleActions={<FilePrice uri={normalizeURI(uri)} type="filepage" />}
body={
<React.Fragment>
<ClaimInsufficientCredits uri={uri} />
<FileSubtitle uri={uri} />
</React.Fragment>
}
actions={
isNsfwBlocked ? (
<div className="main--empty">
<h2>
<Icon className="icon--hidden" icon={ICONS.EYE_OFF} />
{__('Mature content blocked.')}
</h2>
<div>
<I18nMessage
tokens={{
content_settings: (
<Button button="link" label={__('content settings')} navigate={`/$/${PAGES.SETTINGS}`} />
),
}}
>
Change this in your %content_settings%.
</I18nMessage>
</div>
</div>
) : (
<div className="section">
<FileAuthor uri={uri} />
<FileDescription uri={uri} />
</div>
)
}
/>
);
}
export default FileTitleSection;
@@ -28,15 +28,9 @@ function FileViewerEmbeddedTitle(props: Props) {
return (
<div className="file-viewer__embedded-header">
<div className="file-viewer__embedded-gradient" />
<Button
label={title}
aria-label={title}
button="link"
className="file-viewer__embedded-title"
{...contentLinkProps}
/>
<Button label={title} button="link" className="file-viewer__embedded-title" {...contentLinkProps} />
<div className="file-viewer__embedded-info">
<Button className="file-viewer__overlay-logo" icon={ICONS.LBRY} aria-label={__('Home')} {...lbryLinkProps} />
<Button className="file-viewer__overlay-logo" icon={ICONS.LBRY} {...lbryLinkProps} />
{isInApp && <FilePrice uri={uri} />}
</div>
</div>
+8 -5
View File
@@ -1,16 +1,17 @@
import * as MODALS from 'constants/modal_types';
import { connect } from 'react-redux';
import { selectTotalBalance, selectBalance, formatCredits, SETTINGS } from 'lbry-redux';
import { selectTotalBalance, selectBalance, formatCredits, selectMyChannelClaims, SETTINGS } from 'lbry-redux';
import { selectGetSyncErrorMessage } from 'redux/selectors/sync';
import { selectUserVerifiedEmail, selectUserEmail, selectEmailToVerify, selectUser } from 'redux/selectors/user';
import { doClearEmailEntry, doClearPasswordEntry } from 'redux/actions/user';
import { doSetClientSetting } from 'redux/actions/settings';
import { doSignOut, doOpenModal } from 'redux/actions/app';
import { makeSelectClientSetting, selectLanguage } from 'redux/selectors/settings';
import { selectHasNavigated, selectActiveChannelClaim } from 'redux/selectors/app';
import { selectCommentChannel } from 'redux/selectors/comments';
import Header from './view';
import { selectHasNavigated } from 'redux/selectors/app';
const select = (state) => ({
const select = state => ({
language: selectLanguage(state),
balance: selectBalance(state),
roundedSpendableBalance: formatCredits(selectBalance(state), 2, true),
@@ -24,12 +25,14 @@ const select = (state) => ({
emailToVerify: selectEmailToVerify(state),
hasNavigated: selectHasNavigated(state),
user: selectUser(state),
activeChannelClaim: selectActiveChannelClaim(state),
myChannels: selectMyChannelClaims(state),
commentChannel: selectCommentChannel(state),
});
const perform = (dispatch) => ({
const perform = dispatch => ({
setClientSetting: (key, value, push) => dispatch(doSetClientSetting(key, value, push)),
signOut: () => dispatch(doSignOut()),
openChannelCreate: () => dispatch(doOpenModal(MODALS.CREATE_CHANNEL)),
openSignOutModal: () => dispatch(doOpenModal(MODALS.SIGN_OUT)),
clearEmailEntry: () => dispatch(doClearEmailEntry()),
clearPasswordEntry: () => dispatch(doClearPasswordEntry()),
+97 -101
View File
@@ -33,8 +33,8 @@ type Props = {
index: number,
length: number,
location: { pathname: string },
push: (string) => void,
replace: (string) => void,
push: string => void,
replace: string => void,
},
currentTheme: string,
automaticDarkModeEnabled: boolean,
@@ -52,15 +52,17 @@ type Props = {
syncError: ?string,
emailToVerify?: string,
signOut: () => void,
openChannelCreate: () => void,
openSignOutModal: () => void,
clearEmailEntry: () => void,
clearPasswordEntry: () => void,
hasNavigated: boolean,
sidebarOpen: boolean,
setSidebarOpen: (boolean) => void,
setSidebarOpen: boolean => void,
isAbsoluteSideNavHidden: boolean,
hideCancel: boolean,
activeChannelClaim: ?ChannelClaim,
myChannels: ?Array<ChannelClaim>,
commentChannel: string,
};
const Header = (props: Props) => {
@@ -88,7 +90,8 @@ const Header = (props: Props) => {
isAbsoluteSideNavHidden,
user,
hideCancel,
activeChannelClaim,
myChannels,
commentChannel,
} = props;
const isMobile = useIsMobile();
// on the verify page don't let anyone escape other than by closing the tab to keep session data consistent
@@ -99,9 +102,18 @@ const Header = (props: Props) => {
const hasBackout = Boolean(backout);
const { backLabel, backNavDefault, title: backTitle, simpleTitle: simpleBackTitle } = backout || {};
const notificationsEnabled = (user && user.experimental_ui) || false;
const livestreamEnabled = (user && user.experimental_ui) || false;
const activeChannelUrl = activeChannelClaim && activeChannelClaim.permanent_url;
let channelUrl;
let identityChannel;
if (myChannels && myChannels.length >= 1) {
if (myChannels.length === 1) {
identityChannel = myChannels[0];
} else if (commentChannel) {
identityChannel = myChannels.find(chan => chan.name === commentChannel);
} else {
identityChannel = myChannels[0];
}
channelUrl = identityChannel && (identityChannel.permanent_url || identityChannel.canonical_url);
}
// Sign out if they click the "x" when they are on the password prompt
const authHeaderAction = syncError ? { onClick: signOut } : { navigate: '/' };
const homeButtonNavigationProps = isVerifyPage ? {} : authHeader ? authHeaderAction : { navigate: '/' };
@@ -177,11 +189,11 @@ const Header = (props: Props) => {
: __('Your Wallet')
}
navigate={`/$/${PAGES.WALLET}`}
className={classnames(balanceButtonProps.className, 'header__navigation-item--balance')}
className={balanceButtonProps.className}
label={hideBalance || Number(roundedBalance) === 0 ? __('Your Wallet') : roundedBalance}
icon={ICONS.LBC}
// @if TARGET='app'
onDoubleClick={(e) => {
onDoubleClick={e => {
e.stopPropagation();
}}
// @endif
@@ -197,7 +209,7 @@ const Header = (props: Props) => {
// @endif
})}
// @if TARGET='app'
onDoubleClick={(e) => {
onDoubleClick={e => {
remote.getCurrentWindow().maximize();
}}
// @endif
@@ -213,7 +225,7 @@ const Header = (props: Props) => {
/>
{backTitle && <h1 className="header__auth-title">{isMobile ? simpleBackTitle || backTitle : backTitle}</h1>}
{authenticated || !IS_WEB ? (
<BalanceButton className="header__navigation-item menu__title" />
<BalanceButton className="header__navigation-item menu__title header__navigation-item--balance" />
) : (
loginButtons
)}
@@ -250,7 +262,7 @@ const Header = (props: Props) => {
if (history.location.pathname === '/') window.location.reload();
}}
// @if TARGET='app'
onDoubleClick={(e) => {
onDoubleClick={e => {
e.stopPropagation();
}}
// @endif
@@ -276,11 +288,10 @@ const Header = (props: Props) => {
history={history}
handleThemeToggle={handleThemeToggle}
currentTheme={currentTheme}
activeChannelUrl={activeChannelUrl}
channelUrl={channelUrl}
openSignOutModal={openSignOutModal}
email={email}
signOut={signOut}
livestreamEnabled={livestreamEnabled}
/>
</div>
)}
@@ -289,77 +300,10 @@ const Header = (props: Props) => {
{!authHeader && !backout ? (
<div className={classnames('header__menu', { 'header__menu--with-balance': !IS_WEB || authenticated })}>
{(!IS_WEB || authenticated) && (
<BalanceButton className="header__navigation-item menu__title mobile-hidden" />
<BalanceButton className="header__navigation-item menu__title header__navigation-item--balance mobile-hidden" />
)}
{IS_WEB && !authenticated && loginButtons}
{(authenticated || !IS_WEB) && (
<Menu>
<MenuButton
aria-label={__('Your account')}
title={__('Your account')}
className={classnames('header__navigation-item', {
'menu__title header__navigation-item--icon': !activeChannelUrl,
'header__navigation-item--profile-pic': activeChannelUrl,
})}
// @if TARGET='app'
onDoubleClick={(e) => {
e.stopPropagation();
}}
// @endif
>
{activeChannelUrl ? (
<ChannelThumbnail uri={activeChannelUrl} />
) : (
<Icon size={18} icon={ICONS.ACCOUNT} aria-hidden />
)}
</MenuButton>
<MenuList className="menu__list--header">
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.UPLOADS}`)}>
<Icon aria-hidden icon={ICONS.PUBLISH} />
{__('Uploads')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.CHANNELS}`)}>
<Icon aria-hidden icon={ICONS.CHANNEL} />
{__('Channels')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.CREATOR_DASHBOARD}`)}>
<Icon aria-hidden icon={ICONS.ANALYTICS} />
{__('Creator Analytics')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.REWARDS}`)}>
<Icon aria-hidden icon={ICONS.REWARDS} />
{__('Rewards')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.INVITE}`)}>
<Icon aria-hidden icon={ICONS.INVITE} />
{__('Invites')}
</MenuItem>
{authenticated ? (
<MenuItem onSelect={IS_WEB ? signOut : openSignOutModal}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.SIGN_OUT} />
{__('Sign Out')}
</div>
<span className="menu__link-help">{email}</span>
</MenuItem>
) : !IS_WEB ? (
<>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.AUTH}`)}>
<Icon aria-hidden icon={ICONS.SIGN_UP} />
{__('Sign Up')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.AUTH_SIGNIN}`)}>
<Icon aria-hidden icon={ICONS.SIGN_IN} />
{__('Sign In')}
</MenuItem>
</>
) : null}
</MenuList>
</Menu>
)}
</div>
) : (
!isVerifyPage &&
@@ -376,7 +320,7 @@ const Header = (props: Props) => {
icon={ICONS.REMOVE}
{...closeButtonNavigationProps}
// @if TARGET='app'
onDoubleClick={(e) => {
onDoubleClick={e => {
e.stopPropagation();
}}
// @endif
@@ -394,14 +338,13 @@ const Header = (props: Props) => {
type HeaderMenuButtonProps = {
authenticated: boolean,
notificationsEnabled: boolean,
history: { push: (string) => void },
handleThemeToggle: (string) => void,
history: { push: string => void },
handleThemeToggle: string => void,
currentTheme: string,
activeChannelUrl: ?string,
channelUrl: ?string,
openSignOutModal: () => void,
email: ?string,
signOut: () => void,
livestreamEnabled: boolean,
};
function HeaderMenuButtons(props: HeaderMenuButtonProps) {
@@ -411,11 +354,10 @@ function HeaderMenuButtons(props: HeaderMenuButtonProps) {
history,
handleThemeToggle,
currentTheme,
activeChannelUrl,
channelUrl,
openSignOutModal,
email,
signOut,
livestreamEnabled,
} = props;
return (
@@ -427,7 +369,7 @@ function HeaderMenuButtons(props: HeaderMenuButtonProps) {
title={__('Publish a file, or create a channel')}
className="header__navigation-item menu__title header__navigation-item--icon mobile-hidden"
// @if TARGET='app'
onDoubleClick={(e) => {
onDoubleClick={e => {
e.stopPropagation();
}}
// @endif
@@ -444,15 +386,6 @@ function HeaderMenuButtons(props: HeaderMenuButtonProps) {
<Icon aria-hidden icon={ICONS.CHANNEL} />
{__('New Channel')}
</MenuItem>
{/* Go Live Button for LiveStreaming */}
{(livestreamEnabled) &&(
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.LIVESTREAM}`)}>
<Icon aria-hidden icon={ICONS.VIDEO} />
{__('Go Live')}
</MenuItem>
)}
</MenuList>
</Menu>
)}
@@ -465,7 +398,7 @@ function HeaderMenuButtons(props: HeaderMenuButtonProps) {
title={__('Settings')}
className="header__navigation-item menu__title header__navigation-item--icon mobile-hidden"
// @if TARGET='app'
onDoubleClick={(e) => {
onDoubleClick={e => {
e.stopPropagation();
}}
// @endif
@@ -487,6 +420,69 @@ function HeaderMenuButtons(props: HeaderMenuButtonProps) {
</MenuItem>
</MenuList>
</Menu>
{(authenticated || !IS_WEB) && (
<Menu>
<MenuButton
aria-label={__('Your account')}
title={__('Your account')}
className={classnames('header__navigation-item mobile-hidden', {
'menu__title header__navigation-item--icon': !channelUrl,
'header__navigation-item--profile-pic': channelUrl,
})}
// @if TARGET='app'
onDoubleClick={e => {
e.stopPropagation();
}}
// @endif
>
{channelUrl ? <ChannelThumbnail uri={channelUrl} /> : <Icon size={18} icon={ICONS.ACCOUNT} aria-hidden />}
</MenuButton>
<MenuList className="menu__list--header">
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.UPLOADS}`)}>
<Icon aria-hidden icon={ICONS.PUBLISH} />
{__('Uploads')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.CHANNELS}`)}>
<Icon aria-hidden icon={ICONS.CHANNEL} />
{__('Channels')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.CREATOR_DASHBOARD}`)}>
<Icon aria-hidden icon={ICONS.ANALYTICS} />
{__('Creator Analytics')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.REWARDS}`)}>
<Icon aria-hidden icon={ICONS.REWARDS} />
{__('Rewards')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.INVITE}`)}>
<Icon aria-hidden icon={ICONS.INVITE} />
{__('Invites')}
</MenuItem>
{authenticated ? (
<MenuItem onSelect={IS_WEB ? signOut : openSignOutModal}>
<div className="menu__link">
<Icon aria-hidden icon={ICONS.SIGN_OUT} />
{__('Sign Out')}
</div>
<span className="menu__link-help">{email}</span>
</MenuItem>
) : !IS_WEB ? (
<>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.AUTH}`)}>
<Icon aria-hidden icon={ICONS.SIGN_UP} />
{__('Sign Up')}
</MenuItem>
<MenuItem className="menu__link" onSelect={() => history.push(`/$/${PAGES.AUTH_SIGNIN}`)}>
<Icon aria-hidden icon={ICONS.SIGN_IN} />
{__('Sign In')}
</MenuItem>
</>
) : null}
</MenuList>
</Menu>
)}
</div>
);
}
+9 -13
View File
@@ -5,6 +5,7 @@ import Button from 'component/button';
import { Form, FormField } from 'component/common/form';
import CopyableText from 'component/copyableText';
import Card from 'component/common/card';
import SelectChannel from 'component/selectChannel';
import analytics from 'analytics';
import I18nMessage from 'component/i18nMessage';
import LbcSymbol from 'component/common/lbc-symbol';
@@ -20,6 +21,7 @@ type Props = {
function InviteNew(props: Props) {
const { inviteNew, errorMessage, isPending, referralCode = '', channels } = props;
const noChannels = !channels || !(channels.length > 0);
// Email
const [email, setEmail] = useState('');
@@ -85,20 +87,14 @@ function InviteNew(props: Props) {
actions={
<React.Fragment>
<CopyableText label={__('Your invite link')} copyable={referral} />
{channels && channels.length > 0 && (
<FormField
type="select"
{!noChannels && (
<SelectChannel
channel={referralSource}
onChannelChange={channel => handleReferralChange(channel)}
label={__('Customize link')}
value={referralSource}
onChange={e => handleReferralChange(e.target.value)}
>
{channels.map(channel => (
<option key={channel.claim_id} value={channel.name}>
{channel.name}
</option>
))}
<option value={referralCode}>{referralCode}</option>
</FormField>
hideAnon
injected={[referralCode]}
/>
)}
</React.Fragment>
}
-3
View File
@@ -1,3 +0,0 @@
import LastReleaseChanges from './view';
export default LastReleaseChanges;
-83
View File
@@ -1,83 +0,0 @@
// @flow
import React, { useState, useEffect } from 'react';
import MarkdownPreview from 'component/common/markdown-preview';
import Button from 'component/button';
import I18nMessage from 'component/i18nMessage';
type Props = {
hideReleaseVersion?: boolean,
};
const LastReleaseChanges = (props: Props) => {
const { hideReleaseVersion } = props;
const [releaseTag, setReleaseTag] = useState('');
const [releaseChanges, setReleaseChanges] = useState('');
const [fetchingReleaseChanges, setFetchingReleaseChanges] = useState(false);
const [fetchReleaseFailed, setFetchReleaseFailed] = useState(false);
const releaseVersionTitle = (
<p>
{!hideReleaseVersion && __('A new version %release_tag% of LBRY is ready for you.', { release_tag: releaseTag })}
</p>
);
const seeReleaseNotes = (
<p className="help">
<I18nMessage
tokens={{
release_notes: (
<Button button="link" label={__('release notes')} href="https://github.com/lbryio/lbry-desktop/releases" />
),
}}
>
Want to know what has changed? See the %release_notes%.
</I18nMessage>
</p>
);
useEffect(() => {
const lastReleaseUrl = 'https://api.github.com/repos/lbryio/lbry-desktop/releases/latest';
const options = {
method: 'GET',
headers: { Accept: 'application/vnd.github.v3+json' },
};
setFetchingReleaseChanges(true);
fetch(lastReleaseUrl, options)
.then(response => response.json())
.then(response => {
setReleaseTag(response.tag_name);
setReleaseChanges(response.body);
setFetchingReleaseChanges(false);
setFetchReleaseFailed(false);
})
.catch(() => {
setFetchingReleaseChanges(false);
setFetchReleaseFailed(true);
});
}, []);
if (fetchingReleaseChanges) {
return <p>{__('Loading...')}</p>;
}
if (fetchReleaseFailed) {
return (
<div>
{releaseVersionTitle}
{seeReleaseNotes}
</div>
);
}
return (
<div>
{releaseVersionTitle}
<p>
<MarkdownPreview content={releaseChanges} />
</p>
{seeReleaseNotes}
</div>
);
};
export default LastReleaseChanges;
-14
View File
@@ -1,14 +0,0 @@
import { connect } from 'react-redux';
import { makeSelectClaimForUri } from 'lbry-redux';
import { doCommentSocketConnect } from 'redux/actions/websocket';
import { doCommentList } from 'redux/actions/comments';
import { makeSelectTopLevelCommentsForUri, selectIsFetchingComments } from 'redux/selectors/comments';
import LivestreamFeed from './view';
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
comments: makeSelectTopLevelCommentsForUri(props.uri)(state),
fetchingComments: selectIsFetchingComments(state),
});
export default connect(select, { doCommentSocketConnect, doCommentList })(LivestreamFeed);
-130
View File
@@ -1,130 +0,0 @@
// @flow
import React from 'react';
import classnames from 'classnames';
import Card from 'component/common/card';
import Spinner from 'component/spinner';
import CommentCreate from 'component/commentCreate';
import Button from 'component/button';
import MarkdownPreview from 'component/common/markdown-preview';
type Props = {
uri: string,
claim: ?StreamClaim,
activeViewers: number,
embed?: boolean,
doCommentSocketConnect: (string) => void,
doCommentList: (string) => void,
comments: Array<Comment>,
fetchingComments: boolean,
};
export default function LivestreamFeed(props: Props) {
const { claim, uri, embed, doCommentSocketConnect, comments, doCommentList, fetchingComments } = props;
const commentsRef = React.createRef();
const hasScrolledComments = React.useRef();
const [performedInitialScroll, setPerformedInitialScroll] = React.useState(false);
const claimId = claim && claim.claim_id;
const commentsLength = comments && comments.length;
React.useEffect(() => {
if (claimId) {
doCommentList(uri);
doCommentSocketConnect(claimId);
}
}, [claimId, uri]);
React.useEffect(() => {
const element = commentsRef.current;
function handleScroll() {
if (element) {
const scrollHeight = element.scrollHeight - element.offsetHeight;
const isAtBottom = scrollHeight === element.scrollTop;
if (!isAtBottom) {
hasScrolledComments.current = true;
} else {
hasScrolledComments.current = false;
}
}
}
if (element) {
element.addEventListener('scroll', handleScroll);
if (commentsLength > 0) {
// Only update comment scroll if the user hasn't scrolled up to view old comments
// If they have, do nothing
if (!hasScrolledComments.current || !performedInitialScroll) {
element.scrollTop = element.scrollHeight - element.offsetHeight;
if (!performedInitialScroll) {
setPerformedInitialScroll(true);
}
}
}
}
return () => {
if (element) {
element.removeEventListener('scroll', handleScroll);
}
};
}, [commentsRef, commentsLength, performedInitialScroll]);
if (!claim) {
return null;
}
return (
<Card
title={__('Live discussion')}
smallTitle
className="livestream__discussion"
actions={
<>
{fetchingComments && (
<div className="main--empty">
<Spinner />
</div>
)}
<div
ref={commentsRef}
className={classnames('livestream__comments-wrapper', {
'livestream__comments-wrapper--with-height': commentsLength > 0,
})}
>
{!fetchingComments && comments.length > 0 ? (
<div className="livestream__comments">
{comments.map((comment) => (
<div key={comment.comment_id} className={classnames('livestream__comment')}>
{comment.channel_url ? (
<Button
target="_blank"
className={classnames('livestream__comment-author', {
'livestream__comment-author--streamer':
claim.signing_channel && claim.signing_channel.claim_id === comment.channel_id,
})}
navigate={comment.channel_url}
label={comment.channel_name}
/>
) : (
<div className="livestream__comment-author">{comment.channel_name}</div>
)}
<MarkdownPreview content={comment.comment} simpleLinks />
</div>
))}
</div>
) : (
<div className="main--empty" />
)}
</div>
<div className="livestream__comment-create">
<CommentCreate livestream bottom embed={embed} uri={uri} />
</div>
</>
}
/>
);
}
-9
View File
@@ -1,9 +0,0 @@
import { connect } from 'react-redux';
import { makeSelectClaimForUri } from 'lbry-redux';
import LivestreamLayout from './view';
const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state),
});
export default connect(select)(LivestreamLayout);
-34
View File
@@ -1,34 +0,0 @@
// @flow
import { 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 LivestreamLayout(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}/${'doomtube'}?skin=odysee&autoplay=1`} scrolling="no" allowFullScreen />
</div>
</div>
<FileTitleSection uri={uri} livestream activeViewers={activeViewers} />
</div>
<LivestreamComments uri={uri} />
</>
);
}
Loaded 100 of 258 files, more files were not shown because too many files have changed in this diff. Show more